checkpointing

This commit is contained in:
2026-10-31 18:26:32 +05:30
parent 9a3d916656
commit 44bb47481e
260 changed files with 9623 additions and 1333 deletions
@@ -0,0 +1,50 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json;
import daxi.moe.app.External;
import daxi.moe.app.Internal;
import daxi.moe.app.Moe;
import daxi.moe.test.setup.AbstractTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import java.util.logging.Logger;
/**
* @author indroneel
*/
@Tag("json-mod2obj")
@DisplayName("[JSON Codec] The codec is loaded to convert data between JSON and the model")
public class AllTests extends AbstractTests {
private static final Logger L = Logger.getLogger(AllTests.class.getName());
@Test
@Order(1)
@DisplayName("[JSON Codec] Codec is loaded")
public void test01() {
Moe moe = Moe.create();
External extern = moe.external("json");
Assertions.assertNotNull(extern);
Internal intern = moe.internal("json");
Assertions.assertNotNull(intern);
}
}
@@ -0,0 +1,60 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj;
import daxi.moe.app.External;
import daxi.moe.app.Moe;
import daxi.moe.test.setup.AbstractTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import java.io.File;
import java.nio.file.Files;
import java.util.logging.Logger;
/**
* This class is a placeholder for the test suite that will be used to test the JSON codec
* functionality. It extends AbstractTests, which provides common setup and utility methods for the
* tests.
*
* @author indroneel
*/
@Tag("json-mod2obj")
public class JsonMod2ObjTests extends AbstractTests {
private static final Logger L = Logger.getLogger(JsonMod2ObjTests.class.getName());
private External extern;
@BeforeEach
public final void beforeEach() {
L.info("beforeEach - resetting the test environment");
Moe moe = Moe.create();
extern = moe.external("json");
Assertions.assertNotNull(extern);
}
protected void loadExternal(String path) throws Exception {
File f = new File(path);
byte[] jsonData = Files.readAllBytes(f.toPath());
external().from(jsonData);
}
protected final External external() {
return extern;
}
}
@@ -0,0 +1,61 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj.semantics;
import daxi.moe.app.CodecException;
import daxi.moe.test.json.mod2obj.JsonMod2ObjTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import java.util.logging.Logger;
/**
* @author indroneel
*/
@DisplayName("[JSON Model2Object] Basic Semantics Tests")
public class AllTests extends JsonMod2ObjTests {
private static final Logger L = Logger.getLogger(AllTests.class.getName());
@Test
@Order(1)
@DisplayName("[JSON Model2Object] Invalid JSON data should throw CodecException")
public void test01() {
Assertions.assertThrows(CodecException.class, () -> {
loadExternal("testdata/json/mod2obj/semantics/bad01.json");
});
}
@Test
@Order(2)
@DisplayName("[JSON Model2Object] Valid JSON data should be converted successfully")
public void test02() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/semantics/good.json");
});
Root02 root = Assertions.assertDoesNotThrow(() -> {
return external().convert(Root02.class);
});
Assertions.assertNotNull(root);
Assertions.assertEquals("str-val-01", root.getMember1());
Assertions.assertEquals("str-val-02", root.getMember2());
Assertions.assertEquals(100, root.getMember3());
}
}
@@ -12,28 +12,28 @@
* limitations under the License.
*/
package daxi.moe.test.scenario.alfa.scn01;
package daxi.moe.test.json.mod2obj.semantics;
import daxi.moe.app.MapFrom;
public class InvalidEntity02 {
public class Root02 {
private String member1;
private String member2;
public InvalidEntity02(String member1, String member2) {
this.member1 = member1;
this.member2 = member2;
}
private int member3;
public String getMember1() {
return member1;
}
public String getMember2() {
public String getMember2() {
return member2;
}
public int getMember3() {
return member3;
}
@MapFrom("member1")
private void _setMember1(String value) {
member1 = value;
@@ -43,4 +43,9 @@ public class InvalidEntity02 {
private void _setMember2(String value) {
member2 = value;
}
@MapFrom("member3")
private void _setMember3(int value) {
member3 = value;
}
}
@@ -0,0 +1,50 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj.setter.linear.boolval;
import daxi.moe.test.json.mod2obj.JsonMod2ObjTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import java.util.List;
/**
* @author indroneel
*/
@DisplayName("[JSON Model2Object] Setter methods with collection of integer Values")
public class AllTests extends JsonMod2ObjTests {
@Test
@Order(1)
@DisplayName("[JSON Model2Object] Entity with integer collection is populated")
public void test01() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/linear/boolval/test01.json");
});
BooleanRoot root = Assertions.assertDoesNotThrow(() -> {
return external().convert(BooleanRoot.class);
});
List<Boolean> members = root.getMembers();
Assertions.assertFalse(members.isEmpty());
Assertions.assertEquals(true, members.get(0));
Assertions.assertEquals(false, members.get(1));
Assertions.assertEquals(true, members.get(2));
}
}
@@ -0,0 +1,38 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj.setter.linear.boolval;
import daxi.moe.app.MapFrom;
import java.util.ArrayList;
import java.util.List;
/**
* @author indroneel
*/
public class BooleanRoot {
private final List<Boolean> members = new ArrayList<>();
public List<Boolean> getMembers() {
return members;
}
@MapFrom("members")
private void _setMember(boolean value) {
members.add(value);
}
}
@@ -0,0 +1,50 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj.setter.linear.intval;
import daxi.moe.test.json.mod2obj.JsonMod2ObjTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import java.util.List;
/**
* @author indroneel
*/
@DisplayName("[JSON Model2Object] Setter methods with collection of integer Values")
public class AllTests extends JsonMod2ObjTests {
@Test
@Order(1)
@DisplayName("[JSON Model2Object] Entity with integer collection is populated")
public void test01() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/linear/intval/test01.json");
});
IntRoot root = Assertions.assertDoesNotThrow(() -> {
return external().convert(IntRoot.class);
});
List<Integer> members = root.getMembers();
Assertions.assertFalse(members.isEmpty());
Assertions.assertEquals(100, members.get(0));
Assertions.assertEquals(112, members.get(1));
Assertions.assertEquals(120, members.get(2));
}
}
@@ -0,0 +1,38 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj.setter.linear.intval;
import daxi.moe.app.MapFrom;
import java.util.ArrayList;
import java.util.List;
/**
* @author indroneel
*/
public class IntRoot {
private final List<Integer> members = new ArrayList<>();
public List<Integer> getMembers() {
return members;
}
@MapFrom("members")
private void _setMember(int value) {
members.add(value);
}
}
@@ -0,0 +1,79 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj.setter.linear.objval;
import daxi.moe.test.json.mod2obj.JsonMod2ObjTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import java.util.List;
/**
* @author indroneel
*/
@DisplayName("[JSON Model2Object] Setter methods for collection of mapped Values")
public class AllTests extends JsonMod2ObjTests {
@Test
@Order(1)
@DisplayName("[JSON Model2Object] Nested mapped value is populated")
public void test01() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/linear/objval/test01.json");
});
Root01 root = Assertions.assertDoesNotThrow(() -> {
return external().convert(Root01.class);
});
List<StringNested> nested = root.getNested();
Assertions.assertNotNull(nested);
Assertions.assertEquals(2, nested.size());
Assertions.assertEquals("str-val-01", nested.get(0).getMember1());
Assertions.assertEquals("str-val-02", nested.get(1).getMember1());
}
@Test
@Order(2)
@DisplayName("[JSON Model2Object] Nested collection of mapped values is populated")
public void test02() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/linear/objval/test02.json");
});
Root02 root = Assertions.assertDoesNotThrow(() -> {
return external().convert(Root02.class);
});
List<ColNested> nested = root.getNested();
Assertions.assertNotNull(nested);
Assertions.assertEquals(2, nested.size());
List<StringNested> strNested1 = nested.get(0).getItems();
Assertions.assertNotNull(strNested1);
Assertions.assertEquals(2, strNested1.size());
Assertions.assertEquals("str-val-01", strNested1.get(0).getMember1());
Assertions.assertEquals("str-val-02", strNested1.get(1).getMember1());
List<StringNested> strNested2 = nested.get(1).getItems();
Assertions.assertNotNull(strNested2);
Assertions.assertEquals(2, strNested2.size());
Assertions.assertEquals("str-val-03", strNested2.get(0).getMember1());
Assertions.assertEquals("str-val-04", strNested2.get(1).getMember1());
}
}
@@ -0,0 +1,38 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj.setter.linear.objval;
import daxi.moe.app.MapFrom;
import java.util.ArrayList;
import java.util.List;
public class ColNested {
private final List<StringNested> items;
public ColNested() {
items = new ArrayList<>();
}
public List<StringNested> getItems() {
return items;
}
@MapFrom("items")
private void _setItem(StringNested item) {
items.add(item);
}
}
@@ -0,0 +1,38 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj.setter.linear.objval;
import daxi.moe.app.MapFrom;
import java.util.ArrayList;
import java.util.List;
public class Root01 {
private final List<StringNested> nested;
public Root01() {
nested = new ArrayList<>();
}
public List<StringNested> getNested() {
return nested;
}
@MapFrom("nested")
private void _setNested(StringNested value) {
nested.add(value);
}
}
@@ -0,0 +1,38 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj.setter.linear.objval;
import daxi.moe.app.MapFrom;
import java.util.ArrayList;
import java.util.List;
public class Root02 {
private final List<ColNested> nested;
public Root02() {
nested = new ArrayList<>();
}
public List<ColNested> getNested() {
return nested;
}
@MapFrom("nested")
private void _setNested(ColNested value) {
nested.add(value);
}
}
@@ -12,18 +12,18 @@
* limitations under the License.
*/
package daxi.moe.test.scenario.alfa.scn03;
package daxi.moe.test.json.mod2obj.setter.linear.objval;
import daxi.moe.app.MapFrom;
public class StringEntity {
/**
* @author indroneel
*/
public class StringNested {
private String member1;
public StringEntity() {
//NOOP
}
public String getMember1() {
return member1;
}
@@ -0,0 +1,50 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj.setter.linear.strval;
import daxi.moe.test.json.mod2obj.JsonMod2ObjTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import java.util.List;
/**
* @author indroneel
*/
@DisplayName("[JSON Model2Object] Setter methods with collection of String Values")
public class AllTests extends JsonMod2ObjTests {
@Test
@Order(1)
@DisplayName("[JSON Model2Object] Entity with String collection is populated")
public void test01() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/linear/strval/test01.json");
});
StringRoot root = Assertions.assertDoesNotThrow(() -> {
return external().convert(StringRoot.class);
});
List<String> members = root.getMembers();
Assertions.assertFalse(members.isEmpty());
Assertions.assertEquals("first", members.get(0));
Assertions.assertEquals("second", members.get(1));
Assertions.assertEquals("third", members.get(2));
}
}
@@ -0,0 +1,38 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj.setter.linear.strval;
import daxi.moe.app.MapFrom;
import java.util.ArrayList;
import java.util.List;
/**
* @author indroneel
*/
public class StringRoot {
private final List<String> members = new ArrayList<>();
public List<String> getMembers() {
return members;
}
@MapFrom("members")
private void _setMember(String value) {
members.add(value);
}
}
@@ -0,0 +1,51 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj.setter.mapped.blank;
import daxi.moe.test.json.mod2obj.JsonMod2ObjTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import java.util.Map;
/**
* @author indroneel
*/
@DisplayName("[JSON Model2Object] Blank Mapped method for Nested String values")
public class AllTests extends JsonMod2ObjTests {
@Test
@Order(1)
@DisplayName("[JSON Model2Object] Nested blank mapped String values are populated")
public void test01() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/mapped/blank/test01.json");
});
Root root = Assertions.assertDoesNotThrow(() -> {
return external().convert(Root.class);
});
BlankNested nested = root.getNested();
Assertions.assertNotNull(nested);
Map<String, String> members = nested.getMembers();
Assertions.assertEquals(2, members.size());
Assertions.assertEquals("str-val-01", members.get("member1"));
Assertions.assertEquals("str-val-02", members.get("member2"));
}
}
@@ -0,0 +1,42 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj.setter.mapped.blank;
import daxi.moe.app.MapFrom;
import java.util.HashMap;
import java.util.Map;
/**
* @author indroneel
*/
public class BlankNested {
private final Map<String, String> members;
public BlankNested() {
members = new HashMap<>();
}
public Map<String, String> getMembers() {
return members;
}
@MapFrom
private void _setMe(String key, String value) {
members.put(key, value);
}
}
@@ -0,0 +1,31 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj.setter.mapped.blank;
import daxi.moe.app.MapFrom;
public class Root {
private BlankNested nested;
public BlankNested getNested() {
return nested;
}
@MapFrom("nested")
private void _setNested(BlankNested value) {
nested = value;
}
}
@@ -0,0 +1,85 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj.setter.mapped.intval;
import daxi.moe.test.json.mod2obj.JsonMod2ObjTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
/**
* @author indroneel
*/
@DisplayName("[JSON Model2Object] Setter methods with int/Integer Values")
public class AllTests extends JsonMod2ObjTests {
@Test
@Order(1)
@DisplayName("[JSON Model2Object] Entity with int/Integer setters is populated")
public void test01() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/mapped/intval/test01.json");
});
Root root = Assertions.assertDoesNotThrow(() -> {
return external().convert(Root.class);
});
IntNested nested = root.getNested();
Assertions.assertNotNull(nested);
Assertions.assertEquals(100, nested.getMember1());
Assertions.assertEquals(200, nested.getMember2());
}
@Test
@Order(2)
@DisplayName("[JSON Model2Object] Entity with int/Integer setters is populated from string " +
"values")
public void test02() throws Exception {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/mapped/intval/test02.json");
});
Root root = Assertions.assertDoesNotThrow(() -> {
return external().convert(Root.class);
});
IntNested nested = root.getNested();
Assertions.assertNotNull(nested);
Assertions.assertEquals(1000, nested.getMember1());
Assertions.assertEquals(2000, nested.getMember2());
}
@Test
@Order(3)
@DisplayName("[JSON Model2Object] Entity with int/Integer setters is not populated from " +
"non-numeric String values")
public void test03() throws Exception {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/mapped/intval/test03.json");
});
Root root = Assertions.assertDoesNotThrow(() -> {
return external().convert(Root.class);
});
IntNested nested = root.getNested();
Assertions.assertNotNull(nested);
Assertions.assertEquals(0, nested.getMember1());
Assertions.assertNull(nested.getMember2());
}
}
@@ -0,0 +1,41 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj.setter.mapped.intval;
import daxi.moe.app.MapFrom;
public class IntNested {
private int member1;
private Integer member2;
public int getMember1() {
return member1;
}
public Integer getMember2() {
return member2;
}
@MapFrom("member1")
private void _setMe1(int value) {
member1 = value;
}
@MapFrom("member2")
private void _setMe2(Integer value) {
member2 = value;
}
}
@@ -0,0 +1,31 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj.setter.mapped.intval;
import daxi.moe.app.MapFrom;
public class Root {
private IntNested nested;
public IntNested getNested() {
return nested;
}
@MapFrom("nested")
private void _setNested(IntNested value) {
nested = value;
}
}
@@ -0,0 +1,62 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj.setter.mapped.strval;
import daxi.moe.test.json.mod2obj.JsonMod2ObjTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
/**
* @author indroneel
*/
@DisplayName("[JSON Model2Object] Setter methods for Nested mapped String values")
public class AllTests extends JsonMod2ObjTests {
@Test
@Order(1)
@DisplayName("[JSON Model2Object] Nested mapped String value is populated")
public void test01() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/mapped/strval/test01.json");
});
Root root = Assertions.assertDoesNotThrow(() -> {
return external().convert(Root.class);
});
StringNested nested = root.getNested();
Assertions.assertNotNull(nested);
Assertions.assertEquals("str-val-01", nested.getMember1());
}
@Test
@Order(2)
@DisplayName("[JSON Model2Object] Nested mapped String value is not populated with simple data")
public void test02() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/mapped/strval/test02.json");
});
Root root = Assertions.assertDoesNotThrow(() -> {
return external().convert(Root.class);
});
StringNested nested = root.getNested();
Assertions.assertNull(nested);
}
}
@@ -0,0 +1,31 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj.setter.mapped.strval;
import daxi.moe.app.MapFrom;
public class Root {
private StringNested nested;
public StringNested getNested() {
return nested;
}
@MapFrom("nested")
private void _setNested(StringNested value) {
nested = value;
}
}
@@ -12,24 +12,24 @@
* limitations under the License.
*/
package daxi.moe.test.scenario.alfa.scn02;
package daxi.moe.test.json.mod2obj.setter.mapped.strval;
import daxi.moe.app.MapFrom;
public class NopopEntity01 {
/**
* @author indroneel
*/
public class StringNested {
private String member1;
public NopopEntity01() {
//NOOP
}
public String getMember1() {
return member1;
}
@MapFrom("member1")
private void setMember1(String value) {
private void _setMe(String value) {
member1 = value;
}
}
@@ -0,0 +1,96 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj.setter.simple.bdecval;
import daxi.moe.test.json.mod2obj.JsonMod2ObjTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import java.math.BigDecimal;
/**
* @author indroneel
*/
@DisplayName("[JSON Model2Object] Setter methods with BigDecimal Values")
public class AllTests extends JsonMod2ObjTests {
@Test
@Order(1)
@DisplayName("[JSON Model2Object] Entity with BigDecimal setters is populated from decimal " +
"values")
public void test01() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/simple/bdecval/test01.json");
});
BigDecimalRoot root = Assertions.assertDoesNotThrow(() -> {
return external().convert(BigDecimalRoot.class);
});
Assertions.assertEquals(new BigDecimal("12345.6789"), root.getMember1());
}
@Test
@Order(2)
@DisplayName("[JSON Model2Object] Entity with BigDecimal setters is populated from integer " +
"values")
public void test02() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/simple/bdecval/test02.json");
});
BigDecimalRoot root = Assertions.assertDoesNotThrow(() -> {
return external().convert(BigDecimalRoot.class);
});
Assertions.assertEquals(new BigDecimal("12345678901234567890"), root.getMember1());
}
@Test
@Order(3)
@DisplayName("[JSON Model2Object] Entity with BigDecimal setters is populated from precise " +
"string values")
public void test03() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/simple/bdecval/test03.json");
});
BigDecimalRoot root = Assertions.assertDoesNotThrow(() -> {
return external().convert(BigDecimalRoot.class);
});
Assertions.assertEquals(new BigDecimal("123456789012345678901234567890.123"),
root.getMember1());
}
@Test
@Order(4)
@DisplayName("[JSON Model2Object] Entity with BigDecimal setters is not populated from " +
"non-numeric String values")
public void test04() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/simple/bdecval/test04.json");
});
BigDecimalRoot root = Assertions.assertDoesNotThrow(() -> {
return external().convert(BigDecimalRoot.class);
});
Assertions.assertNull(root.getMember1());
}
}
@@ -0,0 +1,37 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj.setter.simple.bdecval;
import daxi.moe.app.MapFrom;
import java.math.BigDecimal;
public class BigDecimalRoot {
private BigDecimal member1;
public BigDecimalRoot() {
//NOOP
}
public BigDecimal getMember1() {
return member1;
}
@MapFrom("member1")
private void _setMe(BigDecimal value) {
member1 = value;
}
}
@@ -0,0 +1,113 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj.setter.simple.bintval;
import daxi.moe.test.json.mod2obj.JsonMod2ObjTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import java.math.BigInteger;
/**
* @author indroneel
*/
@DisplayName("[JSON Model2Object] Setter methods with BigInteger Values")
public class AllTests extends JsonMod2ObjTests {
@Test
@Order(1)
@DisplayName("[JSON Model2Object] Entity with BigInteger setters is populated from integer " +
"values")
public void test01() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/simple/bintval/test01.json");
});
BigIntegerRoot root = Assertions.assertDoesNotThrow(() -> {
return external().convert(BigIntegerRoot.class);
});
Assertions.assertEquals(new BigInteger("1234567890123"), root.getMember1());
}
@Test
@Order(2)
@DisplayName("[JSON Model2Object] Entity with BigInteger setters is populated from decimal " +
"values")
public void test02() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/simple/bintval/test02.json");
});
BigIntegerRoot root = Assertions.assertDoesNotThrow(() -> {
return external().convert(BigIntegerRoot.class);
});
Assertions.assertEquals(BigInteger.valueOf(123), root.getMember1());
}
@Test
@Order(3)
@DisplayName("[JSON Model2Object] Entity with BigInteger setters is populated from large " +
"string values")
public void test03() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/simple/bintval/test03.json");
});
BigIntegerRoot root = Assertions.assertDoesNotThrow(() -> {
return external().convert(BigIntegerRoot.class);
});
Assertions.assertEquals(new BigInteger("123456789012345678901234567890"),
root.getMember1());
}
@Test
@Order(4)
@DisplayName("[JSON Model2Object] Entity with BigInteger setters is not populated from " +
"non-numeric String values")
public void test04() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/simple/bintval/test04.json");
});
BigIntegerRoot root = Assertions.assertDoesNotThrow(() -> {
return external().convert(BigIntegerRoot.class);
});
Assertions.assertNull(root.getMember1());
}
@Test
@Order(5)
@DisplayName("[JSON Model2Object] Entity with BigInteger setters is populated from really " +
"large values that exceed the range of integer")
public void test05() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/simple/bintval/test05.json");
});
BigIntegerRoot root = Assertions.assertDoesNotThrow(() -> {
return external().convert(BigIntegerRoot.class);
});
Assertions.assertEquals(new BigInteger("123456789012345678901234567890"),
root.getMember1());
}
}
@@ -0,0 +1,41 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj.setter.simple.bintval;
import daxi.moe.app.MapFrom;
import java.math.BigInteger;
/**
* @author indroneel
*/
public class BigIntegerRoot {
private BigInteger member1;
public BigIntegerRoot() {
//NOOP
}
public BigInteger getMember1() {
return member1;
}
@MapFrom("member1")
private void _setMe(BigInteger value) {
member1 = value;
}
}
@@ -0,0 +1,66 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj.setter.simple.boolval;
import daxi.moe.test.json.mod2obj.JsonMod2ObjTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import java.util.logging.Logger;
/**
* @author indroneel
*/
@DisplayName("[JSON Model2Object] Setter methods with boolean Values")
public class AllTests extends JsonMod2ObjTests {
private static final Logger L = Logger.getLogger(AllTests.class.getName());
@Test
@Order(1)
@DisplayName("[JSON Model2Object] Entity with boolean/Boolean setters is created")
public void test01() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/simple/boolval/test01.json");
});
BooleanRoot root = Assertions.assertDoesNotThrow(() -> {
return external().convert(BooleanRoot.class);
});
Assertions.assertTrue(root.isMember1());
Assertions.assertTrue(root.getMember2());
}
@Test
@Order(2)
@DisplayName("[JSON Model2Object] Entity with boolean/Boolean setters is created from" +
" true/false string values")
public void test02() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/simple/boolval/test02.json");
});
BooleanRoot root = Assertions.assertDoesNotThrow(() -> {
return external().convert(BooleanRoot.class);
});
Assertions.assertTrue(root.isMember1());
Assertions.assertTrue(root.getMember2());
}
}
@@ -0,0 +1,45 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj.setter.simple.boolval;
import daxi.moe.app.MapFrom;
public class BooleanRoot {
private boolean member1;
private Boolean member2;
public BooleanRoot() {
//NOOP
}
public boolean isMember1() {
return member1;
}
public Boolean getMember2() {
return member2;
}
@MapFrom("member1")
private void first(boolean value) {
member1 = value;
}
@MapFrom("member2")
private void second(Boolean value) {
member2 = value;
}
}
@@ -0,0 +1,96 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj.setter.simple.byteval;
import daxi.moe.test.json.mod2obj.JsonMod2ObjTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
/**
* @author indroneel
*/
@DisplayName("[JSON Model2Object] Setter methods with byte/Byte Values")
public class AllTests extends JsonMod2ObjTests {
@Test
@Order(1)
@DisplayName("[JSON Model2Object] Entity with byte/Byte setters is populated")
public void test01() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/simple/byteval/test01.json");
});
ByteRoot root = Assertions.assertDoesNotThrow(() -> {
return external().convert(ByteRoot.class);
});
Assertions.assertEquals((byte) 26, root.getMember1());
Assertions.assertEquals(Byte.valueOf((byte) 27), root.getMember2());
}
@Test
@Order(2)
@DisplayName("[JSON Model2Object] Entity with byte/Byte setters is populated from String " +
"values")
public void test02() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/simple/byteval/test02.json");
});
ByteRoot root = Assertions.assertDoesNotThrow(() -> {
return external().convert(ByteRoot.class);
});
Assertions.assertEquals((byte) -128, root.getMember1());
Assertions.assertEquals(Byte.valueOf((byte) 127), root.getMember2());
}
@Test
@Order(3)
@DisplayName("[JSON Model2Object] Entity with byte/Byte setters is not populated from " +
"non-numeric String values")
public void test03() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/simple/byteval/test03.json");
});
ByteRoot root = Assertions.assertDoesNotThrow(() -> {
return external().convert(ByteRoot.class);
});
Assertions.assertEquals((byte) 0, root.getMember1());
Assertions.assertNull(root.getMember2());
}
@Test
@Order(4)
@DisplayName("[JSON Model2Object] Entity with byte/Byte setters is populated with loss of " +
"precision")
public void test04() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/simple/byteval/test04.json");
});
ByteRoot root = Assertions.assertDoesNotThrow(() -> {
return external().convert(ByteRoot.class);
});
Assertions.assertEquals((byte) 1, root.getMember1());
Assertions.assertEquals((byte) 2, root.getMember2());
}
}
@@ -0,0 +1,45 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj.setter.simple.byteval;
import daxi.moe.app.MapFrom;
public class ByteRoot {
private byte member1;
private Byte member2;
public ByteRoot() {
//NOOP
}
public byte getMember1() {
return member1;
}
public Byte getMember2() {
return member2;
}
@MapFrom("member1")
private void _setMember1(byte value) {
member1 = value;
}
@MapFrom("member2")
private void _setMember2(Byte value) {
member2 = value;
}
}
@@ -0,0 +1,79 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj.setter.simple.doubleval;
import daxi.moe.test.json.mod2obj.JsonMod2ObjTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
/**
* @author indroneel
*/
@DisplayName("[JSON Model2Object] Setter methods with double/Double Values")
public class AllTests extends JsonMod2ObjTests {
@Test
@Order(1)
@DisplayName("[JSON Model2Object] Entity with double/Double setters is populated")
public void test01() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/simple/doubleval/test01.json");
});
DoubleRoot root = Assertions.assertDoesNotThrow(() -> {
return external().convert(DoubleRoot.class);
});
Assertions.assertEquals(12.234d, root.getMember1());
Assertions.assertEquals(-987.0, root.getMember2());
}
@Test
@Order(2)
@DisplayName("[JSON Model2Object] Entity with double/Double setters is populated from string " +
"values")
public void test02() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/simple/doubleval/test02.json");
});
DoubleRoot root = Assertions.assertDoesNotThrow(() -> {
return external().convert(DoubleRoot.class);
});
Assertions.assertEquals(12345.625, root.getMember1());
Assertions.assertEquals(-0.125, root.getMember2());
}
@Test
@Order(3)
@DisplayName("[JSON Model2Object] Entity with double/Double setters is not populated from " +
"non-numeric String values")
public void test03() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/simple/doubleval/test03.json");
});
DoubleRoot root = Assertions.assertDoesNotThrow(() -> {
return external().convert(DoubleRoot.class);
});
Assertions.assertEquals(0.0, root.getMember1());
Assertions.assertNull(root.getMember2());
}
}
@@ -0,0 +1,45 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj.setter.simple.doubleval;
import daxi.moe.app.MapFrom;
public class DoubleRoot {
private double member1;
private Double member2;
public DoubleRoot() {
//NOOP
}
public double getMember1() {
return member1;
}
public Double getMember2() {
return member2;
}
@MapFrom("member1")
private void _setMe1(double value) {
member1 = value;
}
@MapFrom("member2")
private void _setMe2(Double value) {
member2 = value;
}
}
@@ -0,0 +1,79 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj.setter.simple.floatval;
import daxi.moe.test.json.mod2obj.JsonMod2ObjTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
/**
* @author indroneel
*/
@DisplayName("[JSON Model2Object] Setter methods with float/Float Values")
public class AllTests extends JsonMod2ObjTests {
@Test
@Order(1)
@DisplayName("[JSON Model2Object] Entity with float/Float setters is populated")
public void test01() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/simple/floatval/test01.json");
});
FloatRoot root = Assertions.assertDoesNotThrow(() -> {
return external().convert(FloatRoot.class);
});
Assertions.assertEquals(12.0f, root.getMember1());
Assertions.assertEquals(-987.0f, root.getMember2());
}
@Test
@Order(2)
@DisplayName("[JSON Model2Object] Entity with float/Float setters is populated from string " +
"values")
public void test02() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/simple/floatval/test02.json");
});
FloatRoot root = Assertions.assertDoesNotThrow(() -> {
return external().convert(FloatRoot.class);
});
Assertions.assertEquals(12345.625f, root.getMember1());
Assertions.assertEquals(-0.125f, root.getMember2());
}
@Test
@Order(3)
@DisplayName("[JSON Model2Object] Entity with float/Float setters is not populated from " +
"non-numeric String values")
public void test03() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/simple/floatval/test03.json");
});
FloatRoot root = Assertions.assertDoesNotThrow(() -> {
return external().convert(FloatRoot.class);
});
Assertions.assertEquals(0.0f, root.getMember1());
Assertions.assertNull(root.getMember2());
}
}
@@ -0,0 +1,45 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj.setter.simple.floatval;
import daxi.moe.app.MapFrom;
public class FloatRoot {
private float member1;
private Float member2;
public FloatRoot() {
//NOOP
}
public float getMember1() {
return member1;
}
public Float getMember2() {
return member2;
}
@MapFrom("member1")
private void _setMe1(float value) {
member1 = value;
}
@MapFrom("member2")
private void _setMe2(Float value) {
member2 = value;
}
}
@@ -0,0 +1,79 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj.setter.simple.intval;
import daxi.moe.test.json.mod2obj.JsonMod2ObjTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
/**
* @author indroneel
*/
@DisplayName("[JSON Model2Object] Setter methods with int/Integer Values")
public class AllTests extends JsonMod2ObjTests {
@Test
@Order(1)
@DisplayName("[JSON Model2Object] Entity with int/Integer setters is populated")
public void test01() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/simple/intval/test01.json");
});
IntegerRoot root = Assertions.assertDoesNotThrow(() -> {
return external().convert(IntegerRoot.class);
});
Assertions.assertEquals(100, root.getMember1());
Assertions.assertEquals(200, root.getMember2());
}
@Test
@Order(2)
@DisplayName("[JSON Model2Object] Entity with int/Integer setters is populated from string " +
"values")
public void test02() throws Exception {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/simple/intval/test02.json");
});
IntegerRoot root = Assertions.assertDoesNotThrow(() -> {
return external().convert(IntegerRoot.class);
});
Assertions.assertEquals(1000, root.getMember1());
Assertions.assertEquals(2000, root.getMember2());
}
@Test
@Order(3)
@DisplayName("[JSON Model2Object] Entity with int/Integer setters is not populated from " +
"non-numeric String values")
public void test03() throws Exception {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/simple/intval/test03.json");
});
IntegerRoot root = Assertions.assertDoesNotThrow(() -> {
return external().convert(IntegerRoot.class);
});
Assertions.assertEquals(0, root.getMember1());
Assertions.assertNull(root.getMember2());
}
}
@@ -0,0 +1,45 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj.setter.simple.intval;
import daxi.moe.app.MapFrom;
public class IntegerRoot {
private int member1;
private Integer member2;
public IntegerRoot() {
//NOOP
}
public int getMember1() {
return member1;
}
public Integer getMember2() {
return member2;
}
@MapFrom("member1")
private void _setMe1(int value) {
member1 = value;
}
@MapFrom("member2")
private void _setMe2(Integer value) {
member2 = value;
}
}
@@ -0,0 +1,79 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj.setter.simple.longval;
import daxi.moe.test.json.mod2obj.JsonMod2ObjTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
/**
* @author indroneel
*/
@DisplayName("[JSON Model2Object] Setter methods with long/Long Values")
public class AllTests extends JsonMod2ObjTests {
@Test
@Order(1)
@DisplayName("[JSON Model2Object] Entity with long/Long setters is populated")
public void test01() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/simple/longval/test01.json");
});
LongRoot root = Assertions.assertDoesNotThrow(() -> {
return external().convert(LongRoot.class);
});
Assertions.assertEquals(1234567890123L, root.getMember1());
Assertions.assertEquals(9876543210987L, root.getMember2());
}
@Test
@Order(2)
@DisplayName("[JSON Model2Object] Entity with long/Long setters is populated from string " +
"values")
public void test02() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/simple/longval/test02.json");
});
LongRoot root = Assertions.assertDoesNotThrow(() -> {
return external().convert(LongRoot.class);
});
Assertions.assertEquals(12345678901234L, root.getMember1());
Assertions.assertEquals(98765432109876L, root.getMember2());
}
@Test
@Order(3)
@DisplayName("[JSON Model2Object] Entity with long/Long setters is not populated from " +
"non-numeric String values")
public void test03() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/simple/longval/test03.json");
});
LongRoot root = Assertions.assertDoesNotThrow(() -> {
return external().convert(LongRoot.class);
});
Assertions.assertEquals(0L, root.getMember1());
Assertions.assertNull(root.getMember2());
}
}
@@ -0,0 +1,45 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj.setter.simple.longval;
import daxi.moe.app.MapFrom;
public class LongRoot {
private long member1;
private Long member2;
public LongRoot() {
//NOOP
}
public long getMember1() {
return member1;
}
public Long getMember2() {
return member2;
}
@MapFrom("member1")
private void _setMe1(long value) {
member1 = value;
}
@MapFrom("member2")
private void _setMe2(Long value) {
member2 = value;
}
}
@@ -0,0 +1,96 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj.setter.simple.shortval;
import daxi.moe.test.json.mod2obj.JsonMod2ObjTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
/**
* @author indroneel
*/
@DisplayName("[JSON Model2Object] Setter methods with short/Short Values")
public class AllTests extends JsonMod2ObjTests {
@Test
@Order(1)
@DisplayName("[JSON Model2Object] Entity with short/Short setters is populated")
public void test01() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/simple/shortval/test01.json");
});
ShortRoot root = Assertions.assertDoesNotThrow(() -> {
return external().convert(ShortRoot.class);
});
Assertions.assertEquals((short) 16343, root.getMember1());
Assertions.assertEquals(Short.valueOf((short) 2048), root.getMember2());
}
@Test
@Order(2)
@DisplayName("[JSON Model2Object] Entity with short/Short setters is populated from String " +
"values")
public void test02() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/simple/shortval/test02.json");
});
ShortRoot root = Assertions.assertDoesNotThrow(() -> {
return external().convert(ShortRoot.class);
});
Assertions.assertEquals(Short.MIN_VALUE, root.getMember1());
Assertions.assertEquals(Short.valueOf(Short.MAX_VALUE), root.getMember2());
}
@Test
@Order(3)
@DisplayName("[JSON Model2Object] Entity with short/Short setters is not populated from " +
"non-numeric String values")
public void test03() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/simple/shortval/test03.json");
});
ShortRoot root = Assertions.assertDoesNotThrow(() -> {
return external().convert(ShortRoot.class);
});
Assertions.assertEquals((short) 0, root.getMember1());
Assertions.assertNull(root.getMember2());
}
@Test
@Order(4)
@DisplayName("[JSON Model2Object] Entity with short/Short setters is populated with loss of " +
"precision")
public void test04() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/simple/shortval/test04.json");
});
ShortRoot root = Assertions.assertDoesNotThrow(() -> {
return external().convert(ShortRoot.class);
});
Assertions.assertEquals((short) -32767, root.getMember1());
Assertions.assertEquals(Short.valueOf((short) -32766), root.getMember2());
}
}
@@ -0,0 +1,49 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj.setter.simple.shortval;
import daxi.moe.app.MapFrom;
/**
* @author indroneel
*/
public class ShortRoot {
private short member1;
private Short member2;
public ShortRoot() {
//NOOP
}
public short getMember1() {
return member1;
}
public Short getMember2() {
return member2;
}
@MapFrom("member1")
private void _setMe1(short value) {
member1 = value;
}
@MapFrom("member2")
private void _setMe2(Short value) {
member2 = value;
}
}
@@ -0,0 +1,44 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.json.mod2obj.setter.simple.strval;
import daxi.moe.test.json.mod2obj.JsonMod2ObjTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
/**
* @author indroneel
*/
@DisplayName("[JSON Model2Object] Setter methods with String Values")
public class AllTests extends JsonMod2ObjTests {
@Test
@Order(1)
@DisplayName("[JSON Model2Object] Entity with String setters is populated")
public void test01() {
Assertions.assertDoesNotThrow(() -> {
loadExternal("testdata/json/mod2obj/setter/simple/strval/test01.json");
});
StringRoot root = Assertions.assertDoesNotThrow(() -> {
return external().convert(StringRoot.class);
});
Assertions.assertEquals("str-val-01", root.getMember1());
}
}
@@ -12,24 +12,20 @@
* limitations under the License.
*/
package daxi.moe.test.scenario.alfa.scn02;
package daxi.moe.test.json.mod2obj.setter.simple.strval;
import daxi.moe.app.MapFrom;
public class NopopEntity03 {
public class StringRoot {
private String member1;
public NopopEntity03() {
//NOOP
}
public String getMember1() {
return member1;
}
@MapFrom("member1")
private void _setMember(String value, boolean flag) {
private void _setMember1(String value) {
member1 = value;
}
}
@@ -12,11 +12,16 @@
* limitations under the License.
*/
package daxi.moe.test.scenario.delta;
package daxi.moe.test.mem;
import daxi.moe.app.External;
import daxi.moe.app.Internal;
import daxi.moe.app.Moe;
import daxi.moe.test.setup.AbstractTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import java.util.logging.Logger;
@@ -25,20 +30,21 @@ import java.util.logging.Logger;
* @author indroneel
*/
@DisplayName("Tests Delta")
@Tag("mem-mod2obj")
@DisplayName("[MEM Codec] The codec is loaded to convert data between JSON and the model")
public class AllTests extends AbstractTests {
private static final Logger L = Logger.getLogger(AllTests.class.getName());
@Test
@Order(1)
@DisplayName("[JSON Codec] Codec is loaded")
public void test01() {
Moe moe = Moe.create();
External extern = moe.external("mem");
Assertions.assertNotNull(extern);
}
@Test
@Order(2)
public void test02() {
Internal intern = moe.internal("mem");
Assertions.assertNotNull(intern);
}
}
@@ -0,0 +1,61 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.mod2obj;
import daxi.moe.app.External;
import daxi.moe.app.Moe;
import daxi.moe.model.AnyData;
import daxi.moe.model.MappedData;
import daxi.moe.test.setup.AbstractTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import java.util.logging.Logger;
/**
* This class is a placeholder for the test suite that will be used to test the model to object
* transfer functionalities. It extends AbstractTests, which provides common setup and utility
* methods for the tests.
*
* @author indroneel
*/
@Tag("mem-mod2obj")
public class MemMod2ObjTests extends AbstractTests {
private static final Logger L = Logger.getLogger(MemMod2ObjTests.class.getName());
private External extern;
private MappedData mainData;
@BeforeEach
public final void beforeEach() {
L.info("beforeEach - resetting the test environment");
Moe moe = Moe.create();
extern = moe.external("mem");
AnyData model = extern.getModel();
mainData = model.asMapped();
Assertions.assertNotNull(mainData);
}
protected final External external() {
return extern;
}
protected final MappedData mainData() {
return mainData;
}
}
@@ -0,0 +1,71 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.mod2obj.semantics;
import daxi.moe.model.AnyData;
import daxi.moe.model.SimpleData;
import daxi.moe.test.mem.mod2obj.MemMod2ObjTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import java.util.logging.Logger;
/**
* @author indroneel
*/
@DisplayName("[MEM Model2Object] Basic validity checks for root entities")
public class AllTests extends MemMod2ObjTests {
private static final Logger L = Logger.getLogger(AllTests.class.getName());
@Test
@Order(1)
@DisplayName("[MEM Model2Object] Entity without @MapFrom annotations is not created")
public void test01() {
mainData().put("member1", new AnyData(new SimpleData("string-value-01")));
mainData().put("member2", new AnyData(new SimpleData("string-value-02")));
InvalidRoot01 root =
Assertions.assertDoesNotThrow(() -> external().convert(InvalidRoot01.class));
Assertions.assertNull(root);
}
@Test
@Order(2)
@DisplayName("[MEM Model2Object] Entity without a default constructor is not created")
public void test02() {
mainData().put("member1", new AnyData(new SimpleData("string-value-01")));
mainData().put("member2", new AnyData(new SimpleData("string-value-02")));
InvalidRoot02 root =
Assertions.assertDoesNotThrow(() -> external().convert(InvalidRoot02.class));
Assertions.assertNull(root);
}
@Test
@Order(3)
@DisplayName("[MEM Model2Object] Entity without a public default constructor is not created")
public void test03() {
mainData().put("member1", new AnyData(new SimpleData("string-value-01")));
mainData().put("member2", new AnyData(new SimpleData("string-value-02")));
InvalidRoot03 root =
Assertions.assertDoesNotThrow(() -> external().convert(InvalidRoot03.class));
Assertions.assertNull(root);
}
}
@@ -0,0 +1,40 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.mod2obj.semantics;
/**
* An invalid root entity during model to object transfer. It has a public default constructor, but
* does not have any setter, blank mapped, or blank linear method.
*
* @author indroneel
*/
public class InvalidRoot01 {
private String member1;
private String member2;
public InvalidRoot01() {
//NOOP
}
public String getMember1() {
return member1;
}
public String getMember2() {
return member2;
}
}
@@ -0,0 +1,53 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.mod2obj.semantics;
import daxi.moe.app.MapFrom;
/**
* An invalid root entity during model to object transfer. It has setter methods, but does not have
* a default constructor.
*
* @author indroneel
*/
public class InvalidRoot02 {
private String member1;
private String member2;
public InvalidRoot02(String member1, String member2) {
this.member1 = member1;
this.member2 = member2;
}
public String getMember1() {
return member1;
}
public String getMember2() {
return member2;
}
@MapFrom("member1")
private void _setMember1(String value) {
member1 = value;
}
@MapFrom("member2")
private void _setMember2(String value) {
member2 = value;
}
}
@@ -12,16 +12,23 @@
* limitations under the License.
*/
package daxi.moe.test.scenario.alfa.scn01;
package daxi.moe.test.mem.mod2obj.semantics;
import daxi.moe.app.MapFrom;
public class InvalidEntity03 {
/**
* An invalid root entity during model to object transfer. It has setter methods, but does not have
* a default constructor that is public.
*
* @author indroneel
*/
public class InvalidRoot03 {
private String member1;
private String member2;
protected InvalidEntity03() {
protected InvalidRoot03() {
//NOOP
}
@@ -0,0 +1,129 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.mod2obj.setter.semantics;
import daxi.moe.app.ConvertException;
import daxi.moe.model.AnyData;
import daxi.moe.model.SimpleData;
import daxi.moe.test.mod2obj.Check;
import daxi.moe.test.mem.mod2obj.MemMod2ObjTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import java.util.logging.Logger;
/**
* @author indroneel
*/
@DisplayName("[MEM Model2Object] Simple setter semantics")
public class AllTests extends MemMod2ObjTests {
private static final Logger L = Logger.getLogger(AllTests.class.getName());
@Test
@Order(1)
@DisplayName("[MEM Model2Object] setter method requires a @MapFrom annotation")
public void test01() {
mainData().put("member", new AnyData(new SimpleData("string-value-01")));
Root01 root =
Assertions.assertDoesNotThrow(() -> external().convert(Root01.class));
Assertions.assertNull(root);
}
@Test
@Order(2)
@DisplayName("[MEM Model2Object] setter method must have private visibility")
public void test02() {
mainData().put("member", new AnyData(new SimpleData("string-value-01")));
Root02 root =
Assertions.assertDoesNotThrow(() -> external().convert(Root02.class));
Assertions.assertNull(root);
}
@Test
@Order(3)
@DisplayName("[MEM Model2Object] setter method must return void")
public void test03() {
mainData().put("member", new AnyData(new SimpleData("string-value-01")));
Root03 root =
Assertions.assertDoesNotThrow(() -> external().convert(Root03.class));
Assertions.assertNull(root);
}
@Test
@Order(4)
@DisplayName("[MEM Model2Object] setter method cannot have zero parameters")
public void test04() {
mainData().put("member", new AnyData(new SimpleData("string-value-01")));
Root04 root =
Assertions.assertDoesNotThrow(() -> external().convert(Root04.class));
Assertions.assertNull(root);
}
@Test
@Order(5)
@DisplayName("[MEM Model2Object] setter method cannot have more than two parameters")
public void test05() {
mainData().put("member", new AnyData(new SimpleData("string-value-01")));
Root05 root =
Assertions.assertDoesNotThrow(() -> external().convert(Root05.class));
Assertions.assertNull(root);
}
@Test
@Order(6)
@DisplayName("[MEM Model2Object] setter method cannot map SimpleData to objects")
public void test06() {
mainData().put("member", new AnyData(new SimpleData("string-value-01")));
Check.reset();
Root06 root =
Assertions.assertDoesNotThrow(() -> external().convert(Root06.class));
Assertions.assertNotNull(root);
Assertions.assertFalse(Check.isSet());
}
@Test
@Order(7)
@DisplayName("[MEM Model2Object] setter method can throw an exception")
public void test07() {
mainData().put("member", new AnyData(new SimpleData("string-value-01")));
Check.reset();
ConvertException exep =
Assertions.assertThrows(
ConvertException.class, () -> external().convert(Root07.class));
}
@Test
@Order(8)
@DisplayName("[MEM Model2Object] Two setter methods mapped to the same data key throw an exception")
public void test08() {
mainData().put("member", new AnyData(new SimpleData("string-value-01")));
Check.reset();
ConvertException exep =
Assertions.assertThrows(
ConvertException.class, () -> external().convert(Root08.class));
}
}
@@ -12,24 +12,24 @@
* limitations under the License.
*/
package daxi.moe.test.scenario.alfa.scn02;
package daxi.moe.test.mem.mod2obj.setter.semantics;
import daxi.moe.app.MapFrom;
public class NopopEntity02 {
/**
* @author indroneel
*/
public class Nested {
private String member1;
public NopopEntity02() {
//NOOP
}
public String getMember1() {
return member1;
}
@MapFrom("member1")
private void _set(String value) {
private void _setMember1(String value) {
member1 = value;
}
}
@@ -0,0 +1,39 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.mod2obj.setter.semantics;
/**
* An invalid root entity during model to object transfer. It has a public default constructor, but
* does not have a setter that is annotated with {@link daxi.moe.app.MapFrom}.
*
* @author indroneel
*/
public class Root01 {
private String member;
public Root01() {
//NOOP
}
public String getMember() {
return member;
}
private void _setMember(String value) {
member = value;
}
}
@@ -0,0 +1,42 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.mod2obj.setter.semantics;
import daxi.moe.app.MapFrom;
/**
* An invalid root entity during model to object transfer. It has a public default constructor, and
* a setter method with public visibility.
*
* @author indroneel
*/
public class Root02 {
private String member;
public Root02() {
//NOOP
}
public String getMember() {
return member;
}
@MapFrom("member")
public void _setMember(String value) {
member = value;
}
}
@@ -0,0 +1,43 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.mod2obj.setter.semantics;
import daxi.moe.app.MapFrom;
/**
* An invalid root entity during model to object transfer. It has a public default constructor, and
* a setter method with private visibility that returns a value.
*
* @author indroneel
*/
public class Root03 {
private String member;
public Root03() {
//NOOP
}
public String getMember() {
return member;
}
@MapFrom("member")
private int _setMember(String value) {
member = value;
return 0;
}
}
@@ -0,0 +1,42 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.mod2obj.setter.semantics;
import daxi.moe.app.MapFrom;
/**
* An invalid root entity during model to object transfer. It has a public default constructor, and
* a setter method with private visibility and no parameters.
*
* @author indroneel
*/
public class Root04 {
private String member;
public Root04() {
//NOOP
}
public String getMember() {
return member;
}
@MapFrom("member")
private void _setMember() {
member = "some value";
}
}
@@ -0,0 +1,42 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.mod2obj.setter.semantics;
import daxi.moe.app.MapFrom;
/**
* An invalid root entity during model to object transfer. It has a public default constructor, and
* a setter method with private visibility that takes multiple parameters.
*
* @author indroneel
*/
public class Root05 {
private String member;
public Root05() {
//NOOP
}
public String getMember() {
return member;
}
@MapFrom("member")
private void _setMember(String value1, String value2, String value3) {
member = value1;
}
}
@@ -0,0 +1,44 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.mod2obj.setter.semantics;
import daxi.moe.app.MapFrom;
import daxi.moe.test.mod2obj.Check;
/**
* An invalid root entity during model to object transfer. It has a public default constructor, and
* a setter method with private visibility and an object parameter.
*
* @author indroneel
*/
public class Root06 {
private String member;
public Root06() {
//NOOP
}
public String getMember() {
return member;
}
@MapFrom("member")
private void _setMember(Nested nested) {
Check.set();
member = "some value";
}
}
@@ -0,0 +1,42 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.mod2obj.setter.semantics;
import daxi.moe.app.MapFrom;
/**
* An invalid root entity during model to object transfer. It has a public default constructor, and
* a setter method that throws an exception.
*
* @author indroneel
*/
public class Root07 {
private String member;
public Root07() {
//NOOP
}
public String getMember() {
return member;
}
@MapFrom("member")
private void _setMember(String value) {
throw new RuntimeException("some-error");
}
}
@@ -0,0 +1,47 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.mod2obj.setter.semantics;
import daxi.moe.app.MapFrom;
/**
* An invalid root entity during model to object transfer. It has two setters mapped to the same
* data key.
*
* @author indroneel
*/
public class Root08 {
private String member;
public Root08() {
//NOOP
}
public String getMember() {
return member;
}
@MapFrom("member")
private void _setMember1(String value) {
member = value;
}
@MapFrom("member")
private void _setMember2(String value) {
member = value;
}
}
@@ -0,0 +1,95 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.mod2obj.setter.simple.bdecval;
import daxi.moe.model.AnyData;
import daxi.moe.model.SimpleData;
import daxi.moe.test.scenario.mem.MemCodecTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import java.math.BigDecimal;
import java.util.Random;
import java.util.logging.Logger;
/**
* @author indroneel
*/
@DisplayName("[MEM Model2Object] Simple big decimal setters")
public class AllTests extends MemCodecTests {
private static final Logger L = Logger.getLogger(AllTests.class.getName());
@Test
@Order(1)
@DisplayName("[MEM Model2Object] Entity with BigDecimal setters is created from double values")
public void test01() {
Random random = new Random();
double val1 = random.nextDouble();
mainData().put("member1", new AnyData(new SimpleData(val1)));
BigDecimalRoot root =
Assertions.assertDoesNotThrow(() -> external().convert(BigDecimalRoot.class));
Assertions.assertNotNull(root);
Assertions.assertEquals(BigDecimal.valueOf(val1), root.getMember1());
}
@Test
@Order(2)
@DisplayName("[MEM Model2Object] Entity with BigDecimal setters is created from long values")
public void test02() {
Random random = new Random();
long val1 = random.nextLong();
mainData().put("member1", new AnyData(new SimpleData(val1)));
BigDecimalRoot root =
Assertions.assertDoesNotThrow(() -> external().convert(BigDecimalRoot.class));
Assertions.assertNotNull(root);
Assertions.assertEquals(BigDecimal.valueOf(val1), root.getMember1());
}
@Test
@Order(3)
@DisplayName("[MEM Model2Object] Entity with BigDecimal setters is created from string values")
public void test03() {
Random random = new Random();
String val1 = "123456789012345678901234567890.123";
mainData().put("member1", new AnyData(new SimpleData(val1)));
BigDecimalRoot root =
Assertions.assertDoesNotThrow(() -> external().convert(BigDecimalRoot.class));
Assertions.assertNotNull(root);
Assertions.assertEquals(new BigDecimal(val1), root.getMember1());
}
@Test
@Order(4)
@DisplayName("[MEM Model2Object] Entity with BigDecimal setters is not created from " +
"non-numeric string values")
public void test04() {
String val1 = "bad big decimal";
mainData().put("member1", new AnyData(new SimpleData(val1)));
BigDecimalRoot root =
Assertions.assertDoesNotThrow(() -> external().convert(BigDecimalRoot.class));
Assertions.assertNotNull(root);
Assertions.assertNull(root.getMember1());
}
}
@@ -12,7 +12,7 @@
* limitations under the License.
*/
package daxi.moe.test.scenario.alfa.scn11;
package daxi.moe.test.mem.mod2obj.setter.simple.bdecval;
import daxi.moe.app.MapFrom;
@@ -22,11 +22,11 @@ import java.math.BigDecimal;
* @author indroneel
*/
public class BigDecimalEntity {
public class BigDecimalRoot {
private BigDecimal member1;
public BigDecimalEntity() {
public BigDecimalRoot() {
//NOOP
}
@@ -0,0 +1,96 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.mod2obj.setter.simple.bintval;
import daxi.moe.model.AnyData;
import daxi.moe.model.SimpleData;
import daxi.moe.test.mem.mod2obj.MemMod2ObjTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import java.math.BigInteger;
import java.util.Random;
import java.util.logging.Logger;
/**
* @author indroneel
*/
@DisplayName("[MEM Model2Object] Simple big integer setters")
public class AllTests extends MemMod2ObjTests {
private static final Logger L = Logger.getLogger(AllTests.class.getName());
@Test
@Order(1)
@DisplayName("[MEM Model2Object] Entity with BigInteger setters is created from long values")
public void test01() {
Random random = new Random();
long val1 = random.nextLong();
mainData().put("member1", new AnyData(new SimpleData(val1)));
BigIntegerRoot root =
Assertions.assertDoesNotThrow(() -> external().convert(BigIntegerRoot.class));
Assertions.assertNotNull(root);
Assertions.assertEquals(BigInteger.valueOf(val1), root.getMember1());
}
@Test
@Order(2)
@DisplayName("[MEM Model2Object] Entity with BigInteger setters is created from double values")
public void test02() {
Random random = new Random();
double val1 = random.nextDouble();
mainData().put("member1", new AnyData(new SimpleData(val1)));
BigIntegerRoot root =
Assertions.assertDoesNotThrow(() -> external().convert(BigIntegerRoot.class));
Assertions.assertNotNull(root);
Assertions.assertEquals(BigInteger.valueOf((long) val1), root.getMember1());
}
@Test
@Order(3)
@DisplayName("[MEM Model2Object] Entity with BigInteger setters is created from string values")
public void test03() {
Random random = new Random();
String val1 = "123456789012345678901234567890";
mainData().put("member1", new AnyData(new SimpleData(val1)));
BigIntegerRoot root =
Assertions.assertDoesNotThrow(() -> external().convert(BigIntegerRoot.class));
Assertions.assertNotNull(root);
Assertions.assertEquals(new BigInteger(val1), root.getMember1());
}
@Test
@Order(4)
@DisplayName("[MEM Model2Object] Entity with BigInteger setters is not created from " +
"non-numeric string values")
public void test04() {
String val1 = "bad big integer";
mainData().put("member1", new AnyData(new SimpleData(val1)));
BigIntegerRoot root =
Assertions.assertDoesNotThrow(() -> external().convert(BigIntegerRoot.class));
Assertions.assertNotNull(root);
Assertions.assertNull(root.getMember1());
}
}
@@ -12,7 +12,7 @@
* limitations under the License.
*/
package daxi.moe.test.scenario.alfa.scn10;
package daxi.moe.test.mem.mod2obj.setter.simple.bintval;
import daxi.moe.app.MapFrom;
@@ -22,11 +22,11 @@ import java.math.BigInteger;
* @author indroneel
*/
public class BigIntegerEntity {
public class BigIntegerRoot {
private BigInteger member1;
public BigIntegerEntity() {
public BigIntegerRoot() {
//NOOP
}
@@ -0,0 +1,89 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.mod2obj.setter.simple.boolval;
import daxi.moe.model.AnyData;
import daxi.moe.model.SimpleData;
import daxi.moe.test.mem.mod2obj.MemMod2ObjTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import java.util.logging.Logger;
/**
* @author indroneel
*/
@DisplayName("[MEM Model2Object] Simple boolean setters")
public class AllTests extends MemMod2ObjTests {
private static final Logger L = Logger.getLogger(AllTests.class.getName());
@Test
@Order(1)
@DisplayName("[MEM Model2Object] Entity with boolean/Boolean setters is created")
public void test01() {
mainData().put("member1", new AnyData(new SimpleData(true)));
mainData().put("member2", new AnyData(new SimpleData(Boolean.TRUE)));
BooleanRoot root =
Assertions.assertDoesNotThrow(() -> external().convert(BooleanRoot.class));
Assertions.assertNotNull(root);
Assertions.assertTrue(root.isMember1());
Assertions.assertNotNull(root.getMember2());
Assertions.assertEquals(Boolean.TRUE, root.getMember2());
}
@Test
@Order(2)
@DisplayName("[MEM Model2Object] Entity with boolean/Boolean setters is created from " +
"true/false string values")
public void test02() {
String val1 = "true";
String val2 = "tRUe";
mainData().put("member1", new AnyData(new SimpleData(val1)));
mainData().put("member2", new AnyData(new SimpleData(val2)));
BooleanRoot root =
Assertions.assertDoesNotThrow(() -> external().convert(BooleanRoot.class));
Assertions.assertNotNull(root);
Assertions.assertTrue(root.isMember1());
Assertions.assertNotNull(root.getMember2());
Assertions.assertEquals(Boolean.TRUE, root.getMember2());
}
@Test
@Order(3)
@DisplayName("[MEM Model2Object] Entity with boolean/Boolean setters is created from number " +
"values")
public void test03() {
int val1 = 100;
int val2 = 0;
mainData().put("member1", new AnyData(new SimpleData(val1)));
mainData().put("member2", new AnyData(new SimpleData(val2)));
BooleanRoot root =
Assertions.assertDoesNotThrow(() -> external().convert(BooleanRoot.class));
Assertions.assertNotNull(root);
Assertions.assertTrue(root.isMember1());
Assertions.assertNotNull(root.getMember2());
Assertions.assertEquals(Boolean.FALSE, root.getMember2());
}
}
@@ -12,16 +12,16 @@
* limitations under the License.
*/
package daxi.moe.test.scenario.alfa.scn03;
package daxi.moe.test.mem.mod2obj.setter.simple.boolval;
import daxi.moe.app.MapFrom;
public class BooleanEntity {
public class BooleanRoot {
private boolean member1;
private Boolean member2;
public BooleanEntity() {
public BooleanRoot() {
//NOOP
}
@@ -34,12 +34,12 @@ public class BooleanEntity {
}
@MapFrom("member1")
private void _setMe1(boolean value) {
private void first(boolean value) {
member1 = value;
}
@MapFrom("member2")
private void _setMe2(Boolean value) {
private void second(Boolean value) {
member2 = value;
}
}
@@ -0,0 +1,84 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.mod2obj.setter.simple.byteval;
import daxi.moe.model.AnyData;
import daxi.moe.model.SimpleData;
import daxi.moe.test.mem.mod2obj.MemMod2ObjTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import java.util.logging.Logger;
/**
* @author indroneel
*/
@DisplayName("[MEM Model2Object] Simple byte setters")
public class AllTests extends MemMod2ObjTests {
private static final Logger L = Logger.getLogger(AllTests.class.getName());
@Test
@Order(1)
@DisplayName("[MEM Model2Object] Entity with byte/Byte setters is created")
public void test01() {
byte val1 = 0x1A;
byte val2 = 0x1B;
mainData().put("member1", new AnyData(new SimpleData(val1)));
mainData().put("member2", new AnyData(new SimpleData(val2)));
ByteRoot root =
Assertions.assertDoesNotThrow(() -> external().convert(ByteRoot.class));
Assertions.assertNotNull(root);
Assertions.assertEquals(val1, root.getMember1());
Assertions.assertEquals(val2, root.getMember2());
}
@Test
@Order(2)
@DisplayName("[MEM Model2Object] Entity with byte/Byte setters is created from String values")
public void test02() {
String val1 = "26";
String val2 = "27";
mainData().put("member1", new AnyData(new SimpleData(val1)));
mainData().put("member2", new AnyData(new SimpleData(val2)));
ByteRoot root =
Assertions.assertDoesNotThrow(() -> external().convert(ByteRoot.class));
Assertions.assertNotNull(root);
Assertions.assertEquals((byte) 26, root.getMember1());
Assertions.assertEquals(Byte.valueOf((byte) 27), root.getMember2());
}
@Test
@Order(3)
@DisplayName("[MEM Model2Object] Entity with byte/Byte setters is not created from " +
"non-numeric String values")
public void test03() {
String val1 = "bad byte 1";
String val2 = "bad byte 2";
mainData().put("member1", new AnyData(new SimpleData(val1)));
mainData().put("member2", new AnyData(new SimpleData(val2)));
ByteRoot root =
Assertions.assertDoesNotThrow(() -> external().convert(ByteRoot.class));
Assertions.assertNotNull(root);
Assertions.assertEquals(0, root.getMember1());
Assertions.assertNull(root.getMember2());
}
}
@@ -12,16 +12,16 @@
* limitations under the License.
*/
package daxi.moe.test.scenario.alfa.scn04;
package daxi.moe.test.mem.mod2obj.setter.simple.byteval;
import daxi.moe.app.MapFrom;
public class ByteEntity {
public class ByteRoot {
private byte member1;
private Byte member2;
public ByteEntity() {
public ByteRoot() {
//NOOP
}
@@ -34,12 +34,12 @@ public class ByteEntity {
}
@MapFrom("member1")
private void _setMe1(byte value) {
private void _setMember1(byte value) {
member1 = value;
}
@MapFrom("member2")
private void _setMe2(Byte value) {
private void _setMember2(Byte value) {
member2 = value;
}
}
@@ -0,0 +1,92 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.mod2obj.setter.simple.doubleval;
import daxi.moe.model.AnyData;
import daxi.moe.model.SimpleData;
import daxi.moe.test.mem.mod2obj.MemMod2ObjTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import java.util.Random;
import java.util.logging.Logger;
/**
* @author indroneel
*/
@DisplayName("[MEM Model2Object] Simple double setters")
public class AllTests extends MemMod2ObjTests {
private static final Logger L = Logger.getLogger(AllTests.class.getName());
@Test
@Order(1)
@DisplayName("[MEM Model2Object] Entity with double/Double setters is created")
public void test01() {
Random random = new Random();
double val1 = random.nextDouble();
Double val2 = random.nextDouble();
mainData().put("member1", new AnyData(new SimpleData(val1)));
mainData().put("member2", new AnyData(new SimpleData(val2)));
DoubleRoot root =
Assertions.assertDoesNotThrow(() -> external().convert(DoubleRoot.class));
Assertions.assertNotNull(root);
Assertions.assertEquals(val1, root.getMember1());
Assertions.assertEquals(val2, root.getMember2());
}
@Test
@Order(2)
@DisplayName("[MEM Model2Object] Entity with double/Double setters is created from string " +
"values")
public void test02() {
Random random = new Random();
double d1 = random.nextDouble();
double d2 = random.nextDouble();
String val1 = String.valueOf(d1);
String val2 = String.valueOf(d2);
mainData().put("member1", new AnyData(new SimpleData(val1)));
mainData().put("member2", new AnyData(new SimpleData(val2)));
DoubleRoot root =
Assertions.assertDoesNotThrow(() -> external().convert(DoubleRoot.class));
Assertions.assertNotNull(root);
Assertions.assertEquals(d1, root.getMember1());
Assertions.assertEquals(d2, root.getMember2());
}
@Test
@Order(3)
@DisplayName("[MEM Model2Object] Entity with double/Double setters is not created from " +
"non-numeric String values")
public void test03() {
String val1 = "bad double 1";
String val2 = "bad double 2";
mainData().put("member1", new AnyData(new SimpleData(val1)));
mainData().put("member2", new AnyData(new SimpleData(val2)));
DoubleRoot root =
Assertions.assertDoesNotThrow(() -> external().convert(DoubleRoot.class));
Assertions.assertNotNull(root);
Assertions.assertEquals(0, root.getMember1());
Assertions.assertNull(root.getMember2());
}
}
@@ -12,16 +12,16 @@
* limitations under the License.
*/
package daxi.moe.test.scenario.alfa.scn09;
package daxi.moe.test.mem.mod2obj.setter.simple.doubleval;
import daxi.moe.app.MapFrom;
public class DoubleEntity {
public class DoubleRoot {
private double member1;
private Double member2;
public DoubleEntity() {
public DoubleRoot() {
//NOOP
}
@@ -0,0 +1,91 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.mod2obj.setter.simple.floatval;
import daxi.moe.model.AnyData;
import daxi.moe.model.SimpleData;
import daxi.moe.test.mem.mod2obj.MemMod2ObjTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import java.util.Random;
import java.util.logging.Logger;
/**
* @author indroneel
*/
@DisplayName("[MEM Model2Object] Simple float setters")
public class AllTests extends MemMod2ObjTests {
private static final Logger L = Logger.getLogger(AllTests.class.getName());
@Test
@Order(1)
@DisplayName("[MEM Model2Object] Entity with float/Float setters is created")
public void test01() {
Random random = new Random();
float val1 = random.nextFloat();
Float val2 = random.nextFloat();
mainData().put("member1", new AnyData(new SimpleData(val1)));
mainData().put("member2", new AnyData(new SimpleData(val2)));
FloatRoot root =
Assertions.assertDoesNotThrow(() -> external().convert(FloatRoot.class));
Assertions.assertNotNull(root);
Assertions.assertEquals(val1, root.getMember1());
Assertions.assertEquals(val2, root.getMember2());
}
@Test
@Order(2)
@DisplayName("[MEM Model2Object] Entity with float/Float setters is created from string values")
public void test02() {
Random random = new Random();
float f1 = random.nextFloat();
float f2 = random.nextFloat();
String val1 = String.valueOf(f1);
String val2 = String.valueOf(f2);
mainData().put("member1", new AnyData(new SimpleData(val1)));
mainData().put("member2", new AnyData(new SimpleData(val2)));
FloatRoot root =
Assertions.assertDoesNotThrow(() -> external().convert(FloatRoot.class));
Assertions.assertNotNull(root);
Assertions.assertEquals(f1, root.getMember1());
Assertions.assertEquals(f2, root.getMember2());
}
@Test
@Order(3)
@DisplayName("[MEM Model2Object] Entity with float/Float setters is not created from " +
"non-numeric String values")
public void test03() {
String val1 = "bad float 1";
String val2 = "bad float 2";
mainData().put("member1", new AnyData(new SimpleData(val1)));
mainData().put("member2", new AnyData(new SimpleData(val2)));
FloatRoot root =
Assertions.assertDoesNotThrow(() -> external().convert(FloatRoot.class));
Assertions.assertNotNull(root);
Assertions.assertEquals(0, root.getMember1());
Assertions.assertNull(root.getMember2());
}
}
@@ -12,16 +12,16 @@
* limitations under the License.
*/
package daxi.moe.test.scenario.alfa.scn07;
package daxi.moe.test.mem.mod2obj.setter.simple.floatval;
import daxi.moe.app.MapFrom;
public class FloatEntity {
public class FloatRoot {
private float member1;
private Float member2;
public FloatEntity() {
public FloatRoot() {
//NOOP
}
@@ -0,0 +1,92 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.mod2obj.setter.simple.intval;
import daxi.moe.model.AnyData;
import daxi.moe.model.SimpleData;
import daxi.moe.test.mem.mod2obj.MemMod2ObjTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import java.util.Random;
import java.util.logging.Logger;
/**
* @author indroneel
*/
@DisplayName("[MEM Model2Object] Simple integer setters")
public class AllTests extends MemMod2ObjTests {
private static final Logger L = Logger.getLogger(AllTests.class.getName());
@Test
@Order(1)
@DisplayName("[MEM Model2Object] Entity with int/Integer setters is created")
public void test01() {
Random random = new Random();
int val1 = random.nextInt();
Integer val2 = random.nextInt();
mainData().put("member1", new AnyData(new SimpleData(val1)));
mainData().put("member2", new AnyData(new SimpleData(val2)));
IntegerRoot root =
Assertions.assertDoesNotThrow(() -> external().convert(IntegerRoot.class));
Assertions.assertNotNull(root);
Assertions.assertEquals(val1, root.getMember1());
Assertions.assertEquals(val2, root.getMember2());
}
@Test
@Order(2)
@DisplayName("[MEM Model2Object] Entity with int/Integer setters is created from string values")
public void test02() {
Random random = new Random();
int i1 = random.nextInt();
int i2 = random.nextInt();
String val1 = String.valueOf(i1);
String val2 = String.valueOf(i2);
mainData().put("member1", new AnyData(new SimpleData(val1)));
mainData().put("member2", new AnyData(new SimpleData(val2)));
IntegerRoot root =
Assertions.assertDoesNotThrow(() -> external().convert(IntegerRoot.class));
Assertions.assertNotNull(root);
Assertions.assertEquals(i1, root.getMember1());
Assertions.assertEquals(i2, root.getMember2());
}
@Test
@Order(3)
@DisplayName("[MEM Model2Object] Entity with int/Integer setters is not created from " +
"non-numeric String values")
public void test03() {
String val1 = "bad int 1";
String val2 = "bad int 2";
mainData().put("member1", new AnyData(new SimpleData(val1)));
mainData().put("member2", new AnyData(new SimpleData(val2)));
IntegerRoot root =
Assertions.assertDoesNotThrow(() -> external().convert(IntegerRoot.class));
Assertions.assertNotNull(root);
Assertions.assertEquals(0, root.getMember1());
Assertions.assertNull(root.getMember2());
}
}
@@ -12,16 +12,16 @@
* limitations under the License.
*/
package daxi.moe.test.scenario.alfa.scn06;
package daxi.moe.test.mem.mod2obj.setter.simple.intval;
import daxi.moe.app.MapFrom;
public class IntegerEntity {
public class IntegerRoot {
private int member1;
private Integer member2;
public IntegerEntity() {
public IntegerRoot() {
//NOOP
}
@@ -0,0 +1,91 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.mod2obj.setter.simple.longval;
import daxi.moe.model.AnyData;
import daxi.moe.model.SimpleData;
import daxi.moe.test.mem.mod2obj.MemMod2ObjTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import java.util.Random;
import java.util.logging.Logger;
/**
* @author indroneel
*/
@DisplayName("[MEM Model2Object] Simple long setters")
public class AllTests extends MemMod2ObjTests {
private static final Logger L = Logger.getLogger(AllTests.class.getName());
@Test
@Order(1)
@DisplayName("[MEM Model2Object] Entity with long/Long setters is created")
public void test01() {
Random random = new Random();
long val1 = random.nextLong();
Long val2 = random.nextLong();
mainData().put("member1", new AnyData(new SimpleData(val1)));
mainData().put("member2", new AnyData(new SimpleData(val2)));
LongRoot root =
Assertions.assertDoesNotThrow(() -> external().convert(LongRoot.class));
Assertions.assertNotNull(root);
Assertions.assertEquals(val1, root.getMember1());
Assertions.assertEquals(val2, root.getMember2());
}
@Test
@Order(2)
@DisplayName("[MEM Model2Object] Entity with long/Long setters is created from string values")
public void test02() {
Random random = new Random();
long l1 = random.nextLong();
long l2 = random.nextLong();
String val1 = String.valueOf(l1);
String val2 = String.valueOf(l2);
mainData().put("member1", new AnyData(new SimpleData(val1)));
mainData().put("member2", new AnyData(new SimpleData(val2)));
LongRoot root =
Assertions.assertDoesNotThrow(() -> external().convert(LongRoot.class));
Assertions.assertNotNull(root);
Assertions.assertEquals(l1, root.getMember1());
Assertions.assertEquals(l2, root.getMember2());
}
@Test
@Order(3)
@DisplayName("[MEM Model2Object] Entity with long/Long setters is not created from " +
"non-numeric String values")
public void test03() {
String val1 = "bad long 1";
String val2 = "bad long 2";
mainData().put("member1", new AnyData(new SimpleData(val1)));
mainData().put("member2", new AnyData(new SimpleData(val2)));
LongRoot root =
Assertions.assertDoesNotThrow(() -> external().convert(LongRoot.class));
Assertions.assertNotNull(root);
Assertions.assertEquals(0, root.getMember1());
Assertions.assertNull(root.getMember2());
}
}
@@ -12,16 +12,16 @@
* limitations under the License.
*/
package daxi.moe.test.scenario.alfa.scn08;
package daxi.moe.test.mem.mod2obj.setter.simple.longval;
import daxi.moe.app.MapFrom;
public class LongEntity {
public class LongRoot {
private long member1;
private Long member2;
public LongEntity() {
public LongRoot() {
//NOOP
}
@@ -0,0 +1,86 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.mod2obj.setter.simple.shortval;
import daxi.moe.model.AnyData;
import daxi.moe.model.SimpleData;
import daxi.moe.test.mem.mod2obj.MemMod2ObjTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import java.util.logging.Logger;
/**
* @author indroneel
*/
@DisplayName("[MEM Model2Object] Simple short setters")
public class AllTests extends MemMod2ObjTests {
private static final Logger L = Logger.getLogger(AllTests.class.getName());
@Test
@Order(1)
@DisplayName("[MEM Model2Object] Entity with short/Short setters is created")
public void test01() {
short val1 = 16343;
short val2 = 2048;
mainData().put("member1", new AnyData(new SimpleData(val1)));
mainData().put("member2", new AnyData(new SimpleData(val2)));
ShortRoot root =
Assertions.assertDoesNotThrow(() -> external().convert(ShortRoot.class));
Assertions.assertNotNull(root);
Assertions.assertEquals(val1, root.getMember1());
Assertions.assertEquals(val2, root.getMember2());
}
@Test
@Order(2)
@DisplayName("[MEM Model2Object] Entity with short/Short setters is created from String values")
public void test02() {
String val1 = "16343";
String val2 = "2048";
mainData().put("member1", new AnyData(new SimpleData(val1)));
mainData().put("member2", new AnyData(new SimpleData(val2)));
ShortRoot root =
Assertions.assertDoesNotThrow(() -> external().convert(ShortRoot.class));
Assertions.assertNotNull(root);
Assertions.assertEquals((short) 16343, root.getMember1());
Assertions.assertEquals(Short.valueOf((short)2048), root.getMember2());
}
@Test
@Order(3)
@DisplayName("[MEM Model2Object] Entity with short/Short setters is not created from " +
"non-numeric String values")
public void test03() {
String val1 = "bad short 1";
String val2 = "bad short 2";
mainData().put("member1", new AnyData(new SimpleData(val1)));
mainData().put("member2", new AnyData(new SimpleData(val2)));
ShortRoot root =
Assertions.assertDoesNotThrow(() -> external().convert(ShortRoot.class));
Assertions.assertNotNull(root);
Assertions.assertEquals(0, root.getMember1());
Assertions.assertNull(root.getMember2());
}
}
@@ -12,16 +12,16 @@
* limitations under the License.
*/
package daxi.moe.test.scenario.alfa.scn05;
package daxi.moe.test.mem.mod2obj.setter.simple.shortval;
import daxi.moe.app.MapFrom;
public class ShortEntity {
public class ShortRoot {
private short member1;
private Short member2;
public ShortEntity() {
public ShortRoot() {
//NOOP
}
@@ -0,0 +1,48 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.mod2obj.setter.simple.strval;
import daxi.moe.model.AnyData;
import daxi.moe.model.SimpleData;
import daxi.moe.test.mem.mod2obj.MemMod2ObjTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import java.util.logging.Logger;
/**
* @author indroneel
*/
@DisplayName("[MEM Model2Object] Simple string setters")
public class AllTests extends MemMod2ObjTests {
private static final Logger L = Logger.getLogger(AllTests.class.getName());
@Test
@Order(1)
@DisplayName("[MEM Model2Object] Entity with string setters is created")
public void test01() {
mainData().put("member", new AnyData(new SimpleData("string-value-01")));
StringRoot entity =
Assertions.assertDoesNotThrow(() -> external().convert(StringRoot.class));
Assertions.assertNotNull(entity);
Assertions.assertEquals("string-value-01", entity.getMember());
}
}
@@ -0,0 +1,35 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.mod2obj.setter.simple.strval;
import daxi.moe.app.MapFrom;
public class StringRoot {
private String member;
public StringRoot() {
//NOOP
}
public String getMember() {
return member;
}
@MapFrom("member")
private void _someMethod(String value) {
member = value;
}
}
@@ -0,0 +1,53 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.obj2mod;
import daxi.moe.app.Internal;
import daxi.moe.app.Moe;
import daxi.moe.model.AnyData;
import daxi.moe.test.setup.AbstractTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import java.util.logging.Logger;
/**
* @author indroneel
*/
@Tag("mem-obj2mod")
public class MemObj2ModTests extends AbstractTests {
private static Logger L = Logger.getLogger(MemObj2ModTests.class.getName());
private Internal intern;
@BeforeEach
public final void beforeEach() {
L.info("beforeEach - resetting the test environment");
Moe moe = Moe.create();
intern = moe.internal("mem");
Assertions.assertNotNull(intern);
}
protected final void retrieve(Object srcObj) throws Exception {
intern.from(srcObj);
}
protected final AnyData getModel() {
return intern.getModel();
}
}
@@ -0,0 +1,104 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.obj2mod.linear.numitem;
import daxi.moe.model.AnyData;
import daxi.moe.model.LinearData;
import daxi.moe.test.mem.obj2mod.MemObj2ModTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import java.util.Set;
import java.util.logging.Logger;
/**
* @author indroneel
*/
@DisplayName("[Object2Model] Linear data retrieval tests")
public class AllTests extends MemObj2ModTests {
private static final Logger L = Logger.getLogger(AllTests.class.getName());
@Test
@Order(1)
@DisplayName("[Object2Model] Array of integers is retrieved correctly")
public void test01() {
IntArrayRoot srcObj = new IntArrayRoot();
Assertions.assertDoesNotThrow(() -> retrieve(srcObj));
AnyData data = getModel();
Assertions.assertNotNull(data);
AnyData alData = data.asMapped().get("values");
Assertions.assertNotNull(alData);
LinearData ldata = alData.asLinear();
Assertions.assertNotNull(ldata);
Assertions.assertEquals(3, ldata.size());
Assertions.assertEquals(100, ldata.get(0).asSimple().getNumber().intValue());
Assertions.assertEquals(101, ldata.get(1).asSimple().getNumber().intValue());
Assertions.assertEquals(102, ldata.get(2).asSimple().getNumber().intValue());
}
@Test
@Order(2)
@DisplayName("[Object2Model] List of integers is retrieved correctly")
public void test02() {
IntListRoot srcObj = new IntListRoot();
Assertions.assertDoesNotThrow(() -> retrieve(srcObj));
AnyData data = getModel();
Assertions.assertNotNull(data);
AnyData alData = data.asMapped().get("values");
Assertions.assertNotNull(alData);
LinearData ldata = alData.asLinear();
Assertions.assertNotNull(ldata);
Assertions.assertEquals(3, ldata.size());
Assertions.assertEquals(100, ldata.get(0).asSimple().getNumber().intValue());
Assertions.assertEquals(101, ldata.get(1).asSimple().getNumber().intValue());
Assertions.assertEquals(102, ldata.get(2).asSimple().getNumber().intValue());
}
@Test
@Order(3)
@DisplayName("[Object2Model] Set of integers is retrieved correctly")
public void test03() {
IntSetRoot srcObj = new IntSetRoot();
Assertions.assertDoesNotThrow(() -> retrieve(srcObj));
AnyData data = getModel();
Assertions.assertNotNull(data);
AnyData alData = data.asMapped().get("values");
Assertions.assertNotNull(alData);
LinearData ldata = alData.asLinear();
Assertions.assertNotNull(ldata);
Assertions.assertEquals(3, ldata.size());
Set<Integer> expectedValues = Set.of(100, 101, 102);
for (int i = 0; i < 3; i++) {
Assertions.assertTrue(expectedValues.contains(
ldata.get(i).asSimple().getNumber().intValue()));
}
}
}
@@ -0,0 +1,35 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.obj2mod.linear.numitem;
import daxi.moe.app.MapTo;
/**
* @author indroneel
*/
public class IntArrayRoot {
private final int[] values;
public IntArrayRoot() {
values = new int[]{100, 101, 102};
}
@MapTo("values")
private int[] _values() {
return values;
}
}
@@ -0,0 +1,37 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.obj2mod.linear.numitem;
import daxi.moe.app.MapTo;
import java.util.List;
/**
* @author indroneel
*/
public class IntListRoot {
private final List<Integer> values;
public IntListRoot() {
values = List.of(100, 101, 102);
}
@MapTo("values")
private List<Integer> _values() {
return values;
}
}
@@ -0,0 +1,37 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.obj2mod.linear.numitem;
import daxi.moe.app.MapTo;
import java.util.Set;
/**
* @author indroneel
*/
public class IntSetRoot {
private final Set<Integer> values;
public IntSetRoot() {
values = Set.of(100, 101, 102);
}
@MapTo("values")
private Set<Integer> _values() {
return values;
}
}
@@ -0,0 +1,103 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.obj2mod.linear.stritem;
import daxi.moe.model.AnyData;
import daxi.moe.model.LinearData;
import daxi.moe.test.mem.obj2mod.MemObj2ModTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import java.util.Set;
import java.util.logging.Logger;
/**
* @author indroneel
*/
@DisplayName("[Object2Model] Linear data retrieval tests")
public class AllTests extends MemObj2ModTests {
private static final Logger L = Logger.getLogger(AllTests.class.getName());
@Test
@Order(1)
@DisplayName("[Object2Model] Array of strings is retrieved correctly")
public void test01() {
StringArrayRoot srcObj = new StringArrayRoot();
Assertions.assertDoesNotThrow(() -> retrieve(srcObj));
AnyData data = getModel();
Assertions.assertNotNull(data);
AnyData alData = data.asMapped().get("values");
Assertions.assertNotNull(alData);
LinearData ldata = alData.asLinear();
Assertions.assertNotNull(ldata);
Assertions.assertEquals(3, ldata.size());
Assertions.assertEquals("value1", ldata.get(0).asSimple().getString());
Assertions.assertEquals("value2", ldata.get(1).asSimple().getString());
Assertions.assertEquals("value3", ldata.get(2).asSimple().getString());
}
@Test
@Order(2)
@DisplayName("[Object2Model] List of strings is retrieved correctly")
public void test02() {
StringListRoot srcObj = new StringListRoot();
Assertions.assertDoesNotThrow(() -> retrieve(srcObj));
AnyData data = getModel();
Assertions.assertNotNull(data);
AnyData alData = data.asMapped().get("values");
Assertions.assertNotNull(alData);
LinearData ldata = alData.asLinear();
Assertions.assertNotNull(ldata);
Assertions.assertEquals(3, ldata.size());
Assertions.assertEquals("value1", ldata.get(0).asSimple().getString());
Assertions.assertEquals("value2", ldata.get(1).asSimple().getString());
Assertions.assertEquals("value3", ldata.get(2).asSimple().getString());
}
@Test
@Order(3)
@DisplayName("[Object2Model] Set of strings is retrieved correctly")
public void test03() {
StringSetRoot srcObj = new StringSetRoot();
Assertions.assertDoesNotThrow(() -> retrieve(srcObj));
AnyData data = getModel();
Assertions.assertNotNull(data);
AnyData alData = data.asMapped().get("values");
Assertions.assertNotNull(alData);
LinearData ldata = alData.asLinear();
Assertions.assertNotNull(ldata);
Assertions.assertEquals(3, ldata.size());
Set<String> expectedValues = Set.of("value1", "value2", "value3");
for (int i = 0; i < 3; i++) {
Assertions.assertTrue(expectedValues.contains(ldata.get(i).asSimple().getString()));
}
}
}
@@ -0,0 +1,35 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.obj2mod.linear.stritem;
import daxi.moe.app.MapTo;
/**
* @author indroneel
*/
public class StringArrayRoot {
private final String[] values;
public StringArrayRoot() {
values = new String[]{"value1", "value2", "value3"};
}
@MapTo("values")
private String[] _values() {
return values;
}
}
@@ -0,0 +1,37 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.obj2mod.linear.stritem;
import daxi.moe.app.MapTo;
import java.util.List;
/**
* @author indroneel
*/
public class StringListRoot {
private final List<String> values;
public StringListRoot() {
values = List.of("value1", "value2", "value3");
}
@MapTo("values")
private List<String> _values() {
return values;
}
}
@@ -0,0 +1,37 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.obj2mod.linear.stritem;
import daxi.moe.app.MapTo;
import java.util.Set;
/**
* @author indroneel
*/
public class StringSetRoot {
private final Set<String> values;
public StringSetRoot() {
values = Set.of("value1", "value2", "value3");
}
@MapTo("values")
private Set<String> _values() {
return values;
}
}
@@ -0,0 +1,110 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.obj2mod.semantics;
import daxi.moe.app.ConvertException;
import daxi.moe.model.AnyData;
import daxi.moe.model.MappedData;
import daxi.moe.model.SimpleData;
import daxi.moe.test.mem.obj2mod.MemObj2ModTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import java.util.List;
import java.util.logging.Logger;
/**
* @author indroneel
*/
@DisplayName("[Object2Model] Basic Semantics Tests")
public class AllTests extends MemObj2ModTests {
private static final Logger L = Logger.getLogger(AllTests.class.getName());
@Test
@Order(1)
@DisplayName("[Object2Model] Methods without MapTo annotations are not used for retrieval")
public void test01() {
BlankObject01 srcObj = new BlankObject01("str-val-01", "str-val-02");
Assertions.assertDoesNotThrow(() -> retrieve(srcObj));
AnyData data = getModel();
Assertions.assertNull(data);
}
@Test
@Order(2)
@DisplayName("[Object2Model] Public methods with MapTo annotations are not used for retrieval")
public void test02() {
BlankObject02 srcObj = new BlankObject02("str-val-01", "str-val-02");
Assertions.assertDoesNotThrow(() -> retrieve(srcObj));
AnyData data = getModel();
Assertions.assertNull(data);
}
@Test
@Order(3)
@DisplayName("[Object2Model] Methods with MapTo annotations that have non-zero parameters " +
"are not used for retrieval")
public void test03() {
BlankObject03 srcObj = new BlankObject03("str-val-01");
Assertions.assertDoesNotThrow(() -> retrieve(srcObj));
AnyData data = getModel();
Assertions.assertNull(data);
}
@Test
@Order(4)
@DisplayName("[Object2Model] Methods with blank MapTo annotations are not used for retrieval")
public void test04() {
BlankObject04 srcObj = new BlankObject04("str-val-01");
Assertions.assertDoesNotThrow(() -> retrieve(srcObj));
AnyData data = getModel();
Assertions.assertNull(data);
}
@Test
@Order(5)
@DisplayName("[Object2Model] Methods with duplicate keys in MapTo annotations is an error")
public void test05() {
BadObject01 srcObj = new BadObject01("str-val-01", 42);
ConvertException exep
= Assertions.assertThrows(ConvertException.class, () -> retrieve(srcObj));
Assertions.assertEquals(BadObject01.class.getName(), exep.getType());
}
@Test
@Order(6)
@DisplayName("[Object2Model] Methods with correct semantics are used for retrieval")
public void test06() {
GoodObject srcObj = new GoodObject("str-val-01");
Assertions.assertDoesNotThrow(() -> retrieve(srcObj));
AnyData data = getModel();
Assertions.assertNotNull(data);
MappedData mdata = data.asMapped();
Assertions.assertNotNull(mdata);
List<String> keys = mdata.getKeys();
Assertions.assertFalse(keys.isEmpty());
AnyData pdata = mdata.get("member1");
Assertions.assertNotNull(pdata);
SimpleData sd = pdata.asSimple();
Assertions.assertNotNull(sd);
String value = sd.getString();
Assertions.assertEquals("str-val-01", value);
}
}
@@ -0,0 +1,42 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.obj2mod.semantics;
import daxi.moe.app.MapTo;
/**
* @author indroneel
*/
public class BadObject01 {
private final String member1;
private final int member2;
public BadObject01(String m1, int m2) {
member1 = m1;
member2 = m2;
}
@MapTo("member")
private String _getMember1() {
return member1;
}
@MapTo("member")
private int _getMember2() {
return member2;
}
}
@@ -12,16 +12,20 @@
* limitations under the License.
*/
package daxi.moe.test.scenario.alfa.scn01;
package daxi.moe.test.mem.obj2mod.semantics;
/**
* @author indroneel
*/
public class InvalidEntity01 {
public class BlankObject01 {
private String member1;
private String member2;
private final String member1;
private final String member2;
public InvalidEntity01() {
//NOOP
public BlankObject01(String m1, String m2) {
member1 = m1;
member2 = m2;
}
public String getMember1() {
@@ -0,0 +1,42 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.obj2mod.semantics;
import daxi.moe.app.MapTo;
/**
* @author indroneel
*/
public class BlankObject02 {
private final String member1;
private final String member2;
public BlankObject02(String m1, String m2) {
member1 = m1;
member2 = m2;
}
@MapTo("member1")
public String _getMember1() {
return member1;
}
@MapTo("member2")
public String _getMember2() {
return member2;
}
}
@@ -0,0 +1,35 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.obj2mod.semantics;
import daxi.moe.app.MapTo;
/**
* @author indroneel
*/
public class BlankObject03 {
private final String member1;
public BlankObject03(String m1) {
member1 = m1;
}
@MapTo("member1")
private String _getMember1(String value) {
return member1;
}
}
@@ -0,0 +1,35 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.obj2mod.semantics;
import daxi.moe.app.MapTo;
/**
* @author indroneel
*/
public class BlankObject04 {
private final String member1;
public BlankObject04(String m1) {
member1 = m1;
}
@MapTo
private String _getMember1() {
return member1;
}
}
@@ -0,0 +1,35 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.obj2mod.semantics;
import daxi.moe.app.MapTo;
/**
* @author indroneel
*/
public class GoodObject {
private final String member1;
public GoodObject(String m1) {
member1 = m1;
}
@MapTo("member1")
private String _getMember1() {
return member1;
}
}
@@ -0,0 +1,157 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.obj2mod.simple;
import daxi.moe.model.AnyData;
import daxi.moe.model.MappedData;
import daxi.moe.model.SimpleData;
import daxi.moe.test.mem.obj2mod.MemObj2ModTests;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.List;
import java.util.logging.Logger;
/**
* @author indroneel
*/
@DisplayName("[Object2Model] Simple Retrieval Tests")
public class AllTests extends MemObj2ModTests {
private static final Logger L = Logger.getLogger(AllTests.class.getName());
@Test
@Order(1)
@DisplayName("[Object2Model] Method to retrieve boolean values")
public void test01() {
BooleanRoot srcObj = new BooleanRoot(true);
Assertions.assertDoesNotThrow(() -> retrieve(srcObj));
MappedData mdata = getRoot();
AnyData pdata1 = mdata.get("member1");
Assertions.assertNotNull(pdata1);
SimpleData sd1 = pdata1.asSimple();
Assertions.assertNotNull(sd1);
Boolean value1 = sd1.getBoolean();
Assertions.assertEquals(true, value1);
AnyData pdata2 = mdata.get("member2");
Assertions.assertNotNull(pdata2);
SimpleData sd2 = pdata2.asSimple();
Assertions.assertNotNull(sd2);
Boolean value2 = sd2.getBoolean();
Assertions.assertEquals(true, value2);
}
@Test
@Order(2)
@DisplayName("[Object2Model] Method to retrieve integer values")
public void test02() {
IntegerRoot srcObj = new IntegerRoot(42);
Assertions.assertDoesNotThrow(() -> retrieve(srcObj));
MappedData mdata = getRoot();
assertNumber(mdata, "member1", 42);
assertNumber(mdata, "member2", 42);
}
@Test
@Order(3)
@DisplayName("[Object2Model] Method to retrieve long values")
public void test03() {
LongRoot srcObj = new LongRoot(9876543210L);
Assertions.assertDoesNotThrow(() -> retrieve(srcObj));
MappedData mdata = getRoot();
assertNumber(mdata, "member1", 9876543210L);
assertNumber(mdata, "member2", 9876543210L);
}
@Test
@Order(4)
@DisplayName("[Object2Model] Method to retrieve float values")
public void test04() {
FloatRoot srcObj = new FloatRoot(12.5F);
Assertions.assertDoesNotThrow(() -> retrieve(srcObj));
MappedData mdata = getRoot();
assertNumber(mdata, "member1", 12.5F);
assertNumber(mdata, "member2", 12.5F);
}
@Test
@Order(5)
@DisplayName("[Object2Model] Method to retrieve double values")
public void test05() {
DoubleRoot srcObj = new DoubleRoot(123.456789012345);
Assertions.assertDoesNotThrow(() -> retrieve(srcObj));
MappedData mdata = getRoot();
assertNumber(mdata, "member1", 123.456789012345);
assertNumber(mdata, "member2", 123.456789012345);
}
@Test
@Order(6)
@DisplayName("[Object2Model] Method to retrieve BigInteger values")
public void test06() {
BigInteger value = new BigInteger("123456789012345678901234567890");
BigIntegerRoot srcObj = new BigIntegerRoot(value);
Assertions.assertDoesNotThrow(() -> retrieve(srcObj));
MappedData mdata = getRoot();
assertNumber(mdata, "member", value);
}
@Test
@Order(7)
@DisplayName("[Object2Model] Method to retrieve BigDecimal values")
public void test07() {
BigDecimal value = new BigDecimal("12345678901234567890.123456789");
BigDecimalRoot srcObj = new BigDecimalRoot(value);
Assertions.assertDoesNotThrow(() -> retrieve(srcObj));
MappedData mdata = getRoot();
assertNumber(mdata, "member", value);
}
////////////////////////////////////////////////////////////////////////////////////////////////
// Helper methods
private MappedData getRoot() {
AnyData data = getModel();
Assertions.assertNotNull(data);
MappedData mdata = data.asMapped();
Assertions.assertNotNull(mdata);
return mdata;
}
private void assertNumber(MappedData mdata, String member, Number expected) {
AnyData data = mdata.get(member);
Assertions.assertNotNull(data);
SimpleData simpleData = data.asSimple();
Assertions.assertNotNull(simpleData);
Assertions.assertEquals(expected, simpleData.getNumber());
}
}
@@ -0,0 +1,36 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the full text of the License.
*/
package daxi.moe.test.mem.obj2mod.simple;
import daxi.moe.app.MapTo;
import java.math.BigDecimal;
/**
* @author indroneel
*/
public class BigDecimalRoot {
private final BigDecimal member;
public BigDecimalRoot(BigDecimal value) {
member = value;
}
@MapTo("member")
private BigDecimal _getMember() {
return member;
}
}
@@ -0,0 +1,32 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the full text of the License.
*/
package daxi.moe.test.mem.obj2mod.simple;
import daxi.moe.app.MapTo;
import java.math.BigInteger;
public class BigIntegerRoot {
private final BigInteger member;
public BigIntegerRoot(BigInteger value) {
member = value;
}
@MapTo("member")
private BigInteger _getMember() {
return member;
}
}
@@ -0,0 +1,40 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.test.mem.obj2mod.simple;
import daxi.moe.app.MapTo;
/**
* @author indroneel
*/
public class BooleanRoot {
private final boolean member;
public BooleanRoot(boolean flag) {
member = flag;
}
@MapTo("member1")
private boolean _getMember1() {
return member;
}
@MapTo("member2")
private Boolean _getMember2() {
return member;
}
}

Some files were not shown because too many files have changed in this diff Show More