use of org.eclipse.persistence.testing.models.collections.map.AggregateMapKey in project eclipselink by eclipse-ee4j.
the class MapCollectionsTestModel method getDirectMapMappingTestSuite.
public static TestSuite getDirectMapMappingTestSuite() {
TestSuite suite = new TestSuite();
suite.setName("Direct Map Mapping Map Test Suite");
suite.setDescription("This suite tests using DirectMapMapping with different types of keys.");
// Read
suite.addTest(new TestReadDirectDirectMapMapping());
suite.addTest(new TestReadAggregateDirectMapMapping());
suite.addTest(new TestReadEntityDirectMapMapping());
// Update
suite.addTest(new TestUpdateDirectDirectMapMapping());
suite.addTest(new TestUpdateAggregateDirectMapMapping());
suite.addTest(new TestUpdateEntityDirectMapMapping());
// Private Owned - DirectMapMappings are automatically private owned
// as a result, the only relevant test here is one with an EntityKey
suite.addTest(new TestUpdateEntityDirectMapMapping(true));
// Join
suite.addTest(new TestReadDirectDirectMapMapping(ForeignReferenceMapping.INNER_JOIN));
suite.addTest(new TestReadAggregateDirectMapMapping(ForeignReferenceMapping.INNER_JOIN));
suite.addTest(new TestReadEntityDirectMapMapping(ForeignReferenceMapping.INNER_JOIN));
// Expressions
ReadAllExpressionTest test = new ReadAllExpressionTest(DirectDirectMapHolder.class, 1);
ExpressionBuilder holders = new ExpressionBuilder();
Expression exp = holders.anyOf("directToDirectMap").mapKey().equal(1);
test.setExpression(exp);
suite.addTest(test);
test = new ReadAllExpressionTest(AggregateDirectMapHolder.class, 1);
AggregateMapKey aggkey = new AggregateMapKey();
aggkey.setKey(11);
holders = new ExpressionBuilder();
exp = holders.anyOf("aggregateToDirectMap").mapKey().equal(aggkey);
test.setExpression(exp);
suite.addTest(test);
test = new ReadAllExpressionTest(EntityDirectMapHolder.class, 1);
EntityMapKey entKey = new EntityMapKey();
entKey.setId(333);
entKey.setData("data3");
holders = new ExpressionBuilder();
exp = holders.anyOf("entityToDirectMap").mapKey().equal(entKey);
test.setExpression(exp);
suite.addTest(test);
return suite;
}
use of org.eclipse.persistence.testing.models.collections.map.AggregateMapKey in project eclipselink by eclipse-ee4j.
the class MapCollectionsTestModel method getUnidirectionalOneToManyMappingTestSuite.
public static TestSuite getUnidirectionalOneToManyMappingTestSuite() {
TestSuite suite = new TestSuite();
suite.setName("UnidirectionalOneToManyMapping Map Test Suite");
suite.setDescription("This suite tests using UnidirectionalOneToManyMapping with a Map");
// Read
suite.addTest(new TestReadDirectEntityU1MMapMapping());
suite.addTest(new TestReadAggregateEntityU1MMapMapping());
suite.addTest(new TestReadEntityEntityU1MMapMapping());
// Update
suite.addTest(new TestUpdateDirectEntityU1MMapMapping());
suite.addTest(new TestUpdateAggregateEntityU1MMapMapping());
suite.addTest(new TestUpdateEntityEntityU1MMapMapping());
// Private Owned
suite.addTest(new TestUpdateDirectEntityU1MMapMapping(true));
suite.addTest(new TestUpdateAggregateEntityU1MMapMapping(true));
suite.addTest(new TestUpdateEntityEntityU1MMapMapping(true));
// Joining
suite.addTest(new TestReadDirectEntityU1MMapMapping(ForeignReferenceMapping.INNER_JOIN));
suite.addTest(new TestReadAggregateEntityU1MMapMapping(ForeignReferenceMapping.INNER_JOIN));
suite.addTest(new TestReadEntityEntityU1MMapMapping(ForeignReferenceMapping.INNER_JOIN));
// Expressions
ReadAllExpressionTest test = new ReadAllExpressionTest(DirectEntityU1MMapHolder.class, 1);
ExpressionBuilder holders = new ExpressionBuilder();
Expression exp = holders.anyOf("directToEntityMap").mapKey().equal(11);
test.setExpression(exp);
suite.addTest(test);
test = new ReadAllExpressionTest(AggregateEntityU1MMapHolder.class, 1);
AggregateMapKey aggkey = new AggregateMapKey();
aggkey.setKey(11);
holders = new ExpressionBuilder();
exp = holders.anyOf("aggregateToEntityMap").mapKey().equal(aggkey);
test.setExpression(exp);
suite.addTest(test);
test = new ReadAllExpressionTest(EntityEntityU1MMapHolder.class, 1);
EntityMapKey entKey = new EntityMapKey();
entKey.setId(999);
entKey.setData("data9");
holders = new ExpressionBuilder();
exp = holders.anyOf("entityToEntityMap").mapKey().equal(entKey);
test.setExpression(exp);
suite.addTest(test);
return suite;
}
use of org.eclipse.persistence.testing.models.collections.map.AggregateMapKey in project eclipselink by eclipse-ee4j.
the class MapCollectionsTestModel method getOneToManyMappingTestSuite.
public static TestSuite getOneToManyMappingTestSuite() {
TestSuite suite = new TestSuite();
suite.setName("OneToManyMapping Map Test Suite");
suite.setDescription("This suite tests using OneToManyMapping with a Map");
// Read
suite.addTest(new TestReadDirectEntity1MMapMapping());
suite.addTest(new TestReadAggregateEntity1MMapMapping());
suite.addTest(new TestReadEntityEntity1MMapMapping());
// Update
suite.addTest(new TestUpdateDirectEntity1MMapMapping());
suite.addTest(new TestUpdateAggregateEntity1MMapMapping());
suite.addTest(new TestUpdateEntityEntity1MMapMapping());
// Private Owned
suite.addTest(new TestUpdateDirectEntity1MMapMapping(true));
suite.addTest(new TestUpdateAggregateEntity1MMapMapping(true));
suite.addTest(new TestUpdateEntityEntity1MMapMapping(true));
// Joining
suite.addTest(new TestReadDirectEntity1MMapMapping(ForeignReferenceMapping.INNER_JOIN));
suite.addTest(new TestReadAggregateEntity1MMapMapping(ForeignReferenceMapping.INNER_JOIN));
suite.addTest(new TestReadEntityEntity1MMapMapping(ForeignReferenceMapping.INNER_JOIN));
// Expressions
ReadAllExpressionTest test = new ReadAllExpressionTest(DirectEntity1MMapHolder.class, 1);
ExpressionBuilder holders = new ExpressionBuilder();
Expression exp = holders.anyOf("directToEntityMap").mapKey().equal(11);
test.setExpression(exp);
suite.addTest(test);
test = new ReadAllExpressionTest(AggregateEntity1MMapHolder.class, 1);
AggregateMapKey aggkey = new AggregateMapKey();
aggkey.setKey(11);
holders = new ExpressionBuilder();
exp = holders.anyOf("aggregateToEntityMap").mapKey().equal(aggkey);
test.setExpression(exp);
suite.addTest(test);
test = new ReadAllExpressionTest(AggregateEntity1MMapHolder.class, 1);
holders = new ExpressionBuilder();
exp = holders.anyOf("aggregateToEntityMap").mapKey().get("key").equal(11);
test.setExpression(exp);
suite.addTest(test);
test = new ReadAllExpressionTest(EntityEntity1MMapHolder.class, 1);
EntityMapKey entKey = new EntityMapKey();
entKey.setId(555);
entKey.setData("data5");
holders = new ExpressionBuilder();
exp = holders.anyOf("entityToEntityMap").mapKey().equal(entKey);
test.setExpression(exp);
suite.addTest(test);
test = new ReadAllExpressionTest(EntityEntity1MMapHolder.class, 1);
holders = new ExpressionBuilder();
exp = holders.anyOf("entityToEntityMap").mapKey().get("data").equal("data5");
test.setExpression(exp);
suite.addTest(test);
suite.addTest(new MapKeyDirectEntity1MReportQueryTestCase());
suite.addTest(new MapKeyAggregateEntity1MReportQueryTestCase());
suite.addTest(new MapKeyEntityEntity1MReportQueryTestCase());
suite.addTest(new MapEntryDirectEntity1MReportQueryTest());
suite.addTest(new InMemoryDirectEntity1MTest());
return suite;
}
use of org.eclipse.persistence.testing.models.collections.map.AggregateMapKey in project eclipselink by eclipse-ee4j.
the class MapCollectionsTestModel method getManyToManyMappingTestSuite.
public static TestSuite getManyToManyMappingTestSuite() {
TestSuite suite = new TestSuite();
suite.setName("ManyToManyMapping Map Test Suite");
suite.setDescription("This suite tests using ManyToManyMapping with a Map");
// Read
suite.addTest(new TestReadDirectEntityMapMapping());
suite.addTest(new TestReadAggregateEntityMapMapping());
suite.addTest(new TestReadEntityEntityMapMapping());
// Update
suite.addTest(new TestUpdateDirectEntityMapMapping());
suite.addTest(new TestUpdateAggregateEntityMapMapping());
suite.addTest(new TestUpdateEntityEntityMapMapping());
// private owned
suite.addTest(new TestUpdateDirectEntityMapMapping(true));
suite.addTest(new TestUpdateAggregateEntityMapMapping(true));
suite.addTest(new TestUpdateEntityEntityMapMapping(true));
// Joining
suite.addTest(new TestReadDirectEntityMapMapping(ForeignReferenceMapping.INNER_JOIN));
suite.addTest(new TestReadAggregateEntityMapMapping(ForeignReferenceMapping.INNER_JOIN));
suite.addTest(new TestReadEntityEntityMapMapping(ForeignReferenceMapping.INNER_JOIN));
// Expressions
ReadAllExpressionTest test = new ReadAllExpressionTest(DirectEntityMapHolder.class, 1);
ExpressionBuilder holders = new ExpressionBuilder();
Expression exp = holders.anyOf("directToEntityMap").mapKey().equal(11);
test.setExpression(exp);
suite.addTest(test);
test = new ReadAllExpressionTest(AggregateEntityMapHolder.class, 1);
AggregateMapKey aggkey = new AggregateMapKey();
aggkey.setKey(11);
holders = new ExpressionBuilder();
exp = holders.anyOf("aggregateToEntityMap").mapKey().equal(aggkey);
test.setExpression(exp);
suite.addTest(test);
test = new ReadAllExpressionTest(EntityEntityMapHolder.class, 1);
EntityMapKey entKey = new EntityMapKey();
entKey.setId(777);
entKey.setData("data7");
holders = new ExpressionBuilder();
exp = holders.anyOf("entityToEntityMap").mapKey().equal(entKey);
test.setExpression(exp);
suite.addTest(test);
return suite;
}
use of org.eclipse.persistence.testing.models.collections.map.AggregateMapKey in project eclipselink by eclipse-ee4j.
the class TestUpdateAggregateDirectMapMapping method verify.
@Override
public void verify() {
getSession().getIdentityMapAccessor().initializeIdentityMaps();
Object changedHolder = holders.get(0);
holders = getSession().readAllObjects(AggregateDirectMapHolder.class, holderExp);
AggregateDirectMapHolder holder = (AggregateDirectMapHolder) holders.get(0);
if (!compareObjects(holder, changedHolder)) {
throw new TestErrorException("Objects do not match reinitialize");
}
AggregateMapKey mapKey = new AggregateMapKey();
mapKey.setKey(1);
if (holder.getAggregateToDirectMap().containsKey(mapKey)) {
throw new TestErrorException("Item that was removed is still present in map.");
}
mapKey = new AggregateMapKey();
mapKey.setKey(3);
Integer value = (Integer) holder.getAggregateToDirectMap().get(mapKey);
if (value != 3) {
throw new TestErrorException("Item was not correctly added to map");
}
}
Aggregations