Package org.openengsb.core.edbi.api

Examples of org.openengsb.core.edbi.api.IndexCommit


    @Test
    public void commit_delete_updatesTablesCorrectly() throws Exception {
        TestModel entity = new TestModel("foo", 1);

        // initial insert
        IndexCommit insertCommit = newTestCommit().insert(entity).get();
        engine.commit(insertCommit);

        // deletion
        IndexCommit deleteCommit = newTestCommit().delete(entity).get();
        engine.commit(deleteCommit);

        // assert

        Index<TestModel> index = engine.getIndex(TestModel.class);
View Full Code Here


        engine.create(testIndex);
    }

    @Test(expected = NoSuchTableException.class)
    public void execute_insert_onNonExistingIndex_throwsException() throws Exception {
        IndexCommit commit = mock(IndexCommit.class);
        when(commit.getTimestamp()).thenReturn(new Date(42));

        engine.execute(new InsertOperation(commit, testIndex, new ArrayList<OpenEngSBModel>()));
    }
View Full Code Here

     *
     * @param ekbCommit the commit to convert
     * @return a new IndexCommit instance representing the given EKBCommit
     */
    public IndexCommit convert(EKBCommit ekbCommit) {
        IndexCommit commit = new IndexCommit();

        commit.setCommitId(ekbCommit.getRevisionNumber());
        commit.setParentCommitId(ekbCommit.getParentRevisionNumber());
        commit.setConnectorId(ekbCommit.getConnectorId());
        commit.setDomainId(ekbCommit.getDomainId());
        commit.setInstanceId(ekbCommit.getInstanceId());
        commit.setTimestamp(new Date());

        commit.setUser(getUser());
        commit.setContextId(getContextId());

        List<OpenEngSBModel> inserts = ekbCommit.getInserts();
        List<OpenEngSBModel> updates = ekbCommit.getUpdates();
        List<OpenEngSBModel> deletes = ekbCommit.getDeletes();

        Set<Class<?>> modelClasses = extractTypes(inserts, updates, deletes);

        commit.setModelClasses(modelClasses);

        commit.setInserts(mapByClass(inserts));
        commit.setUpdates(mapByClass(updates));
        commit.setDeletes(mapByClass(deletes));

        return commit;
    }
View Full Code Here

    public void onPostCommit(EKBCommit ekbCommit) {
        LOG.info("Caught onPostCommit event for EKBCommit {}", ekbCommit.getRevisionNumber());

        CommitConverter commitConverter = new CommitConverter(getAuthenticationContext(), getContextHolder());

        IndexCommit commit = commitConverter.convert(ekbCommit);

        indexEngine.commit(commit);
    }
View Full Code Here

TOP

Related Classes of org.openengsb.core.edbi.api.IndexCommit

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.