package ru.ydn.wicket.wicketorientdb.orientdb;

import org.junit.ClassRule;
import org.junit.Ignore;
import org.junit.Test;

import ru.ydn.wicket.wicketorientdb.junit.WicketOrientDbTesterScope;
import static org.junit.Assert.*;

import com.orientechnologies.orient.core.metadata.schema.OClass;
import com.orientechnologies.orient.core.metadata.schema.OSchema;
import com.orientechnologies.orient.core.metadata.schema.OType;

public class TestInAppOrientDBCompatibility
{
	@ClassRule
	public static WicketOrientDbTesterScope wicket = new WicketOrientDbTesterScope();
	
	@Test
	public void testExistsProperty()
	{
		OSchema schema = wicket.getTester().getSchema();
		OClass classA = schema.createClass("TestExistsA");
		classA.createProperty("property", OType.STRING);
		assertTrue(classA.existsProperty("property"));
		assertNotNull(classA.getProperty("property"));
		OClass classB = schema.createClass("TestExistsB", classA);
		assertNotNull(classB.getProperty("property"));
		assertTrue(classB.existsProperty("property"));
	}
}

@@ -267,30 +267,225 @@
 ore.
-metadata.schema.OClass
+db.ODatabase;%0Aimport com.orientechnologies.orient.core.db.document.ODatabaseDocument;%0Aimport com.orientechnologies.orient.core.metadata.schema.OClass;%0Aimport com.orientechnologies.orient.core.metadata.schema.OProperty
 ;%0Aim
@@ -611,16 +611,80 @@
 a.OType;
+%0Aimport com.orientechnologies.orient.core.record.impl.ODocument;
 %0A%0Apublic
@@ -1219,32 +1219,32 @@
 y(%22property%22));%0A
-
 %09%09assertTrue(cla
@@ -1279,10 +1279,1275 @@
 %22));%0A%09%7D%0A
+%09%0A%09@Test%0A%09@Ignore%0A%09public void testRemovingReadonlyField()%0A%09%7B%0A%09%09ODatabaseDocument db = wicket.getTester().getDatabase();%0A%09%09OSchema schema = db.getMetadata().getSchema();%0A%09%09OClass classA = schema.createClass(%22TestRemovingField%22);%0A%09%09classA.createProperty(%22name%22, OType.STRING);%0A%09%09OProperty property = classA.createProperty(%22property%22, OType.STRING);%0A%09%09property.setReadonly(true);%0A%09%09%0A%09%09ODocument doc = new ODocument(classA);%0A%09%09doc.field(%22name%22, %22My Name%22);%0A%09%09doc.field(%22property%22, %22value1%22);%0A%09%09doc.save();%0A%09%09%0A%09%09doc.field(%22name%22, %22My Name 2%22);%0A%09%09doc.field(%22property%22, %22value2%22);%0A%09%09doc.removeField(%22property%22);%0A%09%09doc.save();%0A%09%7D%0A%09%0A%09@Test%0A%09@Ignore%0A%09public void testRemovingReadonlyField2()%0A%09%7B%0A%09%09ODatabaseDocument db = wicket.getTester().getDatabase();%0A%09%09OSchema schema = db.getMetadata().getSchema();%0A%09%09OClass classA = schema.createClass(%22TestRemovingField2%22);%0A%09%09classA.createProperty(%22name%22, OType.STRING);%0A%09%09OProperty property = classA.createProperty(%22property%22, OType.STRING);%0A%09%09property.setReadonly(true);%0A%09%09%0A%09%09ODocument doc = new ODocument(classA);%0A%09%09doc.field(%22name%22, %22My Name%22);%0A%09%09doc.field(%22property%22, %22value1%22);%0A%09%09doc.save();%0A%09%09%0A%09%09doc.field(%22name%22, %22My Name 2%22);%0A%09%09doc.field(%22property%22, %22value2%22);%0A%09%09doc.undo();%0A%09%09doc.field(%22name%22, %22My Name 3%22);%0A%09%09doc.save();%0A%09%7D%0A
 %7D%0A

Add failed cases in orientdb