Tests

In order to perform the test for the instructions, we use the next input metamodel

Also we use the next input model

addAttribute

In the execution of the next assistance script:

import library.attributeServices.AddAttribute;
evolution myEvolutionProgram{
  fromMM:"./models/mm3.ecore"
  toMM:"mm3_evolved1.ecore" "http://uniandes.edu.co/exampleMM3_evolved1"
  toM:"m3_coevolved1.xmi"

  instruction{
    addAttribute attD3{
      className=D
      type=EInt
    }
    [EAttributeImpl theAttribute, EClassImpl theClass, EDataTypeImpl theType, ArrayList modelClassInstances]
    comments{
      "Test for adding int attribute"
    }
    assistance{
      comments{
        "Attribute initialization with int value"
      }
      AddAttribute.initializeIntValue(theAttribute,modelClassInstances);
    }
    assistance{
      comments{
        "Addition of the other int attributes"
      }
      AddAttribute.additionIntValue(theAttribute,theClass,theType,modelClassInstances);
    }
    assistance{
      comments{
        "Multiplication of the other int attributes"
      }
      AddAttribute.multiplicationIntValue(theAttribute,theClass,theType,modelClassInstances);
    }
  }

  instruction{
    addAttribute attG2{
      className=G
      type=EString
    }  
    [EAttributeImpl theAttribute, EClassImpl theClass, EDataTypeImpl theType, ArrayList modelClassInstances]
    comments{
      "Test for adding String attribute"
    }
    assistance{
      comments{
        "Attribute initialization with String value"
      }
      AddAttribute.initializeStringValue(theAttribute,modelClassInstances);
    }
    assistance{
      comments{
        "Attribute initialization with String default value"
      }
      AddAttribute.initializeStringDefaultValue(theAttribute,modelClassInstances);
    }
  }
}

For the first instruction ASIMOV presents the next wizard. With this wizard, the modeler can select one assistance to apply on several selected instances.

Once the assistance has been processed, the selected instance are removed from the wizard. Once all instances have been removed from the wizard, the modeler can finish the process.

For the second instruction ASIMOV presents the next wizard.

modifyTypeOfAttribute

In the execution of the next assistance script:

import library.attributeServices.ModifyTypeOfAttribute;
evolution myEvolutionProgram{
  fromMM:"./models/mm3.ecore"
  toMM:"mm3_evolved1.ecore" "http://uniandes.edu.co/exampleMM3_evolved1"
  toM:"m3_coevolved1.xmi"

  instruction{
    modifyTypeOfAttribute B.attB2{
      type=EString 
    }
	[EAttributeImpl theAttribute, EClassImpl theClass, EDataTypeImpl theType, ArrayList modelClassInstances, ArrayList previousVersionAttributeValues]
    comments{
      "Test for modifying type of attribute"
    }
    assistance{
      comments{
        "Attribute initialization with String value"
      }
      ModifyTypeOfAttribute.initializeStringValue(theAttribute,modelClassInstances);
    }
    assistance{
      comments{
        "Attribute initialization with String default value"
      }
      ModifyTypeOfAttribute.initializeStringDefaultValue(theAttribute,modelClassInstances);
    }
    assistance{
      comments{
        "Casting the attribute value"
      }
      ModifyTypeOfAttribute.castingAttributeValue(theAttribute,modelClassInstances,previousVersionAttributeValues);
    }
  }  

  instruction{
    modifyTypeOfAttribute H.attH2{
      type=EInt 
    }
	[EAttributeImpl theAttribute, EClassImpl theClass, EDataTypeImpl theType, ArrayList modelClassInstances, ArrayList previousVersionAttributeValues]
    comments{
      "Test for modifying type of attribute"
    }
    assistance{
      comments{
        "Attribute initialization with int value"
      }
      ModifyTypeOfAttribute.initializeIntValue(theAttribute,modelClassInstances);
    }
    assistance{
      comments{
        "Attribute initialization with int default value"
      }
      ModifyTypeOfAttribute.initializeIntDefaultValue(theAttribute,modelClassInstances);
    }
  }  
}

For the first instruction ASIMOV presents the next wizard. With this wizard, the modeler can select one assistance to apply on several selected instances.

Once the assistance has been processed, the selected instance are removed from the wizard. Once all instances have been removed from the wizard, the modeler can finish the process.
For the second instruction ASIMOV presents the next wizard.

Errors

An EnAr-ASIMOV Execution could generate the following controlled errors:

  • If the modeler attempts to perform an assistant and he/she has not selected any instances, the wizard shows a message and the process is not performed.
  • If the modeler attempts to finish the wizard, but there are already instances to assist, the wizard shows a message and the process is not performed.
asimovinstructionstest.txt · Última modificación: 2012/05/10 15:11 por ha.florez39
Departamento de Ingeniería de Sistemas y Computación - Facultad de Ingeniería - Universidad de los Andes
CC Attribution-Noncommercial-Share Alike 3.0 Unported
Valid CSS Driven by DokuWiki Recent changes RSS feed Valid XHTML 1.0