public void testCanRenameAndCanDeleteCurrentStateAttribute() { Attribute_c attr[] = Attribute_c.getManyO_ATTRsOnR102( testClass, new findAttributeUsingName("current_state")); // $NON-NLS-1$ Attribute_c deleteable = null; assertNotNull(attr); for (int i = 0; i < attr.length; i++) { DataType_c dt = DataType_c.getOneS_DTOnR114(attr[i]); if (dt.getName().equals("state<State_Model>")) { // $NON-NLS-1$ assertFalse(attr[i].Candelete()); assertFalse(attr[i].Canrename()); } else { deleteable = attr[i]; assertTrue(attr[i].Candelete()); assertTrue(attr[i].Canrename()); } } // Getting datatype of deleteable current_state DataType_c adt = DataType_c.getOneS_DTOnR114(deleteable); adt.setName("state<State_Model>"); // $NON-NLS-1$ // Now all attributes with current_state are deleteable. for (int i = 0; i < attr.length; i++) { assertTrue(attr[i].Candelete()); assertTrue(attr[i].Canrename()); } isDone = true; }
public void testGlobalMigrationAttributeDomain() throws Exception { Ooaofooa testRoot = Ooaofooa.getInstance("/model_upgrade/models/model_upgrade/domain/domain.xtuml"); Attribute_c param = Attribute_c.AttributeInstance( testRoot, new ClassQueryInterface_c() { @Override public boolean evaluate(Object candidate) { return ((Attribute_c) candidate).getName().equals("attribute"); } }); assertNotNull("Unable to locate test element", param); DataType_c dt = DataType_c.getOneS_DTOnR114(param); assertNotNull("Unable to locate test element", dt); GlobalElementInSystem_c gis = GlobalElementInSystem_c.getOneG_EISOnR9100(PackageableElement_c.getOnePE_PEOnR8001(dt)); assertNotNull("Attribute was not migrated to use globals.", gis); assertTrue( "Incorrect data type associated with Attribute after global migration", dt.getName().equals("boolean")); }