Examples of SourceModelA


Examples of org.openengsb.core.ekb.persistence.persist.edb.models.SourceModelA

        super(EOMode.DEACTIVATED);
    }
   
    @Test
    public void testIfNormalObjectUpdateTriggersEOUpdate_shouldTriggerNothing() throws Exception {
        SourceModelA model = new SourceModelA();
        model.setNameA("updatedFirstObject");
        model.setId("objectA/reference/1");
        EKBCommit commit = getTestCommit().addUpdate(model);
        int before = commit.getUpdates().size();
        enhancer.onPreCommit(commit);
        int after = commit.getUpdates().size();
        assertThat(before, is(after));
View Full Code Here

Examples of org.openengsb.core.ekb.persistence.persist.edb.models.SourceModelA

        model.setNameA("updatedFirstObject");
        EKBCommit commit = getTestCommit().addUpdate(model);
        int before = commit.getUpdates().size();
        enhancer.onPreCommit(commit);
        int after = commit.getUpdates().size();
        SourceModelA modelA = null;
        for (OpenEngSBModel update : commit.getUpdates()) {
            if (update.retrieveModelName().equals(SourceModelA.class.getName())) {
                modelA = (SourceModelA) update;
            }
        }
View Full Code Here

Examples of org.openengsb.core.ekb.persistence.persist.edb.models.SourceModelA

        assertThat(model.getNameB(), is("secondObject"));
    }

    @Test
    public void testIfNormalObjectUpdateTriggersEOUpdate_shouldUpdateAlsoEO() throws Exception {
        SourceModelA model = new SourceModelA();
        model.setNameA("updatedFirstObject");
        model.setId("objectA/reference/1");
        EKBCommit commit = getTestCommit().addUpdate(model);
        int before = commit.getUpdates().size();
        enhancer.onPreCommit(commit);
        int after = commit.getUpdates().size();
        Object inserted = commit.getUpdates().get(commit.getUpdates().size() - 1);
View Full Code Here

Examples of org.openengsb.core.ekb.persistence.persist.edb.models.SourceModelA

        assertThat(result.getNameA(), is("updatedFirstObject"));
    }

    @Test
    public void testIfDoubleNormalObjectUpdateTriggersEOUpdate_shouldUpdateAlsoEO() throws Exception {
        SourceModelA modelA = new SourceModelA();
        modelA.setNameA("updatedFirstObject");
        modelA.setId("objectA/reference/1");
        SourceModelB modelb = new SourceModelB();
        modelb.setNameB("updatedSecondObject");
        modelb.setId("objectB/reference/1");
        EKBCommit commit = getTestCommit().addUpdate(modelA).addUpdate(modelb);
        int before = commit.getUpdates().size();
View Full Code Here

Examples of org.openengsb.core.ekb.persistence.persist.edb.models.SourceModelA

        EKBCommit commit = getTestCommit().addUpdate(model);
        int before = commit.getUpdates().size();
        enhancer.onPreCommit(commit);
        int after = commit.getUpdates().size();
        assertThat(after - before == 2, is(true));
        SourceModelA modelA = null;
        SourceModelB modelB = null;
        for (OpenEngSBModel update : commit.getUpdates()) {
            if (update.retrieveModelName().equals(SourceModelA.class.getName())) {
                modelA = (SourceModelA) update;
            }
            if (update.retrieveModelName().equals(SourceModelB.class.getName())) {
                modelB = (SourceModelB) update;
            }
        }
        assertThat(modelA.getNameA(), is("updatedFirstObject"));
        assertThat(modelB.getNameB(), is("updatedSecondObject"));
    }
View Full Code Here

Examples of org.openengsb.core.ekb.persistence.persist.edb.models.SourceModelA

        EKBCommit commit = getTestCommit().addUpdate(model);
        int before = commit.getUpdates().size();
        enhancer.onPreCommit(commit);
        int after = commit.getUpdates().size();
        assertThat(after - before == 1, is(true));
        SourceModelA modelA = null;
        for (OpenEngSBModel update : commit.getUpdates()) {
            if (update.retrieveModelName().equals(SourceModelA.class.getName())) {
                modelA = (SourceModelA) update;
            }
        }
        assertThat(modelA.getNameA(), is("updatedFirstObject"));
    }
View Full Code Here

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

        ContextHolder.get().setCurrentContextId(CONTEXT);
    }
   
    @Test(expected = EKBConcurrentException.class)
    public void testIfUnexpectedParentRevisionThrowsException_shouldThrowException() throws Exception {
        SourceModelA model = new SourceModelA();
        model.setEdbId("unexpectedParentRevision/1");
        EKBCommit commit = getTestEKBCommit().addInsert(model);
        persist.commit(commit, null);
       
        model = new SourceModelA();
        model.setEdbId("unexpectedParentRevision/2");
        commit = getTestEKBCommit().addInsert(model);
        // second time throws an exception since the expected parent revision is no longer null
        persist.commit(commit, null);
    }
View Full Code Here

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

   
    @Test(expected = EKBConcurrentException.class)
    public void testIfConcurrentWritingInTheSameContextThrowsAnException_shouldThrowException() throws Exception {
        EKBCommit commit = getTestEKBCommit();
        for (int i = 0; i < 30; i++) {
            SourceModelA model = new SourceModelA();
            model.setEdbId("concurrentTest/1/" + i);
            commit.addInsert(model);
        }
        EKBCommit anotherCommit = getTestEKBCommit();
        SourceModelA model = new SourceModelA();
        model.setEdbId("concurrentTest/1/30");
        anotherCommit.addInsert(model);
       
        ModelCommitThread thread = new ModelCommitThread(persist, commit, CONTEXT);
        thread.start();
        Thread.sleep(20);
View Full Code Here

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

    public void testIfConcurrentWritingInDifferentContextsWorks_shouldWork() throws Exception {
        String otherContext = "a_different_context";
        String oid = "";
        EKBCommit commit = getTestEKBCommit();
        for (int i = 0; i < 15; i++) {
            SourceModelA model = new SourceModelA();
            model.setEdbId("concurrentTest/2/" + i);
            commit.addInsert(model);
            if (i == 14) {
                oid = ModelWrapper.wrap(model).retrieveInternalModelId().toString();
            }
        }
View Full Code Here

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

   
    @Test
    public void testIfCheckForContextIsDoneCorrectly_shouldWork() throws Exception {
        ContextHolder.get().setCurrentContextId("A");
        EKBCommit commit = getTestEKBCommit();
        SourceModelA model = new SourceModelA();
        model.setEdbId("contextSwitchTest/1");
        String oid = ModelWrapper.wrap(model).retrieveInternalModelId().toString();
        model.setName("A");
        commit.addInsert(model);
        persist.commit(commit, query.getLastRevisionNumberOfContext("A"));
        ContextHolder.get().setCurrentContextId("B");
        persist.commit(commit, query.getLastRevisionNumberOfContext("B"));
        model.setName("B");
        commit = getTestEKBCommit();
        commit.addUpdate(model);
        ContextHolder.get().setCurrentContextId("A");
        persist.commit(commit, query.getLastRevisionNumberOfContext("A"));
        ContextHolder.get().setCurrentContextId("B");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.