Package org.openengsb.domain.example.model

Examples of org.openengsb.domain.example.model.SourceModelB


    @Test
    public void testIfEngineeringObjectsAreInsertedCorrectly_shouldInsertObjectAndLoadReferencedValues()
        throws Exception {
        SourceModelA sourceA = new SourceModelA("sourceA/1", "sourceNameA", "shared");
        SourceModelB sourceB = new SourceModelB("sourceB/1", "sourceNameB", "shared");
        persist.commit(getTestEKBCommit().addInsert(sourceA).addInsert(sourceB));

        EOModel eo = new EOModel("eo/1", sourceA.getEdbId(), sourceB.getEdbId(), "shared");
        persist.commit(getTestEKBCommit().addInsert(eo));

        EOModel result = query.getModel(EOModel.class, getModelOid(eo.getEdbId()));
        String nameA = result.getNameA();
        String nameB = result.getNameB();

        assertThat(nameA, is(sourceA.getName()));
        assertThat(nameB, is(sourceB.getName()));
    }
View Full Code Here


    }

    @Test
    public void testIfEOUpdateWorksCorrectly_shouldUpdateSourceModel() throws Exception {
        SourceModelA sourceA = new SourceModelA("sourceA/2", "sourceNameA", "shared");
        SourceModelB sourceB = new SourceModelB("sourceB/2", "sourceNameB", "shared");
        persist.commit(getTestEKBCommit().addInsert(sourceA).addInsert(sourceB));

        EOModel eo = new EOModel("eo/2", sourceA.getEdbId(), sourceB.getEdbId(), "shared");
        persist.commit(getTestEKBCommit().addInsert(eo));

        eo = query.getModel(EOModel.class, getModelOid(eo.getEdbId()));
        eo.setNameA("updatedNameA");
        eo.setShared("updatedShared");
        persist.commit(getTestEKBCommit().addUpdate(eo));

        sourceA = query.getModel(SourceModelA.class, getModelOid(sourceA.getEdbId()));
        sourceB = query.getModel(SourceModelB.class, getModelOid(sourceB.getEdbId()));
        assertThat(sourceA.getName(), is("updatedNameA"));
        assertThat(sourceA.getShared(), is("updatedShared"));
        assertThat(sourceB.getShared(), is("updatedShared"));
    }
View Full Code Here

    }

    @Test
    public void testIfSourceUpdateWorksCorrectly_shouldUpdateEngineeringObject() throws Exception {
        SourceModelA sourceA = new SourceModelA("sourceA/3", "sourceNameA", "shared");
        SourceModelB sourceB = new SourceModelB("sourceB/3", "sourceNameB", "shared");
        persist.commit(getTestEKBCommit().addInsert(sourceA).addInsert(sourceB));

        EOModel eo = new EOModel("eo/3", sourceA.getEdbId(), sourceB.getEdbId(), "shared");
        persist.commit(getTestEKBCommit().addInsert(eo));

        sourceA = query.getModel(SourceModelA.class, getModelOid(sourceA.getEdbId()));
        sourceA.setName("updatedNameA");
        sourceA.setShared("updatedShared");
        persist.commit(getTestEKBCommit().addUpdate(sourceA));

        eo = query.getModel(EOModel.class, getModelOid(eo.getEdbId()));
        sourceB = query.getModel(SourceModelB.class, getModelOid(sourceB.getEdbId()));
        assertThat(eo.getNameA(), is("updatedNameA"));
        assertThat(eo.getShared(), is("updatedShared"));
        assertThat(sourceB.getShared(), is("updatedShared"));
    }
View Full Code Here

    }

    @Test
    public void testDeleteSourceModel_doesNotDeleteLinkedModels() {
        SourceModelA sourceA = new SourceModelA("sourceA/5", "sourceNameA", "shared");
        SourceModelB sourceB = new SourceModelB("sourceB/5", "sourceNameB", "shared");
        persist.commit(getTestEKBCommit().addInsert(sourceA).addInsert(sourceB));

        EOModel eo = new EOModel("eo/5", sourceA.getEdbId(), sourceB.getEdbId(), "shared");
        persist.commit(getTestEKBCommit().addInsert(eo));

        SourceModelA source = query.getModel(SourceModelA.class, getModelOid(sourceA.getEdbId()));
        persist.commit(getTestEKBCommit().addDelete(source));

        eo = query.getModel(EOModel.class, getModelOid(eo.getEdbId()));
        sourceB = query.getModel(SourceModelB.class, getModelOid(sourceB.getEdbId()));
        assertThat(eo, notNullValue());
        assertThat(sourceB, notNullValue());
    }
View Full Code Here

    }

    @Test
    public void testDeleteEOModel_doesNotDeleteLinkedModels() {
        SourceModelA sourceA = new SourceModelA("sourceA/6", "sourceNameA", "shared");
        SourceModelB sourceB = new SourceModelB("sourceB/6", "sourceNameB", "shared");
        persist.commit(getTestEKBCommit().addInsert(sourceA).addInsert(sourceB));

        EOModel eo = new EOModel("eo/6", sourceA.getEdbId(), sourceB.getEdbId(), "shared");
        persist.commit(getTestEKBCommit().addInsert(eo));

        eo = query.getModel(EOModel.class, getModelOid(eo.getEdbId()));
        persist.commit(getTestEKBCommit().addDelete(eo));

        sourceA = query.getModel(SourceModelA.class, getModelOid(sourceA.getEdbId()));
        sourceB = query.getModel(SourceModelB.class, getModelOid(sourceB.getEdbId()));
        assertThat(sourceA, notNullValue());
        assertThat(sourceB, notNullValue());
    }
View Full Code Here

        assertThat(sourceAs.size(), is(1));
    }
   
    @Test
    public void testIfUpdatePropagationWithMissingModelsWorks_shouldUpdateExistingModels() throws Exception {
        SourceModelB sourceB = new SourceModelB("sourceB/9", "sourceNameB", "shared");
        persist.commit(getTestEKBCommit().addInsert(sourceB));

        EOModel eo = new EOModel("eo/9", "this/does/not/exist", sourceB.getEdbId(), "shared");
        persist.commit(getTestEKBCommit().addInsert(eo));

        eo = query.getModel(EOModel.class, getModelOid(eo.getEdbId()));
        eo.setNameB("updatedNameB");
        eo.setShared("updatedShared");
        persist.commit(getTestEKBCommit().addUpdate(eo));

        sourceB = query.getModel(SourceModelB.class, getModelOid(sourceB.getEdbId()));
        assertThat(sourceB.getName(), is("updatedNameB"));
        assertThat(sourceB.getShared(), is("updatedShared"));
    }
View Full Code Here

TOP

Related Classes of org.openengsb.domain.example.model.SourceModelB

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.