Package org.openengsb.core.edb.api

Examples of org.openengsb.core.edb.api.EDBCommit


    @Test
    public void testIfQueryingWithCaseInsensitivity_shouldWork() throws Exception {
        Map<String, EDBObjectEntry> data1 = new HashMap<String, EDBObjectEntry>();
        putValue("test", "This is A test", data1);
        EDBObject v1 = new EDBObject("/test/query/12", data1);
        EDBCommit ci = getEDBCommit();
        ci.insert(v1);
        db.commit(ci);
        List<EDBObject> result = db.query(QueryRequest.query("test", "this is a test").caseInsensitive());
        assertThat(result.size(), is(1));
        assertThat(result.get(0).getOID(), is("/test/query/12"));
        result = db.query(QueryRequest.query("test", "this is a test").caseSensitive());
View Full Code Here


    @Test
    public void testIfQueryingWithCaseSensitivityAndWildcards_shouldWork() throws Exception {
        Map<String, EDBObjectEntry> data1 = new HashMap<String, EDBObjectEntry>();
        putValue("test", "This is A new test", data1);
        EDBObject v1 = new EDBObject("/test/query/13", data1);
        EDBCommit ci = getEDBCommit();
        ci.insert(v1);
        db.commit(ci);
        List<EDBObject> result = db.query(QueryRequest.query("test", "this is a % test")
            .caseInsensitive().wildcardAware());
        assertThat(result.size(), is(1));
        assertThat(result.get(0).getOID(), is("/test/query/13"));
View Full Code Here

        String context1 = "context1";
        String context2 = "context2";
        String context3 = "context3";
        ContextHolder.get().setCurrentContextId(context1);
        EDBObject obj = new EDBObject("/test/context/1");
        EDBCommit commit = getEDBCommit();
        commit.insert(obj);
        db.commit(commit);
        UUID revision1 = commit.getRevisionNumber();
        ContextHolder.get().setCurrentContextId(context2);
        obj = new EDBObject("/test/context/2");
        commit = getEDBCommit();
        commit.insert(obj);
        db.commit(commit);
        UUID revision2 = commit.getRevisionNumber();
        ContextHolder.get().setCurrentContextId(context3);
        obj = new EDBObject("/test/context/3");
        commit = getEDBCommit();
        commit.insert(obj);
        db.commit(commit);
        UUID revision3 = commit.getRevisionNumber();
        ContextHolder.get().setCurrentContextId(CONTEXT);
        obj = new EDBObject("/test/context/4");
        commit = getEDBCommit();
        commit.insert(obj);
        db.commit(commit);

        assertThat(db.getLastRevisionNumberOfContext(context1), is(revision1));
        assertThat(db.getLastRevisionNumberOfContext(context2), is(revision2));
        assertThat(db.getLastRevisionNumberOfContext(context3), is(revision3));
View Full Code Here

        Map<String, EDBObjectEntry> data5 = new HashMap<>();
        putValue("Cheese", "Cheddar", data5);
        putValue("Animal", "Dog", data5);
        putValue("Cow", "Steak", data5);
        EDBObject v5 = new EDBObject("/test/query/14/5", data5);
        EDBCommit commit = getEDBCommit();
        commit.insert(v1);
        commit.insert(v2);
        commit.insert(v3);
        commit.insert(v4);
        commit.insert(v5);
        db.commit(commit);
        QueryRequest request = QueryRequest.create().orJoined();
        request.addParameter("Cow", "Milk");
        assertThat(db.query(request).size(), is(2));
        request.addParameter("Cow", "Steak");
View Full Code Here

        EDBObject v1 = new EDBObject("/test/query/15/1", data1);
        Map<String, EDBObjectEntry> data2 = new HashMap<>();
        putValue("Animal", "Dog", data2);
        putValue("Cow", "Milk", data2);
        EDBObject v2 = new EDBObject("/test/query/15/2", data2);
        EDBCommit commit = getEDBCommit();
        commit.insert(v1);
        commit.insert(v2);
        db.commit(commit);

        Map<String, EDBObjectEntry> data3 = new HashMap<>();
        putValue("House", "Garden", data3);
        EDBObject v3 = new EDBObject("/test2/query/15/3", data3);
        Map<String, EDBObjectEntry> data4 = new HashMap<>();
        putValue("Cheese", "Cheddar", data4);
        putValue("Animal", "Dog", data4);
        EDBObject v4 = new EDBObject("/test2/query/15/4", data4);
        commit = getEDBCommit();
        commit.insert(v3);
        commit.insert(v4);
        db.commit(commit);
        QueryRequest request = QueryRequest.create().orJoined();
        request.addParameter("Animal", "Dog");
        assertThat(db.query(request).size(), is(2));
        request.setContextId("/test");
View Full Code Here

    /**
     * Creates a new commit object, adds the given inserts, updates and deletes and commit it.
     */
    protected Long commitObjects(List<EDBObject> inserts, List<EDBObject> updates, List<EDBObject> deletes) {
        EDBCommit ci = db.createEDBCommit(inserts, updates, deletes);
        return db.commit(ci);
    }
View Full Code Here

    }

    @Override
    public EKBCommit loadCommit(String revision) throws EKBException {
        try {
            EDBCommit commit = edbService.getCommitByRevision(revision);
            return convertEDBCommitToEKBCommit(commit);
        } catch (EDBException e) {
            throw new EKBException("There is no commit with the revision " + revision);
        }
    }
View Full Code Here

TOP

Related Classes of org.openengsb.core.edb.api.EDBCommit

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.