Package org.openengsb.core.edb.api

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


    @Test
    public void testIfRetrievingCommitByRevisionWorks_shouldWork() throws Exception {
        Map<String, EDBObjectEntry> entries = new HashMap<String, EDBObjectEntry>();
        entries.put("test", new EDBObjectEntry("test", "test", String.class));
        EDBObject obj = new EDBObject("/test/query/9", entries);
        EDBCommit ci = getEDBCommit();
        ci.insert(obj);
        db.commit(ci);
        EDBCommit test = db.getCommitByRevision(ci.getRevisionNumber().toString());
        assertThat(test, notNullValue());
View Full Code Here


    @Test
    public void testIfRetrievingCommitByRevisionWithIntermediateCommitsWorks_shouldWork() throws Exception {
        Map<String, EDBObjectEntry> entries = new HashMap<String, EDBObjectEntry>();
        entries.put("test", new EDBObjectEntry("test", "test", String.class));
        EDBObject obj = new EDBObject("/test/query/10", entries);
        EDBCommit ci = getEDBCommit();
        ci.insert(obj);
        db.commit(ci);
        String revision = ci.getRevisionNumber().toString();
        obj.putEDBObjectEntry("test", "test2", String.class);
        EDBCommit ci2 = getEDBCommit();
        ci2.update(obj);
        db.commit(ci2);
        EDBCommit test = db.getCommitByRevision(revision);
        assertThat(test, notNullValue());
View Full Code Here

    @Test
    public void testIfRetrievingCommitRevisionsByRequestGivesCorrectRevisions_shouldWork() throws Exception {
        Map<String, EDBObjectEntry> entries = new HashMap<String, EDBObjectEntry>();
        entries.put("test", new EDBObjectEntry("test", "test", String.class));
        EDBObject obj = new EDBObject("/test/query/11", entries);
        EDBCommit ci = getEDBCommit();
        ci.insert(obj);
        Long timestamp1 = db.commit(ci);
        String revision1 = ci.getRevisionNumber().toString();
        obj.putEDBObjectEntry("test2", "test2", String.class);
        ci = getEDBCommit();
        ci.setComment("this is a comment");
        ci.update(obj);
        Long timestamp2 = db.commit(ci);
        String revision2 = ci.getRevisionNumber().toString();
View Full Code Here

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

    public void testIfLastRevisionNumberOfContextWorks_shouldReturnCorrectRevisions() throws Exception {
        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));
View Full Code Here

    @Test
    public void testIfOrRequestsAreWorking_shouldReturnCorrectObjects() throws Exception {
        Map<String, EDBObjectEntry> data1 = new HashMap<>();
        putValue("Cow", "Milk", data1);
        putValue("Cheese", "Cheddar", data1);
        EDBObject v1 = new EDBObject("/test/query/14/1", data1);
        Map<String, EDBObjectEntry> data2 = new HashMap<>();
        putValue("Animal", "Dog", data2);
        putValue("Cow", "Milk", data2);
        EDBObject v2 = new EDBObject("/test/query/14/2", data2);
        Map<String, EDBObjectEntry> data3 = new HashMap<>();
        putValue("House", "Garden", data3);
        EDBObject v3 = new EDBObject("/test/query/14/3", data3);
        Map<String, EDBObjectEntry> data4 = new HashMap<>();
        putValue("Cheese", "Cheddar", data4);
        putValue("Animal", "Dog", data4);
        EDBObject v4 = new EDBObject("/test/query/14/4", data4);
        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);
View Full Code Here

    @Test
    public void testIfContextSpecificQueriesWork_shouldReturnCorrectObjects() throws Exception {
        Map<String, EDBObjectEntry> data1 = new HashMap<>();
        putValue("Cow", "Milk", data1);
        putValue("Cheese", "Cheddar", data1);
        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();
View Full Code Here

        assertThat(result.get(0).getOID(), is("/test2/query/15/4"));
    }

    @Test
    public void testIfQueryForDeletedObjects_onlyReturnsDeletedObjects() {
        EDBObject v1 = createRandomTestObject("/test/query/16/1");
        commitObjects(Lists.newArrayList(v1), null, null);
        commitObjects(null, null, Lists.newArrayList(v1));

        QueryRequest request = QueryRequest.create();
        List<EDBObject> result = db.query(request);
View Full Code Here

    /**
     * Returns a random test EDBObject
     */
    protected EDBObject createRandomTestObject(String oid) {
        Random random = new Random(System.currentTimeMillis());
        EDBObject result = new EDBObject(oid);
        int max = 5;

        for (int i = 0; i < max; ++i) {
            String key = RANDOMKEYS[random.nextInt(RANDOMKEYS.length)] + Integer.toString(i);
            String value = "key value " + Integer.toString(random.nextInt(100));
            result.putEDBObjectEntry(key, value);
        }
        return new EDBObject(oid);
    }
View Full Code Here

TOP

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

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.