Package org.openengsb.domain.example.model

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


        assertNotNull(indexEngine);
    }

    @Test
    public void ekbCommit_shouldCreateIndexInherently() throws Exception {
        EOModel insert = new EOModel();
        insert.setEdbId("insert/1");

        EKBCommit ekbCommit = getTestEKBCommit();
        ekbCommit.addInsert(insert);

        ekb.commit(ekbCommit);

        Index<?> index = indexEngine.getIndex(insert.getClass());

        assertNotNull(index);
        assertEquals("org.openengsb.domain.example.model.EOModel", index.getName());
        assertEquals(insert.getClass(), index.getModelClass());

        assertNotNull(index.getHeadTableName());
        assertNotNull(index.getHistoryTableName());

        assertEquals(6, index.getFields().size());
View Full Code Here


        assertEquals(6, index.getFields().size());
    }

    @Test
    public void createdIndexHeadTableShouldHaveCorrectPrimaryKey() throws Exception {
        EOModel insert = new EOModel();
        insert.setEdbId("insert/1");
        ekb.commit(getTestEKBCommit().addInsert(insert));

        String sql = "SELECT * FROM INFORMATION_SCHEMA.INDEXES WHERE TABLE_NAME = ?";

        Map<String, Object> record =
View Full Code Here

    @Test
    public void ekbCommit_updateAndDelete_shouldCreateHistoryRecordsCorreclty() throws Exception {
        // model 1 stays the same
        // model 2 gets updated
        // model 3 gets deleted
        EOModel model1 = new EOModel();
        EOModel model2 = new EOModel();
        EOModel model3 = new EOModel();

        model1.setEdbId("eom/1");
        model2.setEdbId("eom/2");
        model3.setEdbId("eom/3");

        model1.setShared("A");
        model2.setShared("B");
        model3.setShared("C");

        EKBCommit insertCommit =
            getTestEKBCommit().addInsert(model1).addInsert(model2).addInsert(model3);
        ekb.commit(insertCommit);
View Full Code Here

        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

    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"));
View Full Code Here

    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 testIfEOUpdateWorksCorrectlyWithOnlyOneSource_shouldUpdateSourceModel() throws Exception {
        SourceModelA sourceA = new SourceModelA("sourceA/4", "sourceNameA", "shared");
        persist.commit(getTestEKBCommit().addInsert(sourceA));

        EOModel eo = new EOModel("eo/4", sourceA.getEdbId(), null, "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));

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

    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

    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());
View Full Code Here

        assertThat(sourceB, notNullValue());
    }

    @Test
    public void testInsertEOModel_doesNotInsertLinkedModels() {
        EOModel eo = new EOModel("eo/7", "sourceA/7", "sourceB/7", "shared");
        eo.setNameA("sourceNameA");
        eo.setNameB("sourceNameB");
        persist.commit(getTestEKBCommit().addInsert(eo));

        List<EOModel> eos = query.queryByString(EOModel.class, "oid:\"" + getModelOid("eo/7") + "\"");
        List<SourceModelB> sourceBs =
            query.queryByString(SourceModelB.class, "oid:\"" + getModelOid("sourceB/7") + "\"");
View Full Code Here

TOP

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

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.