use of ru.ydn.wicket.wicketorientdb.model.OPropertyModel in project wicket-orientdb by OrienteerBAP.
the class TestModels method testOPropertyModel.
@Test
public void testOPropertyModel() {
OProperty userNameProperty = wicket.getTester().getSchema().getClass("OUser").getProperty("name");
OPropertyModel propertyModel = new OPropertyModel("OUser", "name");
assertModelObjectEquals(userNameProperty, propertyModel);
// Test for null
propertyModel.setObject(null);
assertModelObjectEquals(null, propertyModel);
// Test for classRename
OClass newClass = wicket.getTester().getSchema().createClass("TestRenameOProperty");
OProperty property = newClass.createProperty("newProperty", OType.STRING);
propertyModel.setObject(property);
assertModelObjectEquals(property, propertyModel);
property.setName("newProperty2");
assertModelObjectEquals(property, propertyModel);
}
use of ru.ydn.wicket.wicketorientdb.model.OPropertyModel in project wicket-orientdb by OrienteerBAP.
the class TestModels method testOPropertyNamingModel.
@Test
public void testOPropertyNamingModel() {
IModel<String> classNameModel = Model.of("OUser");
IModel<OClass> oClassModel = new OClassModel(classNameModel);
IModel<OProperty> propertyModel = new OPropertyModel(oClassModel, "name");
OPropertyNamingModel model = new OPropertyNamingModel(propertyModel);
assertModelObjectEquals("Name", model);
model.detach();
classNameModel.setObject("ORole");
assertModelObjectEquals("Role Name", model);
}
use of ru.ydn.wicket.wicketorientdb.model.OPropertyModel in project wicket-orientdb by OrienteerBAP.
the class TestModels method testODocumentLinksDataProvider.
@Test
public void testODocumentLinksDataProvider() {
ODocument doc1 = new ODocument("ClassA");
doc1.field("name", "doc1Ext");
doc1.save();
ODocument doc2 = new ODocument("ClassA");
doc2.field("name", "doc2Ext");
doc2.field("other", Arrays.asList(doc1));
try {
ODocumentModel documentModel = new ODocumentModel(doc2);
OPropertyModel propertyModel = new OPropertyModel("ClassA", "other");
ODocumentLinksDataProvider provider = new ODocumentLinksDataProvider(documentModel, propertyModel);
assertEquals(1, provider.size());
assertEquals(doc1, provider.iterator(0, 1).next());
doc2.save();
provider.detach();
assertEquals(1, provider.size());
assertEquals(doc1, provider.iterator(0, 1).next());
} finally {
doc1.delete();
doc2.delete();
}
}
Aggregations