Examples of TestModelDecorator


Examples of org.openengsb.itests.exam.models.TestModelDecorator

        assertThat(subModel2.isDeleted(), is(true));
    }

    @Test
    public void testIfSubModelIsLoadedCorrectly_shouldLoadCorrectVersionOfSubModel() throws Exception {
        TestModelDecorator model = getTestModelDecorator();
        model.setEdbId("submodeltest/7");

        SubModelDecorator sub = getSubModelDecorator();
        sub.setName("test");
        sub.setEdbId("submodeltest/7/1");
        model.setSubModel(sub.getModel());

        EKBCommit commit = getTestEKBCommit().addInsert(model.getModel());
        persist.commit(commit);
        Thread.sleep(5);

        sub.setName("test2");
        commit = getTestEKBCommit().addUpdate(sub.getModel());
        persist.commit(commit);

        sub = loadSubModel("submodeltest/7/1");
        assertThat(sub.getModel(), notNullValue());
        assertThat(sub.getName(), is("test2"));

        model = loadTestModel("submodeltest/7");
        assertThat(model.getModel(), notNullValue());
        sub = new SubModelDecorator(model.getSubModel());
        assertThat(sub.getModel(), notNullValue());
        assertThat(sub.getName(), is("test"));
    }
View Full Code Here

Examples of org.openengsb.itests.exam.models.TestModelDecorator

        persist.revertCommit(UUID.randomUUID().toString());
    }

    @Test
    public void testRevertFunctionality_shouldRevertModelsToOldState() throws Exception {
        TestModelDecorator model = getTestModelDecorator();
        model.setEdbId("reverttest/1");
        model.setName("before");
        TestModelDecorator model2 = getTestModelDecorator();
        model2.setEdbId("reverttest/2");
        model2.setName("test");
        EKBCommit commit = getTestEKBCommit().addInsert(model.getModel());
        persist.commit(commit);
        String revision = commit.getRevisionNumber().toString();

        model.setName("middle");
        commit = getTestEKBCommit().addUpdate(model.getModel());
        persist.commit(commit);
        String revision2 = commit.getRevisionNumber().toString();

        commit = getTestEKBCommit().addInsert(model2.getModel());
        persist.commit(commit);
        model.setName("after");
        commit = getTestEKBCommit().addUpdate(model.getModel());
        persist.commit(commit);

        TestModelDecorator result1 =
            new TestModelDecorator(query.getModel(getTestModel(), getModelOid("reverttest/1")));
        persist.revertCommit(revision2);
        TestModelDecorator result2 =
            new TestModelDecorator(query.getModel(getTestModel(), getModelOid("reverttest/1")));
        persist.revertCommit(revision);
        TestModelDecorator result3 =
            new TestModelDecorator(query.getModel(getTestModel(), getModelOid("reverttest/1")));
        assertThat(result1, notNullValue());
        assertThat(result2, notNullValue());
        assertThat(result3, notNullValue());
        assertThat(result1.getName(), is("after"));
        assertThat(result2.getName(), is("middle"));
        assertThat(result3.getName(), is("before"));
    }
View Full Code Here

