Package org.openengsb.core.ekb.api

Examples of org.openengsb.core.ekb.api.EKBCommit.addInsert()


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


        EKBCommit commit = getEKBCommit();
        for (Project project : projects) {
            List<Project> result = queryService.queryByString(Project.class, "name:\"" + project.getName() + "\"");

            if (result.size() == 0) {
                commit.addInsert(project);
            } else {
                commit.addUpdate(project);
            }
        }
View Full Code Here

        for (User user : users) {
            List<User> result = queryService.queryByString(User.class, "username:\"" + user.getUsername() + "\"");

            if (result.size() == 0) {
                LOGGER.debug("Create User " + user.getUsername());
                commit.addInsert(user);
            } else if (result.size() == 1) {
                LOGGER.debug("Update User " + user.getUsername());
                commit.addUpdate(user);
            } else {
                LOGGER.debug("Error: Duplicate users in EngSB");
View Full Code Here

        for (Role role : roles) {
            List<Role> result = queryService.queryByString(Role.class, "name:\"" + role.getName() + "\"");

            if (result.size() == 0) {
                commit.addInsert(role);
            } else {
                commit.addUpdate(role);
            }
        }
View Full Code Here

            List<Assignment> result =
                queryService.queryByString(Assignment.class, "uuid:\"" + assignment.getUuid() + "\"");

            if (result.size() == 0) {
                LOGGER.debug("New Assignment: " + assignment.getUser() + ":" + assignment.getProject());
                commit.addInsert(assignment);
            } else {
                LOGGER.debug("Update Assignment: " + assignment.getUser() + ":" + assignment.getProject());
                commit.addUpdate(assignment);
            }
        }
View Full Code Here

        OpenEngSBModel update2 = new TestModelA();

        OpenEngSBModel delete1 = new TestModelA();
        OpenEngSBModel delete2 = new TestModelB();

        commit.addInsert(insert1).addInsert(insert2).addInsert(insert3);
        commit.addUpdate(update1).addUpdate(update2);
        commit.addDelete(delete1).addDelete(delete2);

        // test
        IndexCommit convertedCommit = converter.convert(commit);
View Full Code Here

        model.setName("test2");
        commit = getTestEKBCommit().addUpdate(model.getModel());
        TestModelDecorator model2 = getTestModelDecorator();
        model2.setName("test3");
        model2.setEdbId("batchevent/2");
        commit.addInsert(model2.getModel());
        persist.commit(commit);

        obj = edbService.getObject(getModelOid("batchevent/1"));
        String name2 = obj.getString("name");
        Integer version2 = obj.getObject(EDBConstants.MODEL_VERSION, Integer.class);
View Full Code Here

    @Test
    public void testIfRealModelsCanBeCommited_shouldWork() throws Exception {
        EKBCommit commit = new EKBCommit();
        commit.setDomainId("testdomain").setConnectorId("testconnector").setInstanceId("testinstance");
        commit.addInsert(new TestModel2());
        service.commit(commit);
    }
}
View Full Code Here

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

            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);
        // throws an exception since the other commit is still running in the context
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.