use of com.orientechnologies.orient.core.metadata.schema.OProperty in project wicket-orientdb by OrienteerBAP.
the class TestFilters method testEqualsToDateFilterCriteria.
@Test
public void testEqualsToDateFilterCriteria() throws ParseException {
IModel<OProperty> property = wicket.getProperty(DATE_FIELD);
IFilterCriteriaManager manager = new FilterCriteriaManager(property);
IModel<String> model = Model.of(DATE_VALUE_1);
manager.addFilterCriteria(manager.createEqualsFilterCriteria(model, Model.of(true)));
queryModel.addFilterCriteriaManager(property.getObject().getName(), manager);
assertTrue(queryModel.size() == 1);
queryModel.clearFilterCriteriaManagers();
queryModel.detach();
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
IModel<Date> dateModel = Model.of(dateFormat.parse(DATE_VALUE_1));
manager.addFilterCriteria(manager.createEqualsFilterCriteria(dateModel, Model.of(true)));
queryModel.addFilterCriteriaManager(property.getObject().getName(), manager);
assertTrue(queryModel.size() == 1);
}
use of com.orientechnologies.orient.core.metadata.schema.OProperty in project wicket-orientdb by OrienteerBAP.
the class TestFilters method testLinkMapKey.
@Test
public void testLinkMapKey() {
String key = MAP_KEYS.get(0);
IModel<OProperty> property = wicket.getProperty(LINK_MAP_FIELD);
IFilterCriteriaManager manager = new FilterCriteriaManager(property);
manager.addFilterCriteria(manager.createMapContainsKeyCriteria(Model.of(key), Model.<Boolean>of(true)));
queryModel.addFilterCriteriaManager(LINK_MAP_FIELD, manager);
assertTrue("size must be 1 but it is - " + queryModel.getObject().size(), queryModel.getObject().size() == 1);
}
use of com.orientechnologies.orient.core.metadata.schema.OProperty in project wicket-orientdb by OrienteerBAP.
the class TestFilters method testContainsTextFilterCriteria.
@Test
public void testContainsTextFilterCriteria() {
IModel<OProperty> property = wicket.getProperty(STRING_FIELD);
IFilterCriteriaManager manager = new FilterCriteriaManager(property);
IModel<String> model = Model.of("summer");
manager.addFilterCriteria(manager.createContainsStringFilterCriteria(model, Model.of(true)));
queryModel.addFilterCriteriaManager(property.getObject().getName(), manager);
assertTrue(queryModel.size() == 1);
assertTrue(queryModel.getObject().get(0).field(STRING_FIELD).equals(STR_VALUE_2));
}
use of com.orientechnologies.orient.core.metadata.schema.OProperty in project wicket-orientdb by OrienteerBAP.
the class TestInAppOrientDBCompatibility method testPropertyRenaming.
@Test
public void testPropertyRenaming() {
ODatabaseDocument db = wicket.getTester().getDatabase();
OSchema schema = db.getMetadata().getSchema();
OClass classA = schema.createClass("TestPropertyRenaming");
OProperty property = classA.createProperty("propertyOld", OType.STRING);
assertEquals(property, classA.getProperty("propertyOld"));
assertNull(classA.getProperty("propertyNew"));
property.setName("propertyNew");
schema.reload();
classA = schema.getClass("TestPropertyRenaming");
assertNull(classA.getProperty("propertyOld"));
assertEquals(property, classA.getProperty("propertyNew"));
}
use of com.orientechnologies.orient.core.metadata.schema.OProperty in project wicket-orientdb by OrienteerBAP.
the class TestPrototypers method testOClassPrototyper.
@Test
public void testOClassPrototyper() throws Exception {
OClass newClass = OClassPrototyper.newPrototype();
assertNull(wicket.getTester().getSchema().getClass("NewClass"));
newClass.setName("NewClass");
assertEquals("NewClass", newClass.getName());
newClass.setClusterSelection(ORoundRobinClusterSelectionStrategy.NAME);
assertEquals(ORoundRobinClusterSelectionStrategy.NAME, newClass.getClusterSelection().getName());
Collection<OProperty> properties = newClass.properties();
assertNotNull(properties);
assertTrue(properties.size() == 0);
properties = newClass.declaredProperties();
assertNotNull(properties);
assertTrue(properties.size() == 0);
assertFalse(newClass.hasSuperClasses());
OClass oRoleClass = wicket.getTester().getSchema().getClass("ORole");
newClass.addSuperClass(oRoleClass);
assertTrue(newClass.hasSuperClasses());
assertTrue(newClass.getSuperClassesNames().contains("ORole"));
assertTrue(newClass.getSuperClasses().contains(oRoleClass));
assertTrue(newClass.isSubClassOf(oRoleClass));
newClass.removeSuperClass(oRoleClass);
assertFalse(newClass.hasSuperClasses());
assertFalse(newClass.isSubClassOf(oRoleClass));
// Realization
assertTrue(newClass instanceof IPrototype);
OClass realizedNewClass = ((IPrototype<OClass>) newClass).realizePrototype();
assertEquals(wicket.getTester().getSchema().getClass("NewClass"), realizedNewClass);
assertFalse(realizedNewClass instanceof IPrototype);
assertEquals("NewClass", realizedNewClass.getName());
assertEquals(ORoundRobinClusterSelectionStrategy.NAME, realizedNewClass.getClusterSelection().getName());
wicket.getTester().getSchema().dropClass(realizedNewClass.getName());
}
Aggregations