use of org.apache.cayenne.configuration.DataChannelDescriptor in project cayenne by apache.
the class UpgradeHandler_V10Test method testModelUpgrade.
@Test
public void testModelUpgrade() throws Exception {
DataChannelDescriptor descriptor = mock(DataChannelDescriptor.class);
handler.processModel(descriptor);
verifyZeroInteractions(descriptor);
}
use of org.apache.cayenne.configuration.DataChannelDescriptor in project cayenne by apache.
the class UpgradeHandler_V7Test method testModelUpgrade.
@Test
public void testModelUpgrade() throws Exception {
DataChannelDescriptor descriptor = mock(DataChannelDescriptor.class);
DataMap map = new DataMap();
when(descriptor.getDataMaps()).thenReturn(Collections.singletonList(map));
ObjEntity superEntity = new ObjEntity("super");
superEntity.addAttribute(new ObjAttribute("super"));
superEntity.addAttribute(new ObjAttribute("simple"));
map.addObjEntity(superEntity);
ObjEntity subEntity = new ObjEntity("sub");
subEntity.setSuperEntityName("super");
subEntity.addAttribute(new ObjAttribute("super"));
subEntity.addAttribute(new ObjAttribute("simple_sub"));
map.addObjEntity(subEntity);
assertNotNull(superEntity.getDeclaredAttribute("super"));
assertNotNull(subEntity.getDeclaredAttribute("super"));
handler.processModel(descriptor);
assertNotNull(superEntity.getDeclaredAttribute("super"));
assertNull(subEntity.getDeclaredAttribute("super"));
verify(descriptor).getDataMaps();
verifyNoMoreInteractions(descriptor);
}
use of org.apache.cayenne.configuration.DataChannelDescriptor in project cayenne by apache.
the class UpgradeHandler_V8Test method testModelUpgrade.
@Test
public void testModelUpgrade() throws Exception {
DataChannelDescriptor descriptor = mock(DataChannelDescriptor.class);
handler.processModel(descriptor);
verifyZeroInteractions(descriptor);
}
use of org.apache.cayenne.configuration.DataChannelDescriptor in project cayenne by apache.
the class UpgradeHandler_V9Test method testModelUpgrade.
@Test
public void testModelUpgrade() throws Exception {
DataChannelDescriptor descriptor = mock(DataChannelDescriptor.class);
handler.processModel(descriptor);
verifyZeroInteractions(descriptor);
}
use of org.apache.cayenne.configuration.DataChannelDescriptor in project cayenne by apache.
the class BaseQueryValidator method validateName.
void validateName(QueryDescriptor query, ValidationResult validationResult) {
final String name = query.getName();
// Must have name
if (Util.isEmptyString(name)) {
addFailure(validationResult, query, "Unnamed " + query.getType());
return;
}
DataMap map = query.getDataMap();
if (map == null) {
return;
}
// check for duplicate names in the parent context
if (hasDuplicateQueryDescriptorInDataMap(query, map)) {
addFailure(validationResult, query, "Duplicate query name: %s", name);
return;
}
DataChannelDescriptor domain = query.getDataMap().getDataChannelDescriptor();
if (domain == null) {
return;
}
// check for duplicate names in sibling contexts
for (DataMap nextMap : domain.getDataMaps()) {
if (nextMap == map) {
continue;
}
if (hasDuplicateQueryDescriptorInDataMap(query, nextMap)) {
addFailure(validationResult, query, "Duplicate %s name in another DataMap: %s", query.getType(), name);
return;
}
}
}
Aggregations