Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f2e224305a | ||
|
|
5a8e16eca1 | ||
|
|
44bb47481e |
+9
-7
@@ -28,18 +28,23 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "daxi.moe:daxi.moe.main:v1-SNAPSHOT"
|
||||
implementation "dxt.moe:dxt.moe.api:v1-SNAPSHOT"
|
||||
implementation "dxt.moe:dxt.moe.main:v1-SNAPSHOT"
|
||||
implementation "dxt.moe:dxt.moe.json:v1-SNAPSHOT"
|
||||
|
||||
implementation "org.junit.jupiter:junit-jupiter:5.10.2"
|
||||
implementation "org.junit.platform:junit-platform-launcher:1.10.2"
|
||||
|
||||
implementation "org.slf4j:jul-to-slf4j:2.0.7"
|
||||
implementation "ch.qos.logback:logback-classic:1.4.6"
|
||||
implementation 'ch.qos.logback:logback-classic:1.6.3'
|
||||
implementation "org.codehaus.janino:janino:3.1.9"
|
||||
}
|
||||
|
||||
tasks.named("test", Test) {
|
||||
useJUnitPlatform()
|
||||
useJUnitPlatform() {
|
||||
//includeTags "json-mod2obj", "mem-mod2obj"
|
||||
//includeTags "json-mod2obj"
|
||||
}
|
||||
systemProperty "junit.jupiter.extensions.autodetection.enabled", "true"
|
||||
|
||||
/*
|
||||
@@ -66,9 +71,6 @@ jacocoTestReport {
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
def classDir = file("${projectDir}/../scanpath-v1/target/classes")
|
||||
def sourceDir = file("${projectDir}/../scanpath-v1/src/main/java")
|
||||
|
||||
def mainSrcDir = file("${projectDir}/../moe/moe-main/src/main/java")
|
||||
def jsonSrcDir = file("${projectDir}/../moe/moe-json/src/main/java")
|
||||
def yamlSrcDir = file("${projectDir}/../moe/moe-yaml/src/main/java")
|
||||
@@ -79,7 +81,7 @@ jacocoTestReport {
|
||||
def yamlClsDir = file("${projectDir}/../moe/moe-yaml/target/classes")
|
||||
def tomlClsDir = file("${projectDir}/../moe/moe-toml/target/classes")
|
||||
|
||||
sourceDirectories.setFrom(files(sourceDir, mainSrcDir, jsonSrcDir, yamlSrcDir, tomlSrcDir))
|
||||
sourceDirectories.setFrom(files(mainSrcDir, jsonSrcDir, yamlSrcDir, tomlSrcDir))
|
||||
classDirectories.setFrom(files(
|
||||
fileTree(dir: mainClsDir),
|
||||
fileTree(dir: jsonClsDir),
|
||||
|
||||
@@ -1,99 +0,0 @@
|
||||
/*
|
||||
* 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.scenario.alfa.scn01;
|
||||
|
||||
import daxi.moe.app.External;
|
||||
import daxi.moe.app.Internal;
|
||||
import daxi.moe.app.Moe;
|
||||
import daxi.moe.model.AnyData;
|
||||
import daxi.moe.model.MappedData;
|
||||
import daxi.moe.model.SimpleData;
|
||||
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.Test;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* @author indroneel
|
||||
*/
|
||||
|
||||
@DisplayName("Memory Codec - invalid entity classes")
|
||||
@Order(1)
|
||||
public class MemInvalidEntityTests extends AbstractTests {
|
||||
|
||||
private static final Logger L = Logger.getLogger(MemInvalidEntityTests.class.getName());
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
@DisplayName("Create Moe and support for in-memory external data")
|
||||
public void test01() {
|
||||
Moe moe = Moe.create();
|
||||
External extern = moe.external("mem");
|
||||
Assertions.assertNotNull(extern);
|
||||
Internal intern = moe.internal("mem");
|
||||
Assertions.assertNotNull(intern);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(2)
|
||||
@DisplayName("Ext2Obj - Entity with no mapping annotations is not created")
|
||||
public void test02() {
|
||||
Moe moe = Moe.create();
|
||||
External extern = moe.external("mem");
|
||||
AnyData model = extern.getModel();
|
||||
MappedData mainData = model.asMapped();
|
||||
Assertions.assertNotNull(mainData);
|
||||
mainData.put("member1", new AnyData(new SimpleData("string-value-01")));
|
||||
mainData.put("member2", new AnyData(new SimpleData("string-value-02")));
|
||||
|
||||
InvalidEntity01 entity = extern.convert(InvalidEntity01.class);
|
||||
Assertions.assertNull(entity);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(3)
|
||||
@DisplayName("Ext2Obj - Entity with no default constructor is not created")
|
||||
public void test03() {
|
||||
Moe moe = Moe.create();
|
||||
External extern = moe.external("mem");
|
||||
AnyData model = extern.getModel();
|
||||
MappedData mainData = model.asMapped();
|
||||
Assertions.assertNotNull(mainData);
|
||||
mainData.put("member1", new AnyData(new SimpleData("string-value-01")));
|
||||
mainData.put("member2", new AnyData(new SimpleData("string-value-02")));
|
||||
|
||||
InvalidEntity02 entity = extern.convert(InvalidEntity02.class);
|
||||
Assertions.assertNull(entity);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(4)
|
||||
@DisplayName("Ext2Obj - Entity with no public default constructor is not created")
|
||||
public void test04() {
|
||||
Moe moe = Moe.create();
|
||||
External extern = moe.external("mem");
|
||||
AnyData model = extern.getModel();
|
||||
MappedData mainData = model.asMapped();
|
||||
Assertions.assertNotNull(mainData);
|
||||
mainData.put("member1", new AnyData(new SimpleData("string-value-01")));
|
||||
mainData.put("member2", new AnyData(new SimpleData("string-value-02")));
|
||||
|
||||
InvalidEntity03 entity = extern.convert(InvalidEntity03.class);
|
||||
Assertions.assertNull(entity);
|
||||
}
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
/*
|
||||
* 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.scenario.alfa.scn02;
|
||||
|
||||
import daxi.moe.app.External;
|
||||
import daxi.moe.app.Moe;
|
||||
import daxi.moe.model.AnyData;
|
||||
import daxi.moe.model.MappedData;
|
||||
import daxi.moe.model.SimpleData;
|
||||
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;
|
||||
|
||||
@DisplayName("Memory Codec - incorrect setter methods")
|
||||
@Order(2)
|
||||
public class MemIncorrectSetterTests {
|
||||
|
||||
private static final Logger L = Logger.getLogger(MemIncorrectSetterTests.class.getName());
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
@DisplayName("Ext2Obj - Setter method that does not start with '_set' is not populated")
|
||||
public void test01() {
|
||||
Moe moe = Moe.create();
|
||||
External extern = moe.external("mem");
|
||||
AnyData model = extern.getModel();
|
||||
MappedData mainData = model.asMapped();
|
||||
Assertions.assertNotNull(mainData);
|
||||
mainData.put("member1", new AnyData(new SimpleData("string-value-01")));
|
||||
mainData.put("member2", new AnyData(new SimpleData("string-value-02")));
|
||||
|
||||
NopopEntity01 entity = extern.convert(NopopEntity01.class);
|
||||
Assertions.assertNotNull(entity);
|
||||
|
||||
Assertions.assertNull(entity.getMember1());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(2)
|
||||
@DisplayName("Ext2Obj - Setter method '_set' is not populated")
|
||||
public void test02() {
|
||||
Moe moe = Moe.create();
|
||||
External extern = moe.external("mem");
|
||||
AnyData model = extern.getModel();
|
||||
MappedData mainData = model.asMapped();
|
||||
Assertions.assertNotNull(mainData);
|
||||
mainData.put("member1", new AnyData(new SimpleData("string-value-01")));
|
||||
mainData.put("member2", new AnyData(new SimpleData("string-value-02")));
|
||||
|
||||
NopopEntity02 entity = extern.convert(NopopEntity02.class);
|
||||
Assertions.assertNotNull(entity);
|
||||
|
||||
Assertions.assertNull(entity.getMember1());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(3)
|
||||
@DisplayName("Ext2Obj - Setter method with wrong parameter count is not populated")
|
||||
public void test03() {
|
||||
Moe moe = Moe.create();
|
||||
External extern = moe.external("mem");
|
||||
AnyData model = extern.getModel();
|
||||
MappedData mainData = model.asMapped();
|
||||
Assertions.assertNotNull(mainData);
|
||||
mainData.put("member1", new AnyData(new SimpleData("string-value-01")));
|
||||
mainData.put("member2", new AnyData(new SimpleData("string-value-02")));
|
||||
|
||||
NopopEntity03 entity = extern.convert(NopopEntity03.class);
|
||||
Assertions.assertNotNull(entity);
|
||||
|
||||
Assertions.assertNull(entity.getMember1());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(4)
|
||||
@DisplayName("Ext2Obj - Setter method with missing MapFrom key is not populated")
|
||||
public void test04() {
|
||||
Moe moe = Moe.create();
|
||||
External extern = moe.external("mem");
|
||||
AnyData model = extern.getModel();
|
||||
MappedData mainData = model.asMapped();
|
||||
Assertions.assertNotNull(mainData);
|
||||
mainData.put("member1", new AnyData(new SimpleData("string-value-01")));
|
||||
mainData.put("member3", new AnyData(new SimpleData("string-value-02")));
|
||||
|
||||
ValidEntity entity = extern.convert(ValidEntity.class);
|
||||
Assertions.assertNotNull(entity);
|
||||
|
||||
Assertions.assertEquals("string-value-01", entity.getMember1());
|
||||
Assertions.assertNull(entity.getMember2());
|
||||
}
|
||||
}
|
||||
@@ -1,123 +0,0 @@
|
||||
/*
|
||||
* 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.scenario.alfa.scn03;
|
||||
|
||||
import daxi.moe.app.External;
|
||||
import daxi.moe.app.Moe;
|
||||
import daxi.moe.model.AnyData;
|
||||
import daxi.moe.model.MappedData;
|
||||
import daxi.moe.model.SimpleData;
|
||||
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.Test;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* @author indroneel
|
||||
*/
|
||||
|
||||
@DisplayName("Memory Codec - simple setter methods")
|
||||
@Order(3)
|
||||
public class MemSimpleSetterTests extends AbstractTests {
|
||||
|
||||
private static final Logger L = Logger.getLogger(MemSimpleSetterTests.class.getName());
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
@DisplayName("Entity with a string member is created")
|
||||
public void test01() {
|
||||
Moe moe = Moe.create();
|
||||
External extern = moe.external("mem");
|
||||
AnyData model = extern.getModel();
|
||||
MappedData mainData = model.asMapped();
|
||||
Assertions.assertNotNull(mainData);
|
||||
mainData.put("member1", new AnyData(new SimpleData("string-value-01")));
|
||||
|
||||
StringEntity entity = extern.convert(StringEntity.class);
|
||||
Assertions.assertNotNull(entity);
|
||||
|
||||
Assertions.assertEquals("string-value-01", entity.getMember1());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(2)
|
||||
@DisplayName("Entity with boolean/Boolean members is created")
|
||||
public void test02() {
|
||||
Moe moe = Moe.create();
|
||||
External extern = moe.external("mem");
|
||||
AnyData model = extern.getModel();
|
||||
MappedData mainData = model.asMapped();
|
||||
Assertions.assertNotNull(mainData);
|
||||
|
||||
mainData.put("member1", new AnyData(new SimpleData(true)));
|
||||
mainData.put("member2", new AnyData(new SimpleData(Boolean.TRUE)));
|
||||
|
||||
BooleanEntity entity = extern.convert(BooleanEntity.class);
|
||||
Assertions.assertNotNull(entity);
|
||||
|
||||
Assertions.assertTrue(entity.isMember1());
|
||||
Assertions.assertNotNull(entity.getMember2());
|
||||
Assertions.assertEquals(Boolean.TRUE, entity.getMember2());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(3)
|
||||
@DisplayName("Entity with boolean/Boolean members is created from true/false string values")
|
||||
public void test03() {
|
||||
Moe moe = Moe.create();
|
||||
External extern = moe.external("mem");
|
||||
AnyData model = extern.getModel();
|
||||
MappedData mainData = model.asMapped();
|
||||
Assertions.assertNotNull(mainData);
|
||||
|
||||
String val1 = "true";
|
||||
String val2 = "tRUe";
|
||||
mainData.put("member1", new AnyData(new SimpleData(val1)));
|
||||
mainData.put("member2", new AnyData(new SimpleData(val2)));
|
||||
|
||||
BooleanEntity entity = extern.convert(BooleanEntity.class);
|
||||
Assertions.assertNotNull(entity);
|
||||
|
||||
Assertions.assertTrue(entity.isMember1());
|
||||
Assertions.assertNotNull(entity.getMember2());
|
||||
Assertions.assertEquals(Boolean.TRUE, entity.getMember2());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(4)
|
||||
@DisplayName("Entity with boolean/Boolean members is created from number values")
|
||||
public void test04() {
|
||||
Moe moe = Moe.create();
|
||||
External extern = moe.external("mem");
|
||||
AnyData model = extern.getModel();
|
||||
MappedData mainData = model.asMapped();
|
||||
Assertions.assertNotNull(mainData);
|
||||
|
||||
int val1 = 100;
|
||||
int val2 = 0;
|
||||
mainData.put("member1", new AnyData(new SimpleData(val1)));
|
||||
mainData.put("member2", new AnyData(new SimpleData(val2)));
|
||||
|
||||
BooleanEntity entity = extern.convert(BooleanEntity.class);
|
||||
Assertions.assertNotNull(entity);
|
||||
|
||||
Assertions.assertTrue(entity.isMember1());
|
||||
Assertions.assertNotNull(entity.getMember2());
|
||||
Assertions.assertEquals(Boolean.FALSE, entity.getMember2());
|
||||
}
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
/*
|
||||
* 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.scenario.alfa.scn04;
|
||||
|
||||
import daxi.moe.app.External;
|
||||
import daxi.moe.app.Moe;
|
||||
import daxi.moe.model.AnyData;
|
||||
import daxi.moe.model.MappedData;
|
||||
import daxi.moe.model.SimpleData;
|
||||
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.Test;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* @author indroneel
|
||||
*/
|
||||
|
||||
@DisplayName("Memory Codec - byte setter methods")
|
||||
@Order(4)
|
||||
public class MemByteSetterTests extends AbstractTests {
|
||||
|
||||
private static final Logger L = Logger.getLogger(MemByteSetterTests.class.getName());
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
@DisplayName("Entity with byte/Byte members is created")
|
||||
public void test01() {
|
||||
Moe moe = Moe.create();
|
||||
External extern = moe.external("mem");
|
||||
AnyData model = extern.getModel();
|
||||
MappedData mainData = model.asMapped();
|
||||
Assertions.assertNotNull(mainData);
|
||||
|
||||
byte val1 = 0x1A;
|
||||
byte val2 = 0x1B;
|
||||
mainData.put("member1", new AnyData(new SimpleData(val1)));
|
||||
mainData.put("member2", new AnyData(new SimpleData(val2)));
|
||||
|
||||
ByteEntity entity = extern.convert(ByteEntity.class);
|
||||
Assertions.assertNotNull(entity);
|
||||
Assertions.assertEquals(val1, entity.getMember1());
|
||||
Assertions.assertEquals(val2, entity.getMember2());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(2)
|
||||
@DisplayName("Entity with byte/Byte members is created from String values")
|
||||
public void test02() {
|
||||
Moe moe = Moe.create();
|
||||
External extern = moe.external("mem");
|
||||
AnyData model = extern.getModel();
|
||||
MappedData mainData = model.asMapped();
|
||||
Assertions.assertNotNull(mainData);
|
||||
|
||||
String val1 = "26";
|
||||
String val2 = "27";
|
||||
mainData.put("member1", new AnyData(new SimpleData(val1)));
|
||||
mainData.put("member2", new AnyData(new SimpleData(val2)));
|
||||
|
||||
ByteEntity entity = extern.convert(ByteEntity.class);
|
||||
Assertions.assertNotNull(entity);
|
||||
Assertions.assertEquals((byte) 26, entity.getMember1());
|
||||
Assertions.assertEquals(Byte.valueOf((byte) 27), entity.getMember2());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(3)
|
||||
@DisplayName("Entity with byte/Byte members is not created from non-numeric String values")
|
||||
public void test03() {
|
||||
Moe moe = Moe.create();
|
||||
External extern = moe.external("mem");
|
||||
AnyData model = extern.getModel();
|
||||
MappedData mainData = model.asMapped();
|
||||
Assertions.assertNotNull(mainData);
|
||||
|
||||
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)));
|
||||
|
||||
ByteEntity entity = extern.convert(ByteEntity.class);
|
||||
Assertions.assertNotNull(entity);
|
||||
Assertions.assertEquals(0, entity.getMember1());
|
||||
Assertions.assertNull(entity.getMember2());
|
||||
}
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
/*
|
||||
* 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.scenario.alfa.scn05;
|
||||
|
||||
import daxi.moe.app.External;
|
||||
import daxi.moe.app.Moe;
|
||||
import daxi.moe.model.AnyData;
|
||||
import daxi.moe.model.MappedData;
|
||||
import daxi.moe.model.SimpleData;
|
||||
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.Test;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* @author indroneel
|
||||
*/
|
||||
|
||||
@DisplayName("Memory Codec - short setter methods")
|
||||
@Order(5)
|
||||
public class MemShortSetterTests extends AbstractTests {
|
||||
|
||||
private static final Logger L = Logger.getLogger(MemShortSetterTests.class.getName());
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
@DisplayName("Entity with short/Short members is created")
|
||||
public void test01() {
|
||||
Moe moe = Moe.create();
|
||||
External extern = moe.external("mem");
|
||||
AnyData model = extern.getModel();
|
||||
MappedData mainData = model.asMapped();
|
||||
Assertions.assertNotNull(mainData);
|
||||
short val1 = 16343;
|
||||
short val2 = 2048;
|
||||
mainData.put("member1", new AnyData(new SimpleData(val1)));
|
||||
mainData.put("member2", new AnyData(new SimpleData(val2)));
|
||||
|
||||
ShortEntity entity = extern.convert(ShortEntity.class);
|
||||
Assertions.assertNotNull(entity);
|
||||
|
||||
Assertions.assertEquals(val1, entity.getMember1());
|
||||
Assertions.assertEquals(val2, entity.getMember2());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(2)
|
||||
@DisplayName("Entity with short/Short members is created from String values")
|
||||
public void test02() {
|
||||
Moe moe = Moe.create();
|
||||
External extern = moe.external("mem");
|
||||
AnyData model = extern.getModel();
|
||||
MappedData mainData = model.asMapped();
|
||||
Assertions.assertNotNull(mainData);
|
||||
String val1 = "16343";
|
||||
String val2 = "2048";
|
||||
mainData.put("member1", new AnyData(new SimpleData(val1)));
|
||||
mainData.put("member2", new AnyData(new SimpleData(val2)));
|
||||
|
||||
ShortEntity entity = extern.convert(ShortEntity.class);
|
||||
Assertions.assertNotNull(entity);
|
||||
|
||||
Assertions.assertEquals((short) 16343, entity.getMember1());
|
||||
Assertions.assertEquals(Short.valueOf((short)2048), entity.getMember2());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(3)
|
||||
@DisplayName("Entity with short/Short members is not created from non-numeric String values")
|
||||
public void test03() {
|
||||
Moe moe = Moe.create();
|
||||
External extern = moe.external("mem");
|
||||
AnyData model = extern.getModel();
|
||||
MappedData mainData = model.asMapped();
|
||||
Assertions.assertNotNull(mainData);
|
||||
|
||||
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)));
|
||||
|
||||
ShortEntity entity = extern.convert(ShortEntity.class);
|
||||
Assertions.assertNotNull(entity);
|
||||
Assertions.assertEquals(0, entity.getMember1());
|
||||
Assertions.assertNull(entity.getMember2());
|
||||
}
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
/*
|
||||
* 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.scenario.alfa.scn06;
|
||||
|
||||
import daxi.moe.app.External;
|
||||
import daxi.moe.app.Moe;
|
||||
import daxi.moe.model.AnyData;
|
||||
import daxi.moe.model.MappedData;
|
||||
import daxi.moe.model.SimpleData;
|
||||
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.Test;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* @author indroneel
|
||||
*/
|
||||
|
||||
@DisplayName("Memory Codec - integer setter methods")
|
||||
@Order(6)
|
||||
public class MemIntegerSetterTests extends AbstractTests {
|
||||
|
||||
private static final Logger L = Logger.getLogger(MemIntegerSetterTests.class.getName());
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
@DisplayName("Entity with int/Integer members is created")
|
||||
public void test01() {
|
||||
Moe moe = Moe.create();
|
||||
External extern = moe.external("mem");
|
||||
AnyData model = extern.getModel();
|
||||
MappedData mainData = model.asMapped();
|
||||
Assertions.assertNotNull(mainData);
|
||||
|
||||
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)));
|
||||
|
||||
IntegerEntity entity = extern.convert(IntegerEntity.class);
|
||||
Assertions.assertNotNull(entity);
|
||||
|
||||
Assertions.assertEquals(val1, entity.getMember1());
|
||||
Assertions.assertEquals(val2, entity.getMember2());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(2)
|
||||
@DisplayName("Entity with int/Integer members is created from string values")
|
||||
public void test02() {
|
||||
Moe moe = Moe.create();
|
||||
External extern = moe.external("mem");
|
||||
AnyData model = extern.getModel();
|
||||
MappedData mainData = model.asMapped();
|
||||
Assertions.assertNotNull(mainData);
|
||||
|
||||
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)));
|
||||
|
||||
IntegerEntity entity = extern.convert(IntegerEntity.class);
|
||||
Assertions.assertNotNull(entity);
|
||||
|
||||
Assertions.assertEquals(i1, entity.getMember1());
|
||||
Assertions.assertEquals(i2, entity.getMember2());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(3)
|
||||
@DisplayName("Entity with int/Integer members is not created from non-numeric String values")
|
||||
public void test03() {
|
||||
Moe moe = Moe.create();
|
||||
External extern = moe.external("mem");
|
||||
AnyData model = extern.getModel();
|
||||
MappedData mainData = model.asMapped();
|
||||
Assertions.assertNotNull(mainData);
|
||||
|
||||
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)));
|
||||
|
||||
IntegerEntity entity = extern.convert(IntegerEntity.class);
|
||||
Assertions.assertNotNull(entity);
|
||||
Assertions.assertEquals(0, entity.getMember1());
|
||||
Assertions.assertNull(entity.getMember2());
|
||||
}
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
/*
|
||||
* 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.scenario.alfa.scn07;
|
||||
|
||||
import daxi.moe.app.External;
|
||||
import daxi.moe.app.Moe;
|
||||
import daxi.moe.model.AnyData;
|
||||
import daxi.moe.model.MappedData;
|
||||
import daxi.moe.model.SimpleData;
|
||||
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.Test;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* @author indroneel
|
||||
*/
|
||||
|
||||
@DisplayName("Memory Codec - float setter methods")
|
||||
@Order(7)
|
||||
public class MemFloatSetterTests extends AbstractTests {
|
||||
|
||||
private static final Logger L = Logger.getLogger(MemFloatSetterTests.class.getName());
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
@DisplayName("Entity with float/Float members is created")
|
||||
public void test01() {
|
||||
Moe moe = Moe.create();
|
||||
External extern = moe.external("mem");
|
||||
AnyData model = extern.getModel();
|
||||
MappedData mainData = model.asMapped();
|
||||
Assertions.assertNotNull(mainData);
|
||||
|
||||
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)));
|
||||
|
||||
FloatEntity entity = extern.convert(FloatEntity.class);
|
||||
Assertions.assertNotNull(entity);
|
||||
|
||||
Assertions.assertEquals(val1, entity.getMember1());
|
||||
Assertions.assertEquals(val2, entity.getMember2());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(2)
|
||||
@DisplayName("Entity with float/Float members is created from string values")
|
||||
public void test02() {
|
||||
Moe moe = Moe.create();
|
||||
External extern = moe.external("mem");
|
||||
AnyData model = extern.getModel();
|
||||
MappedData mainData = model.asMapped();
|
||||
Assertions.assertNotNull(mainData);
|
||||
|
||||
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)));
|
||||
|
||||
FloatEntity entity = extern.convert(FloatEntity.class);
|
||||
Assertions.assertNotNull(entity);
|
||||
|
||||
Assertions.assertEquals(f1, entity.getMember1());
|
||||
Assertions.assertEquals(f2, entity.getMember2());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(3)
|
||||
@DisplayName("Entity with float/Float members is not created from non-numeric String values")
|
||||
public void test03() {
|
||||
Moe moe = Moe.create();
|
||||
External extern = moe.external("mem");
|
||||
AnyData model = extern.getModel();
|
||||
MappedData mainData = model.asMapped();
|
||||
Assertions.assertNotNull(mainData);
|
||||
|
||||
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)));
|
||||
|
||||
FloatEntity entity = extern.convert(FloatEntity.class);
|
||||
Assertions.assertNotNull(entity);
|
||||
Assertions.assertEquals(0, entity.getMember1());
|
||||
Assertions.assertNull(entity.getMember2());
|
||||
}
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
/*
|
||||
* 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.scenario.alfa.scn08;
|
||||
|
||||
import daxi.moe.app.External;
|
||||
import daxi.moe.app.Moe;
|
||||
import daxi.moe.model.AnyData;
|
||||
import daxi.moe.model.MappedData;
|
||||
import daxi.moe.model.SimpleData;
|
||||
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.Test;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* @author indroneel
|
||||
*/
|
||||
|
||||
@DisplayName("Memory Codec - long setter methods")
|
||||
@Order(8)
|
||||
public class MemLongSetterTests extends AbstractTests {
|
||||
|
||||
private static final Logger L = Logger.getLogger(MemLongSetterTests.class.getName());
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
@DisplayName("Entity with long/Long members is created")
|
||||
public void test01() {
|
||||
Moe moe = Moe.create();
|
||||
External extern = moe.external("mem");
|
||||
AnyData model = extern.getModel();
|
||||
MappedData mainData = model.asMapped();
|
||||
Assertions.assertNotNull(mainData);
|
||||
|
||||
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)));
|
||||
|
||||
LongEntity entity = extern.convert(LongEntity.class);
|
||||
Assertions.assertNotNull(entity);
|
||||
|
||||
Assertions.assertEquals(val1, entity.getMember1());
|
||||
Assertions.assertEquals(val2, entity.getMember2());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(2)
|
||||
@DisplayName("Entity with long/Long members is created from string values")
|
||||
public void test02() {
|
||||
Moe moe = Moe.create();
|
||||
External extern = moe.external("mem");
|
||||
AnyData model = extern.getModel();
|
||||
MappedData mainData = model.asMapped();
|
||||
Assertions.assertNotNull(mainData);
|
||||
|
||||
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)));
|
||||
|
||||
LongEntity entity = extern.convert(LongEntity.class);
|
||||
Assertions.assertNotNull(entity);
|
||||
|
||||
Assertions.assertEquals(l1, entity.getMember1());
|
||||
Assertions.assertEquals(l2, entity.getMember2());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(3)
|
||||
@DisplayName("Entity with long/Long members is not created from non-numeric String values")
|
||||
public void test03() {
|
||||
Moe moe = Moe.create();
|
||||
External extern = moe.external("mem");
|
||||
AnyData model = extern.getModel();
|
||||
MappedData mainData = model.asMapped();
|
||||
Assertions.assertNotNull(mainData);
|
||||
|
||||
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)));
|
||||
|
||||
LongEntity entity = extern.convert(LongEntity.class);
|
||||
Assertions.assertNotNull(entity);
|
||||
Assertions.assertEquals(0, entity.getMember1());
|
||||
Assertions.assertNull(entity.getMember2());
|
||||
}
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
/*
|
||||
* 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.scenario.alfa.scn09;
|
||||
|
||||
import daxi.moe.app.External;
|
||||
import daxi.moe.app.Moe;
|
||||
import daxi.moe.model.AnyData;
|
||||
import daxi.moe.model.MappedData;
|
||||
import daxi.moe.model.SimpleData;
|
||||
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.Test;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* @author indroneel
|
||||
*/
|
||||
|
||||
@DisplayName("Memory Codec - double setter methods")
|
||||
@Order(9)
|
||||
public class MemDoubleSetterTests extends AbstractTests {
|
||||
|
||||
private static final Logger L = Logger.getLogger(MemDoubleSetterTests.class.getName());
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
@DisplayName("Entity with double/Double members is created")
|
||||
public void test01() {
|
||||
Moe moe = Moe.create();
|
||||
External extern = moe.external("mem");
|
||||
AnyData model = extern.getModel();
|
||||
MappedData mainData = model.asMapped();
|
||||
Assertions.assertNotNull(mainData);
|
||||
|
||||
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)));
|
||||
|
||||
DoubleEntity entity = extern.convert(DoubleEntity.class);
|
||||
Assertions.assertNotNull(entity);
|
||||
|
||||
Assertions.assertEquals(val1, entity.getMember1());
|
||||
Assertions.assertEquals(val2, entity.getMember2());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(2)
|
||||
@DisplayName("Entity with double/Double members is created from string values")
|
||||
public void test02() {
|
||||
Moe moe = Moe.create();
|
||||
External extern = moe.external("mem");
|
||||
AnyData model = extern.getModel();
|
||||
MappedData mainData = model.asMapped();
|
||||
Assertions.assertNotNull(mainData);
|
||||
|
||||
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)));
|
||||
|
||||
DoubleEntity entity = extern.convert(DoubleEntity.class);
|
||||
Assertions.assertNotNull(entity);
|
||||
|
||||
Assertions.assertEquals(d1, entity.getMember1());
|
||||
Assertions.assertEquals(d2, entity.getMember2());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(3)
|
||||
@DisplayName("Entity with double/Double members is not created from non-numeric String values")
|
||||
public void test03() {
|
||||
Moe moe = Moe.create();
|
||||
External extern = moe.external("mem");
|
||||
AnyData model = extern.getModel();
|
||||
MappedData mainData = model.asMapped();
|
||||
Assertions.assertNotNull(mainData);
|
||||
|
||||
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)));
|
||||
|
||||
DoubleEntity entity = extern.convert(DoubleEntity.class);
|
||||
Assertions.assertNotNull(entity);
|
||||
Assertions.assertEquals(0, entity.getMember1());
|
||||
Assertions.assertNull(entity.getMember2());
|
||||
}
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
/*
|
||||
* 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.scenario.alfa.scn10;
|
||||
|
||||
import daxi.moe.app.External;
|
||||
import daxi.moe.app.Moe;
|
||||
import daxi.moe.model.AnyData;
|
||||
import daxi.moe.model.MappedData;
|
||||
import daxi.moe.model.SimpleData;
|
||||
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.Test;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.Random;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* @author indroneel
|
||||
*/
|
||||
|
||||
@DisplayName("Memory Codec - big integer setter methods")
|
||||
@Order(10)
|
||||
public class MemBigIntegerSetterTests extends AbstractTests {
|
||||
|
||||
private static final Logger L = Logger.getLogger(MemBigIntegerSetterTests.class.getName());
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
@DisplayName("Entity with BigInteger members is created from long values")
|
||||
public void test01() {
|
||||
Moe moe = Moe.create();
|
||||
External extern = moe.external("mem");
|
||||
AnyData model = extern.getModel();
|
||||
MappedData mainData = model.asMapped();
|
||||
Assertions.assertNotNull(mainData);
|
||||
|
||||
Random random = new Random();
|
||||
long val1 = random.nextLong();
|
||||
mainData.put("member1", new AnyData(new SimpleData(val1)));
|
||||
|
||||
BigIntegerEntity entity = extern.convert(BigIntegerEntity.class);
|
||||
Assertions.assertNotNull(entity);
|
||||
|
||||
Assertions.assertEquals(BigInteger.valueOf(val1), entity.getMember1());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(2)
|
||||
@DisplayName("Entity with BigInteger members is created from double values")
|
||||
public void test02() {
|
||||
Moe moe = Moe.create();
|
||||
External extern = moe.external("mem");
|
||||
AnyData model = extern.getModel();
|
||||
MappedData mainData = model.asMapped();
|
||||
Assertions.assertNotNull(mainData);
|
||||
|
||||
Random random = new Random();
|
||||
double val1 = random.nextDouble();
|
||||
mainData.put("member1", new AnyData(new SimpleData(val1)));
|
||||
|
||||
BigIntegerEntity entity = extern.convert(BigIntegerEntity.class);
|
||||
Assertions.assertNotNull(entity);
|
||||
|
||||
Assertions.assertEquals(BigInteger.valueOf((long) val1), entity.getMember1());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(3)
|
||||
@DisplayName("Entity with BigInteger members is created from string values")
|
||||
public void test03() {
|
||||
Moe moe = Moe.create();
|
||||
External extern = moe.external("mem");
|
||||
AnyData model = extern.getModel();
|
||||
MappedData mainData = model.asMapped();
|
||||
Assertions.assertNotNull(mainData);
|
||||
|
||||
Random random = new Random();
|
||||
String val1 = "123456789012345678901234567890";
|
||||
mainData.put("member1", new AnyData(new SimpleData(val1)));
|
||||
|
||||
BigIntegerEntity entity = extern.convert(BigIntegerEntity.class);
|
||||
Assertions.assertNotNull(entity);
|
||||
|
||||
Assertions.assertEquals(new BigInteger(val1), entity.getMember1());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(4)
|
||||
@DisplayName("Entity with BigInteger members is not created from non-numeric string values")
|
||||
public void test04() {
|
||||
Moe moe = Moe.create();
|
||||
External extern = moe.external("mem");
|
||||
AnyData model = extern.getModel();
|
||||
MappedData mainData = model.asMapped();
|
||||
Assertions.assertNotNull(mainData);
|
||||
|
||||
String val1 = "bad big integer";
|
||||
mainData.put("member1", new AnyData(new SimpleData(val1)));
|
||||
|
||||
BigIntegerEntity entity = extern.convert(BigIntegerEntity.class);
|
||||
Assertions.assertNotNull(entity);
|
||||
Assertions.assertNull(entity.getMember1());
|
||||
}
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
/*
|
||||
* 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.scenario.alfa.scn11;
|
||||
|
||||
import daxi.moe.app.External;
|
||||
import daxi.moe.app.Moe;
|
||||
import daxi.moe.model.AnyData;
|
||||
import daxi.moe.model.MappedData;
|
||||
import daxi.moe.model.SimpleData;
|
||||
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.Test;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Random;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* @author indroneel
|
||||
*/
|
||||
|
||||
@DisplayName("Memory Codec - big decimal setter methods")
|
||||
@Order(11)
|
||||
public class MemBigDecimalSetterTests extends AbstractTests {
|
||||
|
||||
private static final Logger L = Logger.getLogger(MemBigDecimalSetterTests.class.getName());
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
@DisplayName("Entity with BigDecimal members is created from double values")
|
||||
public void test01() {
|
||||
Moe moe = Moe.create();
|
||||
External extern = moe.external("mem");
|
||||
AnyData model = extern.getModel();
|
||||
MappedData mainData = model.asMapped();
|
||||
Assertions.assertNotNull(mainData);
|
||||
|
||||
Random random = new Random();
|
||||
double val1 = random.nextDouble();
|
||||
mainData.put("member1", new AnyData(new SimpleData(val1)));
|
||||
|
||||
BigDecimalEntity entity = extern.convert(BigDecimalEntity.class);
|
||||
Assertions.assertNotNull(entity);
|
||||
|
||||
Assertions.assertEquals(BigDecimal.valueOf(val1), entity.getMember1());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(2)
|
||||
@DisplayName("Entity with BigDecimal members is created from long values")
|
||||
public void test02() {
|
||||
Moe moe = Moe.create();
|
||||
External extern = moe.external("mem");
|
||||
AnyData model = extern.getModel();
|
||||
MappedData mainData = model.asMapped();
|
||||
Assertions.assertNotNull(mainData);
|
||||
|
||||
Random random = new Random();
|
||||
long val1 = random.nextLong();
|
||||
mainData.put("member1", new AnyData(new SimpleData(val1)));
|
||||
|
||||
BigDecimalEntity entity = extern.convert(BigDecimalEntity.class);
|
||||
Assertions.assertNotNull(entity);
|
||||
|
||||
Assertions.assertEquals(BigDecimal.valueOf(val1), entity.getMember1());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(3)
|
||||
@DisplayName("Entity with BigDecimal members is created from string values")
|
||||
public void test03() {
|
||||
Moe moe = Moe.create();
|
||||
External extern = moe.external("mem");
|
||||
AnyData model = extern.getModel();
|
||||
MappedData mainData = model.asMapped();
|
||||
Assertions.assertNotNull(mainData);
|
||||
|
||||
Random random = new Random();
|
||||
String val1 = "123456789012345678901234567890.123";
|
||||
mainData.put("member1", new AnyData(new SimpleData(val1)));
|
||||
|
||||
BigDecimalEntity entity = extern.convert(BigDecimalEntity.class);
|
||||
Assertions.assertNotNull(entity);
|
||||
|
||||
Assertions.assertEquals(new BigDecimal(val1), entity.getMember1());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(4)
|
||||
@DisplayName("Entity with BigDecimal members is not created from non-numeric string values")
|
||||
public void test04() {
|
||||
Moe moe = Moe.create();
|
||||
External extern = moe.external("mem");
|
||||
AnyData model = extern.getModel();
|
||||
MappedData mainData = model.asMapped();
|
||||
Assertions.assertNotNull(mainData);
|
||||
|
||||
String val1 = "bad big decimal";
|
||||
mainData.put("member1", new AnyData(new SimpleData(val1)));
|
||||
|
||||
BigDecimalEntity entity = extern.convert(BigDecimalEntity.class);
|
||||
Assertions.assertNotNull(entity);
|
||||
Assertions.assertNull(entity.getMember1());
|
||||
}
|
||||
}
|
||||
+15
-9
@@ -12,11 +12,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package daxi.moe.test.scenario.charlie;
|
||||
package dxt.moe.test.json;
|
||||
|
||||
import daxi.moe.test.setup.AbstractTests;
|
||||
import dxt.moe.app.External;
|
||||
import dxt.moe.app.Internal;
|
||||
import dxt.moe.app.Moe;
|
||||
import dxt.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 Charlie")
|
||||
@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);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(2)
|
||||
public void test02() {
|
||||
|
||||
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 dxt.moe.test.json.mod2obj;
|
||||
|
||||
import dxt.moe.app.External;
|
||||
import dxt.moe.app.Moe;
|
||||
import dxt.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 dxt.moe.test.json.mod2obj.semantics;
|
||||
|
||||
import dxt.moe.app.CodecException;
|
||||
import dxt.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());
|
||||
}
|
||||
}
|
||||
+14
-9
@@ -12,28 +12,28 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package daxi.moe.test.scenario.alfa.scn01;
|
||||
package dxt.moe.test.json.mod2obj.semantics;
|
||||
|
||||
import daxi.moe.app.MapFrom;
|
||||
import dxt.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 dxt.moe.test.json.mod2obj.setter.linear.boolval;
|
||||
|
||||
import dxt.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 dxt.moe.test.json.mod2obj.setter.linear.boolval;
|
||||
|
||||
import dxt.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 dxt.moe.test.json.mod2obj.setter.linear.intval;
|
||||
|
||||
import dxt.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 dxt.moe.test.json.mod2obj.setter.linear.intval;
|
||||
|
||||
import dxt.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 dxt.moe.test.json.mod2obj.setter.linear.objval;
|
||||
|
||||
import dxt.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 dxt.moe.test.json.mod2obj.setter.linear.objval;
|
||||
|
||||
import dxt.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 dxt.moe.test.json.mod2obj.setter.linear.objval;
|
||||
|
||||
import dxt.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 dxt.moe.test.json.mod2obj.setter.linear.objval;
|
||||
|
||||
import dxt.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);
|
||||
}
|
||||
}
|
||||
+7
-7
@@ -12,18 +12,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package daxi.moe.test.scenario.alfa.scn03;
|
||||
package dxt.moe.test.json.mod2obj.setter.linear.objval;
|
||||
|
||||
import daxi.moe.app.MapFrom;
|
||||
import dxt.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 dxt.moe.test.json.mod2obj.setter.linear.strval;
|
||||
|
||||
import dxt.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 dxt.moe.test.json.mod2obj.setter.linear.strval;
|
||||
|
||||
import dxt.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 dxt.moe.test.json.mod2obj.setter.mapped.blank;
|
||||
|
||||
import dxt.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 dxt.moe.test.json.mod2obj.setter.mapped.blank;
|
||||
|
||||
import dxt.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 dxt.moe.test.json.mod2obj.setter.mapped.blank;
|
||||
|
||||
import dxt.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 dxt.moe.test.json.mod2obj.setter.mapped.intval;
|
||||
|
||||
import dxt.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 dxt.moe.test.json.mod2obj.setter.mapped.intval;
|
||||
|
||||
import dxt.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 dxt.moe.test.json.mod2obj.setter.mapped.intval;
|
||||
|
||||
import dxt.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 dxt.moe.test.json.mod2obj.setter.mapped.strval;
|
||||
|
||||
import dxt.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 dxt.moe.test.json.mod2obj.setter.mapped.strval;
|
||||
|
||||
import dxt.moe.app.MapFrom;
|
||||
|
||||
public class Root {
|
||||
|
||||
private StringNested nested;
|
||||
|
||||
public StringNested getNested() {
|
||||
return nested;
|
||||
}
|
||||
|
||||
@MapFrom("nested")
|
||||
private void _setNested(StringNested value) {
|
||||
nested = value;
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -12,24 +12,24 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package daxi.moe.test.scenario.alfa.scn02;
|
||||
package dxt.moe.test.json.mod2obj.setter.mapped.strval;
|
||||
|
||||
import daxi.moe.app.MapFrom;
|
||||
import dxt.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 dxt.moe.test.json.mod2obj.setter.simple.bdecval;
|
||||
|
||||
import dxt.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 dxt.moe.test.json.mod2obj.setter.simple.bdecval;
|
||||
|
||||
import dxt.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 dxt.moe.test.json.mod2obj.setter.simple.bintval;
|
||||
|
||||
import dxt.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 dxt.moe.test.json.mod2obj.setter.simple.bintval;
|
||||
|
||||
import dxt.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 dxt.moe.test.json.mod2obj.setter.simple.boolval;
|
||||
|
||||
import dxt.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 dxt.moe.test.json.mod2obj.setter.simple.boolval;
|
||||
|
||||
import dxt.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 dxt.moe.test.json.mod2obj.setter.simple.byteval;
|
||||
|
||||
import dxt.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 dxt.moe.test.json.mod2obj.setter.simple.byteval;
|
||||
|
||||
import dxt.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 dxt.moe.test.json.mod2obj.setter.simple.doubleval;
|
||||
|
||||
import dxt.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 dxt.moe.test.json.mod2obj.setter.simple.doubleval;
|
||||
|
||||
import dxt.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 dxt.moe.test.json.mod2obj.setter.simple.floatval;
|
||||
|
||||
import dxt.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 dxt.moe.test.json.mod2obj.setter.simple.floatval;
|
||||
|
||||
import dxt.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 dxt.moe.test.json.mod2obj.setter.simple.intval;
|
||||
|
||||
import dxt.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 dxt.moe.test.json.mod2obj.setter.simple.intval;
|
||||
|
||||
import dxt.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 dxt.moe.test.json.mod2obj.setter.simple.longval;
|
||||
|
||||
import dxt.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 dxt.moe.test.json.mod2obj.setter.simple.longval;
|
||||
|
||||
import dxt.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 dxt.moe.test.json.mod2obj.setter.simple.shortval;
|
||||
|
||||
import dxt.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 dxt.moe.test.json.mod2obj.setter.simple.shortval;
|
||||
|
||||
import dxt.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 dxt.moe.test.json.mod2obj.setter.simple.strval;
|
||||
|
||||
import dxt.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());
|
||||
}
|
||||
}
|
||||
+4
-8
@@ -12,24 +12,20 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package daxi.moe.test.scenario.alfa.scn02;
|
||||
package dxt.moe.test.json.mod2obj.setter.simple.strval;
|
||||
|
||||
import daxi.moe.app.MapFrom;
|
||||
import dxt.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;
|
||||
}
|
||||
}
|
||||
+15
-9
@@ -12,11 +12,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package daxi.moe.test.scenario.delta;
|
||||
package dxt.moe.test.mem;
|
||||
|
||||
import daxi.moe.test.setup.AbstractTests;
|
||||
import dxt.moe.app.External;
|
||||
import dxt.moe.app.Internal;
|
||||
import dxt.moe.app.Moe;
|
||||
import dxt.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 dxt.moe.test.mem.mod2obj;
|
||||
|
||||
import dxt.moe.app.External;
|
||||
import dxt.moe.app.Moe;
|
||||
import dxt.moe.model.AnyData;
|
||||
import dxt.moe.model.MappedData;
|
||||
import dxt.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 dxt.moe.test.mem.mod2obj.semantics;
|
||||
|
||||
import dxt.moe.model.AnyData;
|
||||
import dxt.moe.model.SimpleData;
|
||||
import dxt.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 dxt.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 dxt.moe.test.mem.mod2obj.semantics;
|
||||
|
||||
import dxt.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;
|
||||
}
|
||||
}
|
||||
+11
-4
@@ -12,16 +12,23 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package daxi.moe.test.scenario.alfa.scn01;
|
||||
package dxt.moe.test.mem.mod2obj.semantics;
|
||||
|
||||
import daxi.moe.app.MapFrom;
|
||||
import dxt.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 dxt.moe.test.mem.mod2obj.setter.semantics;
|
||||
|
||||
import dxt.moe.app.ConvertException;
|
||||
import dxt.moe.model.AnyData;
|
||||
import dxt.moe.model.SimpleData;
|
||||
import dxt.moe.test.mod2obj.Check;
|
||||
import dxt.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));
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -12,24 +12,24 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package daxi.moe.test.scenario.alfa.scn02;
|
||||
package dxt.moe.test.mem.mod2obj.setter.semantics;
|
||||
|
||||
import daxi.moe.app.MapFrom;
|
||||
import dxt.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 dxt.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 dxt.moe.test.mem.mod2obj.setter.semantics;
|
||||
|
||||
import dxt.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 dxt.moe.test.mem.mod2obj.setter.semantics;
|
||||
|
||||
import dxt.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 dxt.moe.test.mem.mod2obj.setter.semantics;
|
||||
|
||||
import dxt.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 dxt.moe.test.mem.mod2obj.setter.semantics;
|
||||
|
||||
import dxt.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 dxt.moe.test.mem.mod2obj.setter.semantics;
|
||||
|
||||
import dxt.moe.app.MapFrom;
|
||||
import dxt.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 dxt.moe.test.mem.mod2obj.setter.semantics;
|
||||
|
||||
import dxt.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 dxt.moe.test.mem.mod2obj.setter.semantics;
|
||||
|
||||
import dxt.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 dxt.moe.test.mem.mod2obj.setter.simple.bdecval;
|
||||
|
||||
import dxt.moe.model.AnyData;
|
||||
import dxt.moe.model.SimpleData;
|
||||
import dxt.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());
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -12,9 +12,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package daxi.moe.test.scenario.alfa.scn11;
|
||||
package dxt.moe.test.mem.mod2obj.setter.simple.bdecval;
|
||||
|
||||
import daxi.moe.app.MapFrom;
|
||||
import dxt.moe.app.MapFrom;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@@ -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 dxt.moe.test.mem.mod2obj.setter.simple.bintval;
|
||||
|
||||
import dxt.moe.model.AnyData;
|
||||
import dxt.moe.model.SimpleData;
|
||||
import dxt.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());
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -12,9 +12,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package daxi.moe.test.scenario.alfa.scn10;
|
||||
package dxt.moe.test.mem.mod2obj.setter.simple.bintval;
|
||||
|
||||
import daxi.moe.app.MapFrom;
|
||||
import dxt.moe.app.MapFrom;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
@@ -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 dxt.moe.test.mem.mod2obj.setter.simple.boolval;
|
||||
|
||||
import dxt.moe.model.AnyData;
|
||||
import dxt.moe.model.SimpleData;
|
||||
import dxt.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());
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -12,16 +12,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package daxi.moe.test.scenario.alfa.scn03;
|
||||
package dxt.moe.test.mem.mod2obj.setter.simple.boolval;
|
||||
|
||||
import daxi.moe.app.MapFrom;
|
||||
import dxt.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 dxt.moe.test.mem.mod2obj.setter.simple.byteval;
|
||||
|
||||
import dxt.moe.model.AnyData;
|
||||
import dxt.moe.model.SimpleData;
|
||||
import dxt.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());
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -12,16 +12,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package daxi.moe.test.scenario.alfa.scn04;
|
||||
package dxt.moe.test.mem.mod2obj.setter.simple.byteval;
|
||||
|
||||
import daxi.moe.app.MapFrom;
|
||||
import dxt.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 dxt.moe.test.mem.mod2obj.setter.simple.doubleval;
|
||||
|
||||
import dxt.moe.model.AnyData;
|
||||
import dxt.moe.model.SimpleData;
|
||||
import dxt.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());
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -12,16 +12,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package daxi.moe.test.scenario.alfa.scn09;
|
||||
package dxt.moe.test.mem.mod2obj.setter.simple.doubleval;
|
||||
|
||||
import daxi.moe.app.MapFrom;
|
||||
import dxt.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 dxt.moe.test.mem.mod2obj.setter.simple.floatval;
|
||||
|
||||
import dxt.moe.model.AnyData;
|
||||
import dxt.moe.model.SimpleData;
|
||||
import dxt.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());
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -12,16 +12,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package daxi.moe.test.scenario.alfa.scn07;
|
||||
package dxt.moe.test.mem.mod2obj.setter.simple.floatval;
|
||||
|
||||
import daxi.moe.app.MapFrom;
|
||||
import dxt.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 dxt.moe.test.mem.mod2obj.setter.simple.intval;
|
||||
|
||||
import dxt.moe.model.AnyData;
|
||||
import dxt.moe.model.SimpleData;
|
||||
import dxt.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());
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -12,16 +12,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package daxi.moe.test.scenario.alfa.scn06;
|
||||
package dxt.moe.test.mem.mod2obj.setter.simple.intval;
|
||||
|
||||
import daxi.moe.app.MapFrom;
|
||||
import dxt.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 dxt.moe.test.mem.mod2obj.setter.simple.longval;
|
||||
|
||||
import dxt.moe.model.AnyData;
|
||||
import dxt.moe.model.SimpleData;
|
||||
import dxt.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());
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -12,16 +12,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package daxi.moe.test.scenario.alfa.scn08;
|
||||
package dxt.moe.test.mem.mod2obj.setter.simple.longval;
|
||||
|
||||
import daxi.moe.app.MapFrom;
|
||||
import dxt.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 dxt.moe.test.mem.mod2obj.setter.simple.shortval;
|
||||
|
||||
import dxt.moe.model.AnyData;
|
||||
import dxt.moe.model.SimpleData;
|
||||
import dxt.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());
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -12,16 +12,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package daxi.moe.test.scenario.alfa.scn05;
|
||||
package dxt.moe.test.mem.mod2obj.setter.simple.shortval;
|
||||
|
||||
import daxi.moe.app.MapFrom;
|
||||
import dxt.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 dxt.moe.test.mem.mod2obj.setter.simple.strval;
|
||||
|
||||
import dxt.moe.model.AnyData;
|
||||
import dxt.moe.model.SimpleData;
|
||||
import dxt.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 dxt.moe.test.mem.mod2obj.setter.simple.strval;
|
||||
|
||||
import dxt.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 dxt.moe.test.mem.obj2mod;
|
||||
|
||||
import dxt.moe.app.Internal;
|
||||
import dxt.moe.app.Moe;
|
||||
import dxt.moe.model.AnyData;
|
||||
import dxt.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 dxt.moe.test.mem.obj2mod.linear.numitem;
|
||||
|
||||
import dxt.moe.model.AnyData;
|
||||
import dxt.moe.model.LinearData;
|
||||
import dxt.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 with integer items")
|
||||
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 dxt.moe.test.mem.obj2mod.linear.numitem;
|
||||
|
||||
import dxt.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 dxt.moe.test.mem.obj2mod.linear.numitem;
|
||||
|
||||
import dxt.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 dxt.moe.test.mem.obj2mod.linear.numitem;
|
||||
|
||||
import dxt.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,130 @@
|
||||
/*
|
||||
* 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 dxt.moe.test.mem.obj2mod.linear.objitem;
|
||||
|
||||
import dxt.moe.model.AnyData;
|
||||
import dxt.moe.model.LinearData;
|
||||
import dxt.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 with custom object items")
|
||||
public class AllTests extends MemObj2ModTests {
|
||||
|
||||
private static final Logger L = Logger.getLogger(AllTests.class.getName());
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
@DisplayName("[Object2Model] Array of custom objects is retrieved correctly")
|
||||
public void test01() {
|
||||
ObjArrayRoot srcObj = new ObjArrayRoot();
|
||||
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).asMapped().get("member1").asSimple().getString());
|
||||
Assertions.assertEquals("value2",
|
||||
ldata.get(1).asMapped().get("member1").asSimple().getString());
|
||||
Assertions.assertEquals("value3",
|
||||
ldata.get(2).asMapped().get("member1").asSimple().getString());
|
||||
|
||||
Assertions.assertEquals(1,
|
||||
ldata.get(0).asMapped().get("member2").asSimple().getNumber().intValue());
|
||||
Assertions.assertEquals(2,
|
||||
ldata.get(1).asMapped().get("member2").asSimple().getNumber().intValue());
|
||||
Assertions.assertEquals(3,
|
||||
ldata.get(2).asMapped().get("member2").asSimple().getNumber().intValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(2)
|
||||
@DisplayName("[Object2Model] List of custom objects is retrieved correctly")
|
||||
public void test02() {
|
||||
ObjListRoot srcObj = new ObjListRoot();
|
||||
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).asMapped().get("member1").asSimple().getString());
|
||||
Assertions.assertEquals("value2",
|
||||
ldata.get(1).asMapped().get("member1").asSimple().getString());
|
||||
Assertions.assertEquals("value3",
|
||||
ldata.get(2).asMapped().get("member1").asSimple().getString());
|
||||
|
||||
Assertions.assertEquals(1,
|
||||
ldata.get(0).asMapped().get("member2").asSimple().getNumber().intValue());
|
||||
Assertions.assertEquals(2,
|
||||
ldata.get(1).asMapped().get("member2").asSimple().getNumber().intValue());
|
||||
Assertions.assertEquals(3,
|
||||
ldata.get(2).asMapped().get("member2").asSimple().getNumber().intValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(3)
|
||||
@DisplayName("[Object2Model] Set of custom objects is retrieved correctly")
|
||||
public void test03() {
|
||||
ObjSetRoot srcObj = new ObjSetRoot();
|
||||
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> expStrValues = Set.of("value1", "value2", "value3");
|
||||
Set<Integer> expIntValues = Set.of(1, 2, 3);
|
||||
for (int i = 0; i < 3; i++) {
|
||||
Assertions.assertTrue(expStrValues.contains(
|
||||
ldata.get(i).asMapped().get("member1").asSimple().getString()));
|
||||
Assertions.assertTrue(expIntValues.contains(
|
||||
ldata.get(i).asMapped().get("member2").asSimple().getNumber().intValue()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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 dxt.moe.test.mem.obj2mod.linear.objitem;
|
||||
|
||||
import dxt.moe.app.MapTo;
|
||||
|
||||
/**
|
||||
* @author indroneel
|
||||
*/
|
||||
|
||||
public class ObjArrayRoot {
|
||||
|
||||
private final SimpleObj[] values;
|
||||
|
||||
public ObjArrayRoot() {
|
||||
values = new SimpleObj[]{
|
||||
new SimpleObj("value1", 1),
|
||||
new SimpleObj("value2", 2),
|
||||
new SimpleObj("value3", 3)
|
||||
};
|
||||
}
|
||||
|
||||
@MapTo("values")
|
||||
private SimpleObj[] _values() {
|
||||
return values;
|
||||
}
|
||||
}
|
||||
@@ -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 dxt.moe.test.mem.obj2mod.linear.objitem;
|
||||
|
||||
import dxt.moe.app.MapTo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author indroneel
|
||||
*/
|
||||
|
||||
public class ObjListRoot {
|
||||
|
||||
private final List<SimpleObj> values;
|
||||
|
||||
public ObjListRoot() {
|
||||
values = List.of(
|
||||
new SimpleObj("value1", 1),
|
||||
new SimpleObj("value2", 2),
|
||||
new SimpleObj("value3", 3)
|
||||
);
|
||||
}
|
||||
|
||||
@MapTo("values")
|
||||
private List<SimpleObj> _values() {
|
||||
return values;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user