checkpointing
This commit is contained in:
@@ -29,7 +29,7 @@ import java.util.logging.Logger;
|
||||
* @author indroneel
|
||||
*/
|
||||
|
||||
@DisplayName("[Object2Model] Linear data retrieval tests")
|
||||
@DisplayName("[Object2Model] Linear data retrieval tests with integer items")
|
||||
public class AllTests extends MemObj2ModTests {
|
||||
|
||||
private static final Logger L = Logger.getLogger(AllTests.class.getName());
|
||||
|
||||
@@ -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 daxi.moe.test.mem.obj2mod.linear.objitem;
|
||||
|
||||
import daxi.moe.model.AnyData;
|
||||
import daxi.moe.model.LinearData;
|
||||
import daxi.moe.test.mem.obj2mod.MemObj2ModTests;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Order;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* @author indroneel
|
||||
*/
|
||||
|
||||
@DisplayName("[Object2Model] Linear data retrieval tests 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 daxi.moe.test.mem.obj2mod.linear.objitem;
|
||||
|
||||
import daxi.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 daxi.moe.test.mem.obj2mod.linear.objitem;
|
||||
|
||||
import daxi.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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) DuxTechnica
|
||||
*
|
||||
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||
* contacting:
|
||||
*
|
||||
* Dux Technica, [email protected]
|
||||
*
|
||||
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
* either express or implied. See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package daxi.moe.test.mem.obj2mod.linear.objitem;
|
||||
|
||||
import daxi.moe.app.MapTo;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author indroneel
|
||||
*/
|
||||
|
||||
public class ObjSetRoot {
|
||||
|
||||
private final Set<SimpleObj> values;
|
||||
|
||||
public ObjSetRoot() {
|
||||
values = Set.of(
|
||||
new SimpleObj("value1", 1),
|
||||
new SimpleObj("value2", 2),
|
||||
new SimpleObj("value3", 3)
|
||||
);
|
||||
}
|
||||
|
||||
@MapTo("values")
|
||||
private Set<SimpleObj> _values() {
|
||||
return values;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) DuxTechnica
|
||||
*
|
||||
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||
* contacting:
|
||||
*
|
||||
* Dux Technica, [email protected]
|
||||
*
|
||||
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
* either express or implied. See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package daxi.moe.test.mem.obj2mod.linear.objitem;
|
||||
|
||||
import daxi.moe.app.MapTo;
|
||||
|
||||
/**
|
||||
* @author indroneel
|
||||
*/
|
||||
|
||||
public class SimpleObj {
|
||||
|
||||
private final String member1;
|
||||
private final int member2;
|
||||
|
||||
public SimpleObj(String val1, int val2) {
|
||||
member1 = val1;
|
||||
member2 = val2;
|
||||
}
|
||||
|
||||
@MapTo("member1")
|
||||
private String _member1() {
|
||||
return member1;
|
||||
}
|
||||
|
||||
@MapTo("member2")
|
||||
private int _member2() {
|
||||
return member2;
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@ import java.util.logging.Logger;
|
||||
* @author indroneel
|
||||
*/
|
||||
|
||||
@DisplayName("[Object2Model] Linear data retrieval tests")
|
||||
@DisplayName("[Object2Model] Linear data retrieval tests with string items")
|
||||
public class AllTests extends MemObj2ModTests {
|
||||
|
||||
private static final Logger L = Logger.getLogger(AllTests.class.getName());
|
||||
|
||||
Reference in New Issue
Block a user