Package org.openengsb.core.ekb.api

Examples of org.openengsb.core.ekb.api.EKBCommit


        throws Exception {
        EngineeringObjectModel model = new EngineeringObjectModel();
        model.setInternalModelName("common/reference/2");
        model.setModelAId("objectA/reference/1");
        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;
            }
        }
        assertThat(before, is(after));
View Full Code Here


    @Test
    public void testIfEngineeringObjectModelInsertionWorks_shouldLoadTheValuesOfTheForeignKeys() throws Exception {
        EngineeringObjectModel model = new EngineeringObjectModel();
        model.setModelAId("objectA/reference/1");
        model.setModelBId("objectB/reference/1");
        EKBCommit commit = getTestCommit().addInsert(model);
        enhancer.onPreCommit(commit);

        assertThat(model.getNameA(), is("firstObject"));
        assertThat(model.getNameB(), is("secondObject"));
    }
View Full Code Here

    @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);
        EngineeringObjectModel result = (EngineeringObjectModel) inserted;
        assertThat(before < after, is(true));
        assertThat(result.getNameA(), is("updatedFirstObject"));
    }
View Full Code Here

        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();
        enhancer.onPreCommit(commit);
        int after = commit.getUpdates().size();
        Object inserted = commit.getUpdates().get(commit.getUpdates().size() - 1);
        EngineeringObjectModel result = (EngineeringObjectModel) inserted;
        assertThat(before < after, is(true));
        assertThat(result.getNameA(), is("updatedFirstObject"));
        assertThat(result.getNameB(), is("updatedSecondObject"));
    }
View Full Code Here

        throws Exception {
        EngineeringObjectModel model = new EngineeringObjectModel();
        model.setInternalModelName("common/reference/1");
        model.setModelAId("objectA/reference/2");
        model.setNameA("teststring");
        EKBCommit commit = getTestCommit().addUpdate(model);
        enhancer.onPreCommit(commit);
    }
View Full Code Here

        model.setInternalModelName("common/reference/1");
        model.setModelAId("objectA/reference/2");
        model.setModelBId("objectB/reference/1");
        model.setNameA("firstObject");
        model.setNameB("secondObject");
        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);
        EngineeringObjectModel result = (EngineeringObjectModel) inserted;
        assertThat(before == after, is(true));
        assertThat(result.getNameA(), is("updatedFirstObject"));
        assertThat(result.getNameB(), is("secondObject"));
    }
View Full Code Here

        model.setInternalModelName("common/reference/1");
        model.setModelAId("objectA/reference/2");
        model.setModelBId("objectB/reference/2");
        model.setNameA("firstObject");
        model.setNameB("secondObject");
        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);
        EngineeringObjectModel result = (EngineeringObjectModel) inserted;
        assertThat(before == after, is(true));
        assertThat(result.getNameA(), is("updatedFirstObject"));
        assertThat(result.getNameB(), is("updatedSecondObject"));
    }
View Full Code Here

        model.setInternalModelName("common/reference/1");
        model.setModelAId("objectA/reference/1");
        model.setModelBId("objectB/reference/1");
        model.setNameA("updatedFirstObject");
        model.setNameB("updatedSecondObject");
        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;
View Full Code Here

    @Test
    public void testIfEOObjectWithNoReferenceCanBeCommitted_shouldWork() throws Exception {
        EngineeringObjectModel model = new EngineeringObjectModel();
        model.setInternalModelName("common/reference/1");
        EKBCommit commit = getTestCommit().addInsert(model);
        int before = commit.getUpdates().size();
        enhancer.onPreCommit(commit);
        int after = commit.getUpdates().size();
        assertThat(after, is(before));
    }
View Full Code Here

        throws Exception {
        EngineeringObjectModel model = new EngineeringObjectModel();
        model.setInternalModelName("common/reference/2");
        model.setModelAId("objectA/reference/1");
        model.setNameA("updatedFirstObject");
        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

TOP

Related Classes of org.openengsb.core.ekb.api.EKBCommit

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.