public void testGlobalMigrationOperationParameterDomain() throws Exception { Ooaofooa testRoot = Ooaofooa.getInstance("/model_upgrade/models/model_upgrade/domain/domain.xtuml"); OperationParameter_c param = OperationParameter_c.OperationParameterInstance(testRoot); assertNotNull("Unable to locate test element", param); DataType_c dt = DataType_c.getOneS_DTOnR118(param); assertNotNull("Unable to locate test element", dt); GlobalElementInSystem_c gis = GlobalElementInSystem_c.getOneG_EISOnR9100(PackageableElement_c.getOnePE_PEOnR8001(dt)); assertNotNull("OperationParameter was not migrated to use globals.", gis); assertTrue( "Incorrect data type associated with OperationParameter after global migration", dt.getName().equals("inst_ref<Timer>")); }
public void testGlobalMigrationSymbolicConstantDomain() throws Exception { Ooaofooa testRoot = Ooaofooa.getInstance("/model_upgrade/models/model_upgrade/domain/domain.xtuml"); SymbolicConstant_c param = SymbolicConstant_c.SymbolicConstantInstance(testRoot); assertNotNull("Unable to locate test element", param); DataType_c dt = DataType_c.getOneS_DTOnR1500(param); assertNotNull("Unable to locate test element", dt); GlobalElementInSystem_c gis = GlobalElementInSystem_c.getOneG_EISOnR9100(PackageableElement_c.getOnePE_PEOnR8001(dt)); assertNotNull("SymbolicConstant was not migrated to use globals.", gis); assertTrue( "Incorrect data type associated with SymbolicConstant after global migration", dt.getName().equals("string")); }
public void testGlobalMigrationInterfaceOperation() throws Exception { Ooaofooa testRoot = Ooaofooa.getInstance( "/model_upgrade/models/model_upgrade/InterfacePackage/InterfacePackage.xtuml"); InterfaceOperation_c param = InterfaceOperation_c.InterfaceOperationInstance(testRoot); assertNotNull("Unable to locate test element", param); DataType_c dt = DataType_c.getOneS_DTOnR4008(param); assertNotNull("Unable to locate test element", dt); GlobalElementInSystem_c gis = GlobalElementInSystem_c.getOneG_EISOnR9100(PackageableElement_c.getOnePE_PEOnR8001(dt)); assertNotNull("InterfaceOperation was not migrated to use globals.", gis); assertTrue( "Incorrect data type associated with InterfaceOperation after global migration", dt.getName().equals("real")); }
public void testGlobalMigrationUserDataTypeComponent() throws Exception { Ooaofooa testRoot = Ooaofooa.getInstance( "/model_upgrade/models/model_upgrade/ComponentPackage/ComponentPackage.xtuml"); UserDataType_c param = UserDataType_c.UserDataTypeInstance(testRoot); assertNotNull("Unable to locate test element", param); DataType_c dt = DataType_c.getOneS_DTOnR18(param); assertNotNull("Unable to locate test element", dt); GlobalElementInSystem_c gis = GlobalElementInSystem_c.getOneG_EISOnR9100(PackageableElement_c.getOnePE_PEOnR8001(dt)); assertNotNull("UserDataType was not migrated to use globals.", gis); assertTrue( "Incorrect data type associated with UserDataType after global migration", dt.getName().equals("boolean")); }
public void testFormalizedComponentClassOperationDTAssignement() throws CoreException { Component_c component = Component_c.ComponentInstance( modelRoot, new ClassQueryInterface_c() { public boolean evaluate(Object candidate) { return ((Component_c) candidate).getName().equals("IF Scope Test Component"); } }); assertNotNull(component); if (!component.Isformal()) formalizeComponent(component); Operation_c op = Operation_c.OperationInstance(modelRoot); OperationO_TFRPropertySource ps = new OperationO_TFRPropertySource(op); ps.getPropertyDescriptors(); ps.setPropertyValue("DataType", "component_ref"); DataType_c dt = DataType_c.getOneS_DTOnR116(op); SystemModel_c testSys = null; if (testGlobals) { testSys = SystemModel_c.getOneS_SYSOnR9100( GlobalElementInSystem_c.getOneG_EISOnR9100( PackageableElement_c.getOnePE_PEOnR8001(dt))); } else { testSys = SystemModel_c.getOneS_SYSOnR4402(SystemDatatypeInPackage_c.getOneSLD_SDINPOnR4401(dt)); } assertTrue("The chosen dt was not a system level one as expected.", testSys != null); }
public void testGlobalMigrationStateMachineEventDataItemComponent() throws Exception { Ooaofooa testRoot = Ooaofooa.getInstance( "/model_upgrade/models/model_upgrade/ComponentPackage/ComponentPackage.xtuml"); StateMachineEventDataItem_c param = StateMachineEventDataItem_c.StateMachineEventDataItemInstance(testRoot); assertNotNull("Unable to locate test element", param); DataType_c dt = DataType_c.getOneS_DTOnR524(param); assertNotNull("Unable to locate test element", dt); GlobalElementInSystem_c gis = GlobalElementInSystem_c.getOneG_EISOnR9100(PackageableElement_c.getOnePE_PEOnR8001(dt)); assertNotNull("StateMachineEventDataItem was not migrated to use globals.", gis); assertTrue( "Incorrect data type associated with StateMachineEventDataItem after global migration", dt.getName().equals("timestamp")); }
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; }
/* * Validate the input against the underlying type. */ public static String isValueValid(String newValue) { IStructuredSelection currentSelection = Selection.getInstance().getStructuredSelection(); Object context = currentSelection.iterator().next(); LiteralSymbolicConstant_c v_lsc = (LiteralSymbolicConstant_c) context; SymbolicConstant_c v_symConst = SymbolicConstant_c.getOneCNST_SYCOnR1502( LeafSymbolicConstant_c.getOneCNST_LFSCOnR1503(v_lsc)); DataType_c v_dt = DataType_c.getOneS_DTOnR1500(v_symConst); return InputValueValidator.isValid(v_dt, newValue); }
public void testGlobalMigrationBridgeParameterDomain() throws Exception { Ooaofooa testRoot = Ooaofooa.getInstance("/model_upgrade/models/model_upgrade/domain/domain.xtuml"); BridgeParameter_c param = BridgeParameter_c.BridgeParameterInstance( testRoot, new ClassQueryInterface_c() { @Override public boolean evaluate(Object candidate) { return ((BridgeParameter_c) candidate).getName().equals("message"); } }); assertNotNull("Unable to locate test element", param); DataType_c dt = DataType_c.getOneS_DTOnR22(param); assertNotNull("Unable to locate test element", dt); GlobalElementInSystem_c gis = GlobalElementInSystem_c.getOneG_EISOnR9100(PackageableElement_c.getOnePE_PEOnR8001(dt)); assertNotNull("BridgeParameter was not migrated to use globals.", gis); assertTrue( "Incorrect data type associated with BridgeParameter after global migration", dt.getName().equals("string")); }
public void testGlobalMigrationAttributeComponent() throws Exception { Ooaofooa testRoot = Ooaofooa.getInstance( "/model_upgrade/models/model_upgrade/ComponentPackage/ComponentPackage.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")); }
/** * Creates void and integer data types for the given model-root (which is presumed to not already * possess them), which are to be used with the given domain (which may be null). * * <p>This is useful for tests that don't load a model, but instead directly create all the model * elements they manipulate. */ public static void createMockDefaultDataTypes(Ooaofooa modelRoot, Domain_c forDomain) { // create a void data type DataType_c dataType = new DataType_c(modelRoot); dataType.setName("void"); dataType.relateAcrossR14To(forDomain); dataType.relateAcrossR17To(new CoreDataType_c(modelRoot)); // create an integer data type dataType = new DataType_c(modelRoot); dataType.setName("integer"); dataType.relateAcrossR14To(forDomain); dataType.relateAcrossR17To(new CoreDataType_c(modelRoot)); }
public void testCanRenameAndCanDeleteUserDatatype() { class findUserDatatype implements ClassQueryInterface_c { findUserDatatype(String aname) { name = aname; } private String name; public boolean evaluate(Object candidate) { UserDataType_c selected = (UserDataType_c) candidate; return selected.Get_name().equals(name); } } UserDataType_c udt1 = UserDataType_c.getOneS_UDTOnR17( DataType_c.getManyS_DTsOnR8001( PackageableElement_c.getManyPE_PEsOnR8000(Package_c.getManyEP_PKGsOnR1405(m_sys))), new findUserDatatype("test")); // $NON-NLS-1$ assertTrue(udt1.Canrename()); assertTrue(udt1.Candelete()); }