Search in sources :

Example 1 with SchemeInnerType

use of com.cubrid.cubridmanager.core.cubrid.table.model.SchemaChangeLog.SchemeInnerType in project cubrid-manager by CUBRID.

the class SchemaChangeManagerTest method testGetDDL.

/**
	 * test getting ddl
	 */
public void testGetDDL() {
    SchemaInfo schema1 = new SchemaInfo();
    schema1.setClassname(tableName);
    schema1.setOwner(owner);
    schema1.setVirtual(virtual);
    schema1.setType(type);
    DBAttribute a = new DBAttribute();
    a.setName(attributeName);
    a.setType(dataType);
    a.setInherit(inherit);
    a.setNotNull(isNotNull);
    a.setShared(false);
    a.setUnique(unique);
    a.setDefault(defaultv);
    schema1.addAttribute(a);
    schema1.addClassAttribute(a);
    Constraint pk = new Constraint(false);
    pk.setName(pkName);
    pk.setType(pkType);
    pk.addAttribute(attributes[0]);
    pk.addAttribute(attributes[1]);
    pk.addAttribute(attributes[2]);
    schema1.addConstraint(pk);
    schemaChangeManager.getChangeList();
    schemaChangeManager.isNewAdded(SchemeInnerType.TYPE_ATTRIBUTE, "value");
    schemaChangeManager.isNewAdded("attrName", true);
    schemaChangeManager.isNewAdded("attrName", false);
    schemaChangeManager.getIndexChangeLogs();
    schemaChangeManager.getFKChangeLogs();
    schemaChangeManager.getAttrChangeLogs();
    schemaChangeManager.getClassAttrChangeLogs();
    schemaChangeManager.getChangeLogs(SchemeInnerType.TYPE_ATTRIBUTE);
    schemaChangeManager.setNewTableFlag(true);
    schemaChangeManager.isNewTableFlag();
    schemaChangeManager.setDatabaseInfo(database);
    schemaChangeManager.getDatabaseInfo();
    String oldValue = "oldValue";
    String newValue = "newValue";
    SchemeInnerType stype = SchemeInnerType.TYPE_ATTRIBUTE;
    SchemaChangeLog schemeChangeLog = new SchemaChangeLog(oldValue, newValue, stype);
    changeList = new ArrayList<SchemaChangeLog>();
    changeList.add(schemeChangeLog);
    schemaChangeManager.setChangeList(changeList);
    schemaChangeManager.getChangeLogs(SchemeInnerType.TYPE_ATTRIBUTE);
    schemaChangeManager.addSchemeChangeLog(schemeChangeLog);
    schemaChangeManager.setNewTableFlag(false);
    schemaChangeManager.addSchemeChangeLog(schemeChangeLog);
    schemaChangeManager.isNewAdded(SchemeInnerType.TYPE_ATTRIBUTE, "value");
}
Also used : Constraint(com.cubrid.common.core.common.model.Constraint) DBAttribute(com.cubrid.common.core.common.model.DBAttribute) SchemeInnerType(com.cubrid.cubridmanager.core.cubrid.table.model.SchemaChangeLog.SchemeInnerType) SchemaInfo(com.cubrid.common.core.common.model.SchemaInfo)

Example 2 with SchemeInnerType

use of com.cubrid.cubridmanager.core.cubrid.table.model.SchemaChangeLog.SchemeInnerType in project cubrid-manager by CUBRID.

the class SchemeChangeLogTest method testSchemeChangeLog.

/**
	 * Test SchemeChangeLog
	 */
public void testSchemeChangeLog() {
    SchemaChangeLog schemeChangeLog = new SchemaChangeLog(oldValue, newValue, type);
    SchemeInnerType type = SchemeInnerType.TYPE_SCHEMA;
    assertEquals(type.getText(), "schema");
    type = SchemeInnerType.TYPE_ATTRIBUTE;
    assertEquals(type.getText(), "attribute");
    type = SchemeInnerType.TYPE_CLASSATTRIBUTE;
    assertEquals(type.getText(), "classattribute");
    type = SchemeInnerType.TYPE_FK;
    assertEquals(type.getText(), "fk");
    type = SchemeInnerType.TYPE_INDEX;
    assertEquals(type.getText(), "index");
    type = SchemeInnerType.TYPE_TABLE_NAME;
    assertEquals(type.getText(), "tablename");
    type = SchemeInnerType.TYPE_OWNER;
    assertEquals(type.getText(), "owner");
    type = SchemeInnerType.TYPE_SUPER_TABLE;
    assertEquals(type.getText(), "supertablename");
    type = SchemeInnerType.TYPE_PARTITION;
    assertEquals(type.getText(), "partition");
    schemeChangeLog.setOldValue(oldValue);
    schemeChangeLog.setNewValue(newValue);
    schemeChangeLog.setType(type);
    assertEquals(schemeChangeLog.getOldValue(), oldValue);
    assertEquals(schemeChangeLog.getNewValue(), newValue);
    assertEquals(schemeChangeLog.getType(), type);
    SchemeInnerType.eval("test");
}
Also used : SchemeInnerType(com.cubrid.cubridmanager.core.cubrid.table.model.SchemaChangeLog.SchemeInnerType)

Aggregations

SchemeInnerType (com.cubrid.cubridmanager.core.cubrid.table.model.SchemaChangeLog.SchemeInnerType)2 Constraint (com.cubrid.common.core.common.model.Constraint)1 DBAttribute (com.cubrid.common.core.common.model.DBAttribute)1 SchemaInfo (com.cubrid.common.core.common.model.SchemaInfo)1