package com.orientechnologies.orient.core.metadata.schema;

import static org.testng.AssertJUnit.assertNull;
import static org.testng.AssertJUnit.assertEquals;
import org.testng.annotations.Test;

import com.orientechnologies.orient.core.db.document.ODatabaseDocument;
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx;

public class AlterPropertyTest {

  @Test
  public void testPropertyRenaming() {
    ODatabaseDocument db = new ODatabaseDocumentTx("memory:" + AlterPropertyTest.class.getSimpleName());
    db.create();
    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");
    assertNull(classA.getProperty("propertyOld"));
    assertEquals(property, classA.getProperty("propertyNew")); 
    db.drop();
  }

}

@@ -996,17 +996,743 @@
 yNew%22));
- 
+%0A    db.drop();%0A  %7D%0A%0A  @Test%0A  public void testPropertyRenamingReload() %7B%0A    ODatabaseDocument db = new ODatabaseDocumentTx(%22memory:%22 + AlterPropertyTest.class.getSimpleName());%0A    db.create();%0A    OSchema schema = db.getMetadata().getSchema();%0A    OClass classA = schema.createClass(%22TestPropertyRenaming%22);%0A    OProperty property = classA.createProperty(%22propertyOld%22, OType.STRING);%0A    assertEquals(property, classA.getProperty(%22propertyOld%22));%0A    assertNull(classA.getProperty(%22propertyNew%22));%0A    property.setName(%22propertyNew%22);%0A    schema.reload();%0A    classA = schema.getClass(%22TestPropertyRenaming%22);%0A    assertNull(classA.getProperty(%22propertyOld%22));%0A    assertEquals(property, classA.getProperty(%22propertyNew%22));
 %0A    db.

check alter property valid after schame reload, issue #3498 .