Examples of org.openengsb.itests.exam.models.TestModelDecorator

        assertThat(result3.getName(), is("before"));
    }

    @Test
    public void testLoadingOfEKBCommits_shouldLoadAllInformation() throws Exception {
        TestModelDecorator model = getTestModelDecorator();
        model.setEdbId("ekbload/1");
        model.setName("test");
        EKBCommit commit = getTestEKBCommit().addInsert(model.getModel());
        commit.setComment("This is the first comment");
        persist.commit(commit);
        String revision = commit.getRevisionNumber().toString();
        model.setName("test2");
        commit = getTestEKBCommit().addUpdate(model.getModel());
        commit.setComment("This is the second comment");
        persist.commit(commit);
        String revision2 = commit.getRevisionNumber().toString();

        commit = query.loadCommit(revision);
View Full Code Here

Examples of org.openengsb.itests.exam.models.TestModelDecorator

    }

    @Test
    public void testDeleteCommitWithLastRevision_shouldDeleteCommit() throws Exception {
        UUID preCommit1Revision = query.getLastRevisionNumberOfContext(CONTEXT);
        TestModelDecorator model1 = getTestModelDecorator();
        model1.setEdbId("deleteCommitTest/1");
        EKBCommit commit = getTestEKBCommit().addInsert(model1.getModel());
        persist.commit(commit);

        UUID preCommit2Revision = query.getLastRevisionNumberOfContext(CONTEXT);
        TestModelDecorator model2 = getTestModelDecorator();
        model2.setEdbId("deleteCommitTest/2");
        commit = getTestEKBCommit().addInsert(model2.getModel());
        commit.addDelete(model1.getModel());
        persist.commit(commit);

        UUID postCommit2Revision = query.getLastRevisionNumberOfContext(CONTEXT);
        persist.deleteCommit(postCommit2Revision, CONTEXT);
View Full Code Here

Examples of org.openengsb.itests.exam.models.TestModelDecorator

        assertThat(result.size(), is(0));
    }

    @Test(expected = EKBConcurrentException.class)
    public void testDeleteCommitWithOldRevision_shouldThrowException() throws Exception {
        TestModelDecorator model = getTestModelDecorator();
        model.setEdbId("deleteCommitTest/3");
        EKBCommit commit1 = getTestEKBCommit().addInsert(model.getModel());
        persist.commit(commit1);

        UUID postFirstCommitRevision = query.getLastRevisionNumberOfContext(CONTEXT);

        TestModelDecorator model2 = getTestModelDecorator();
        model.setEdbId("deleteCommitTest/4");
        EKBCommit commit2 = getTestEKBCommit().addInsert(model2.getModel());
        persist.commit(commit2);

        persist.deleteCommit(postFirstCommitRevision, CONTEXT);
    }
View Full Code Here

Examples of org.openengsb.itests.exam.models.TestModelDecorator

    public void testDeleteCommitWithWrongRevision_shouldThrowException() {
        persist.deleteCommit(UUID.randomUUID(), CONTEXT);
    }

    private TestModelDecorator loadTestModel(String oid) throws Exception {
        return new TestModelDecorator(query.getModel(getTestModel(), getModelOid(oid)));
    }
View Full Code Here

Examples of org.openengsb.itests.exam.models.TestModelDecorator

    private SubModelDecorator loadSubModel(String oid) throws Exception {
        return new SubModelDecorator(query.getModel(getSubModel(), getModelOid(oid)));
    }

    private TestModelDecorator getTestModelDecorator() throws Exception {
        return new TestModelDecorator(getTestModel().newInstance());
    }
View Full Code Here

Examples of org.openengsb.itests.exam.models.TestModelDecorator

        persist.commit(commit);
    }

    @Test
    public void testEKBInsertCommit_shouldSaveModel() throws Exception {
        TestModelDecorator model = getTestModelDecorator();
        model.setName("test");
        model.setEdbId("createevent/2");
        EKBCommit commit = getTestEKBCommit().addInsert(model.getModel());
        persist.commit(commit);

        EDBObject obj = edbService.getObject(getModelOid("createevent/2"));
        String name = obj.getString("name");
        Integer version = obj.getObject(EDBConstants.MODEL_VERSION, Integer.class);
View Full Code Here

Examples of org.openengsb.itests.exam.models.TestModelDecorator

        assertThat(version, is(1));
    }

    @Test
    public void testEKBInsertCommitAndQueryData_shouldReturnModelObject() throws Exception {
        TestModelDecorator model = getTestModelDecorator();
        model.setName("C:\\test");
        model.setEdbId("createevent/5");
        EKBCommit commit = getTestEKBCommit().addInsert(model.getModel());
        persist.commit(commit);

        @SuppressWarnings("unchecked")
        List<Object> result = (List<Object>) query.queryByString(getTestModel(), "name:\"C:\\test\"");
        assertThat(result.isEmpty(), is(false));
View Full Code Here

Examples of org.openengsb.itests.exam.models.TestModelDecorator

        assertThat(result.get(0), is(getTestModel()));
    }

    @Test
    public void testEKBInsertCommitAndQueryDataWithBackslashes_shouldReturnModelObject() throws Exception {
        TestModelDecorator model = getTestModelDecorator();
        model.setName("C:\\\\test");
        model.setEdbId("createevent/6");
        EKBCommit commit = getTestEKBCommit().addInsert(model.getModel());
        persist.commit(commit);

        QueryRequest request = QueryRequest.query("name", "C:\\\\test").wildcardUnaware();
        @SuppressWarnings("unchecked")
        List<Object> result = (List<Object>) query.query(getTestModel(), request);
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.