Package net.sf.jmd.metarepresentation.impl

Examples of net.sf.jmd.metarepresentation.impl.ModelItem


        model = new Model();
        other = new Model();
    }

    public void setUp() {
        IModelItem item = new ModelItem();
        item.setName("anItem");
        item.setNamespace("de.dlr.modi");
        item.setType("interface");
       
        Operation operation = new Operation();
        operation.setName("anOperation");
        operation.setNamespace(item.getIdentifier());
       
        Parameter parameter = new Parameter();
        parameter.setName("aParameter");
        parameter.setNamespace(operation.getIdentifier());
       
        operation.addParameter(parameter);
       
        Variable variable = new Variable();
        variable.setName("aVariable");
        variable.setNamespace(item.getIdentifier());

        item.addMember(operation);
        item.addMember(variable);
       
        //these two models are equal
        model.addModelItem(item);
        other.addModelItem(item);
    }
View Full Code Here


    }
   
    public void testAddModelItem(){
        IModel newModel = new Model();
        assertTrue(newModel.getItems().isEmpty());
        ModelItem newItem = new ModelItem();
        newModel.addModelItem(newItem);
        assertTrue(newModel.getItems().contains(newItem));
    }
View Full Code Here

        other.setRevision("r123");
        assertTrue(model.equals(other));

        //items
        assertTrue(model.equals(other));
        ModelItem newItem = new ModelItem();
        newItem.setName("anIdentifier");
        newItem.setType("interface");
       
        Operation operation = new Operation();
        operation.setName("voidFoo");
        operation.setNamespace(newItem.getIdentifier());
        newItem.addMember(operation);
       
        model.addModelItem(newItem);
        assertFalse(model.equals(other));
       
        other.addModelItem(newItem);
View Full Code Here

   
    public void testEqualsAfterInterfaceAdded() {
        assertEquals(model, other);
       
        ModelItem amItem = new ModelItem();
        amItem.setName("anotherInterface");
        amItem.setType("interface");
       
        Operation amOperation = new Operation();
        amOperation.setName("anotherMethod");
        amOperation.setNamespace(amItem.getIdentifier());
       
        Parameter amParameter = new Parameter();
        amParameter.setName("aParameter");
        amParameter.setNamespace(amOperation.getIdentifier());
       
        amOperation.addParameter(amParameter);
        amItem.addMember(amOperation);
        model.addModelItem(amItem);
       
        assertFalse(model.equals(other));
       
        ModelItem dmItem = new ModelItem();
        dmItem.setName("anotherInterface");
        dmItem.setType("interface");
       
        Operation dmOperation = new Operation();
        dmOperation.setName("anotherMethod");
        dmOperation.setNamespace(dmItem.getIdentifier());
       
        Parameter dmParameter = new Parameter();
        dmParameter.setName("aParameter");
        dmParameter.setNamespace(dmOperation.getIdentifier());
       
        dmOperation.addParameter(dmParameter);
        dmItem.addMember(dmOperation);
        other.addModelItem(dmItem);
       
        assertTrue(model.equals(other));
       
        //now the developer adds a parameter to the method:
View Full Code Here

     * Test method for {@link de.dlr.sistec.modi.metarepresentation.impl
     *          .Parameter#setType(de.dlr.sistec.modi.metarepresentation.impl
     *          .ModelItem)}.
     */
    public void testSetType() {
        ModelItem newType = new ModelItem();
        parameter.setType(newType);
        assertSame(newType, parameter.getType());
    }
View Full Code Here

public class ModelItemTest extends TestCase {

    ModelItem modelItem;

    public void setUp() {
        modelItem = new ModelItem();
    }
View Full Code Here

     * Test method for
     * {@link de.dlr.sistec.modi.metarepresentation.impl.ModelItem#equals(java.
     * lang.Object)}.
     */
    public void testEquals() {
        ModelItem other = new ModelItem();

        assertFalse(modelItem.equals(null));
        assertTrue(modelItem.equals(modelItem));
        assertTrue(modelItem.equals(other));

        modelItem.setName("IModelItem");
        assertFalse(modelItem.equals(other));
        other.setName("IModelItem");
        assertTrue(modelItem.equals(other));

        modelItem.setNamespace("de.dlr.sistec.modi");
        assertFalse(modelItem.equals(other));
        other.setNamespace("de.dlr.sistec.modi");
        assertTrue(modelItem.equals(other));

        modelItem.setType("interface");
        assertFalse(modelItem.equals(other));
        other.setType("interface");
        assertTrue(modelItem.equals(other));

        modelItem.addExtendee(new ModelItem());
        assertFalse(modelItem.equals(other));
        other.addExtendee(new ModelItem());
        assertTrue(modelItem.equals(other));

        //operation
        Operation modelItemOperation = new Operation();
        modelItem.addMember(modelItemOperation);
        assertFalse(modelItem.equals(other));

        Operation othersOperation = new Operation();
        other.addMember(othersOperation);
        assertTrue(modelItem.equals(other));
       
        Parameter modelItemParameter = new Parameter();
        modelItemOperation.addParameter(modelItemParameter);
        assertFalse(modelItem.equals(other));
View Full Code Here

    /**
     * <b>The equals method is reflexive:</b> for any reference value x,
     * x.equals(x) should return true.
     */
    public void testEqualsReflexive() {
        ModelItem x = new ModelItem();
        assertTrue(x.equals(x));
    }
View Full Code Here

    /**
     * <b>The equals method is symmetric:</b> for any reference values x and y,
     * x.equals(y) should return true if and only if y.equals(x) returns true.
     */
    public void testEqualsSymmetric() {
        ModelItem x = new ModelItem();
        ModelItem y = new ModelItem();
        assertTrue(x.equals(y) && y.equals(x));
    }
View Full Code Here

     * <b>The equals method is transitive:</b> for any reference values x, y,
     * and z, if x.equals(y) returns true and y.equals(z) returns true, then
     * x.equals(z) should return true.
     */
    public void testEqualsTransivity() {
        ModelItem x = new ModelItem();
        ModelItem y = new ModelItem();
        ModelItem z = new ModelItem();
        assertTrue(x.equals(y) && y.equals(z) && x.equals(z));
    }
View Full Code Here

TOP

Related Classes of net.sf.jmd.metarepresentation.impl.ModelItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.