Package org.openengsb.core.edb.api

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


        commitObjects(null, null, objects);
    }

    @Test(expected = EDBException.class)
    public void testCommitEDBObjectsDeleteAlreadyDeleted_shouldThrowException() throws Exception {
        EDBObject object = new EDBObject("/commit/test/delete/3");
        List<EDBObject> objects = new ArrayList<EDBObject>();
        objects.add(object);
        commitObjects(objects, null, null);
        commitObjects(null, null, objects);
        commitObjects(null, null, objects);
View Full Code Here


        commitObjects(null, null, objects);
    }

    @Test
    public void testIfOtherTypesThanStringWorks_shouldProcessInteger() throws Exception {
        EDBObject object = new EDBObject("test/type/integer");
        object.putEDBObjectEntry("value", Integer.valueOf(42));
        commitObjects(Arrays.asList(object), null, null);
        object = db.getObject("test/type/integer");
        Object value = object.getObject("value");
        assertThat(value.getClass().getName(), is(Integer.class.getName()));
        assertThat((Integer) value, is(42));
    }
View Full Code Here

        assertThat((Integer) value, is(42));
    }

    @Test
    public void testIfOtherTypesThanStringWorks_shouldProcessBoolean() throws Exception {
        EDBObject object = new EDBObject("test/type/boolean");
        object.putEDBObjectEntry("value", Boolean.TRUE);
        commitObjects(Arrays.asList(object), null, null);
        object = db.getObject("test/type/boolean");
        Object value = object.getObject("value");
        assertThat(value.getClass().getName(), is(Boolean.class.getName()));
        assertThat((Boolean) value, is(Boolean.TRUE));
    }
View Full Code Here

        assertThat((Boolean) value, is(Boolean.TRUE));
    }

    @Test
    public void testIfOtherTypesThanStringWorks_shouldProcessDate() throws Exception {
        EDBObject object = new EDBObject("test/type/date");
        Date date = new Date();
        object.putEDBObjectEntry("value", date);
        commitObjects(Arrays.asList(object), null, null);
        object = db.getObject("test/type/date");
        Object value = object.getObject("value");
        assertThat(value.getClass().getName(), is(Date.class.getName()));
        assertThat((Date) value, is(date));
    }
View Full Code Here

    public void testQueryWithSomeAspects_shouldWork() throws Exception {
        Map<String, EDBObjectEntry> data1 = new HashMap<String, EDBObjectEntry>();
        putValue("A", "B", data1);
        putValue("Cow", "Milk", data1);
        putValue("Dog", "Food", data1);
        EDBObject v1 = new EDBObject("/test/query1", data1);
        EDBCommit ci = getEDBCommit();
        ci.insert(v1);
        long time1 = db.commit(ci);

        Map<String, EDBObjectEntry> data2 = new HashMap<String, EDBObjectEntry>();
        putValue("Cow", "Milk", data2);
        putValue("House", "Garden", data2);
        v1 = new EDBObject("/test/query2", data2);
        ci = getEDBCommit();
        ci.insert(v1);
        long time2 = db.commit(ci);

        QueryRequest req = QueryRequest.query("A", "B");
View Full Code Here

    @Test
    public void testQueryOfOldVersion_shouldWork() throws Exception {
        Map<String, EDBObjectEntry> data1v1 = new HashMap<String, EDBObjectEntry>();
        putValue("pre:KeyA", "pre:Value A 1", data1v1);
        putValue("pre:KeyB", "pre:Value A 1", data1v1);
        EDBObject v11 = new EDBObject("pre:/test/object1", data1v1);
        EDBCommit ci = getEDBCommit();
        ci.insert(v11);
        Map<String, EDBObjectEntry> data2v1 = new HashMap<String, EDBObjectEntry>();
        putValue("pre:KeyA", "pre:Value A 2", data2v1);
        putValue("pre:KeyB", "pre:Value A 1", data2v1);
        EDBObject v12 = new EDBObject("pre:/test/object2", data2v1);
        ci.insert(v12);
        Map<String, EDBObjectEntry> data3v1 = new HashMap<String, EDBObjectEntry>();
        putValue("pre:KeyA", "pre:Value A 3", data3v1);
        putValue("pre:KeyB", "pre:Value A 1", data3v1);
        EDBObject v13 = new EDBObject("pre:/test/object3", data3v1);
        ci.insert(v13);

        long time1 = db.commit(ci);

        Map<String, EDBObjectEntry> data1v2 = new HashMap<String, EDBObjectEntry>();
        putValue("pre:KeyA", "pre:Value A 1", data1v2);
        putValue("pre:KeyB", "pre:Value A 1", data1v2);
        EDBObject v21 = new EDBObject("pre:/test/object1", data1v2);
        ci = getEDBCommit();
        ci.update(v21);
        Map<String, EDBObjectEntry> data2v2 = new HashMap<String, EDBObjectEntry>();
        putValue("pre:KeyA", "pre:Value A 2", data2v2);
        putValue("pre:KeyB", "pre:Value A 1", data2v2);
        EDBObject v22 = new EDBObject("pre:/test/object2", data2v2);
        ci.update(v22);
        Map<String, EDBObjectEntry> data4v1 = new HashMap<String, EDBObjectEntry>();
        putValue("pre:KeyA", "pre:Value A 4", data4v1);
        putValue("pre:KeyB", "pre:Value A 1", data4v1);
        EDBObject v23 = new EDBObject("pre:/test/object4", data4v1);
        ci.update(v23);

        long time2 = db.commit(ci);

        Map<String, EDBObjectEntry> data1v3 = new HashMap<String, EDBObjectEntry>();
        putValue("pre:KeyA", "pre:Value A 1", data1v3);
        putValue("pre:KeyB", "pre:Value A 1", data1v3);
        EDBObject v31 = new EDBObject("pre:/test/object1", data1v3);
        ci = getEDBCommit();
        ci.update(v31);
        Map<String, EDBObjectEntry> data2v3 = new HashMap<String, EDBObjectEntry>();
        putValue("pre:KeyA", "pre:Value A 2a", data2v3);
        putValue("pre:KeyB", "pre:Value A 1", data2v3);
        EDBObject v32 = new EDBObject("pre:/test/object2", data2v3);
        ci.update(v32);
        Map<String, EDBObjectEntry> data4v2 = new HashMap<String, EDBObjectEntry>();
        putValue("pre:KeyA", "pre:Value A 4", data4v2);
        putValue("pre:KeyB", "pre:Value A 1", data4v2);
        EDBObject v33 = new EDBObject("pre:/test/object4", data4v2);
        ci.update(v33);

        long time3 = db.commit(ci);
        List<EDBObject> result = db.query(QueryRequest.query("pre:KeyB", "pre:Value A 1")
            .setTimestamp(time2));
View Full Code Here

    public void testQueryWithTimestamp_shouldWork() throws Exception {
        Map<String, EDBObjectEntry> data1 = new HashMap<String, EDBObjectEntry>();
        putValue("K", "B", data1);
        putValue("Cow", "Milk", data1);
        putValue("Dog", "Food", data1);
        EDBObject v1 = new EDBObject("/test/querynew1", data1);
        EDBCommit ci = getEDBCommit();
        ci.insert(v1);
        db.commit(ci);

        data1 = new HashMap<String, EDBObjectEntry>();
        putValue("Dog", "Food", data1);
        v1 = new EDBObject("/test/querynew1", data1);
        ci = getEDBCommit();
        ci.update(v1);
        db.commit(ci);

        data1 = new HashMap<String, EDBObjectEntry>();
        putValue("K", "B", data1);
        putValue("Dog", "Food", data1);
        v1 = new EDBObject("/test/querynew2", data1);
        ci = getEDBCommit();
        ci.insert(v1);
        db.commit(ci);
        List<EDBObject> result = db.query(QueryRequest.query("K", "B"));
        assertThat(result.size(), is(1));
View Full Code Here

    public void testQueryWithTimestampAndEmptyMap_shouldWork() throws Exception {
        Map<String, EDBObjectEntry> data1 = new HashMap<String, EDBObjectEntry>();
        putValue("K", "B", data1);
        putValue("Cow", "Milk", data1);
        putValue("Dog", "Food", data1);
        EDBObject v1 = new EDBObject("/test/querynew3", data1);
        EDBCommit ci = getEDBCommit();
        ci.insert(v1);
        db.commit(ci);

        data1 = new HashMap<String, EDBObjectEntry>();
        putValue("Dog", "Food", data1);
        v1 = new EDBObject("/test/querynew3", data1);
        ci = getEDBCommit();
        ci.update(v1);
        db.commit(ci);

        data1 = new HashMap<String, EDBObjectEntry>();
        putValue("K", "B", data1);
        putValue("Dog", "Food", data1);
        v1 = new EDBObject("/test/querynew4", data1);
        ci = getEDBCommit();
        ci.insert(v1);
        db.commit(ci);

        List<EDBObject> result = db.query(QueryRequest.create());
        EDBObject result1 = getEDBObjectOutOfList(result, "/test/querynew3");
        EDBObject result2 = getEDBObjectOutOfList(result, "/test/querynew4");
        assertThat(result.size(), is(2));
        assertThat(result1.containsKey("K"), is(false));
        assertThat(result2.containsKey("Dog"), is(true));
    }
View Full Code Here

    @Test
    public void testQueryOfLastKnownVersion_shouldWork() throws Exception {
        Map<String, EDBObjectEntry> data1v1 = new HashMap<String, EDBObjectEntry>();
        putValue("KeyA", "Value A 1", data1v1);
        putValue("KeyB", "Value A 1", data1v1);
        EDBObject v11 = new EDBObject("/test/object1", data1v1);
        EDBCommit ci = getEDBCommit();
        ci.insert(v11);
        Map<String, EDBObjectEntry> data2v1 = new HashMap<String, EDBObjectEntry>();
        putValue("KeyA", "Value A 2", data2v1);
        putValue("KeyB", "Value A 1", data2v1);
        EDBObject v12 = new EDBObject("/test/object2", data2v1);
        ci.insert(v12);
        Map<String, EDBObjectEntry> data3v1 = new HashMap<String, EDBObjectEntry>();
        putValue("KeyA", "Value A 3", data3v1);
        putValue("KeyB", "Value A 1", data3v1);
        EDBObject v13 = new EDBObject("/test/object3", data3v1);
        ci.insert(v13);

        long time1 = db.commit(ci);

        ci = getEDBCommit();
        Map<String, EDBObjectEntry> data1v2 = new HashMap<String, EDBObjectEntry>();
        putValue("KeyA", "Value A 1", data1v2);
        putValue("KeyB", "Value A 1", data1v2);
        EDBObject v21 = new EDBObject("/test/object1", data1v2);
        ci.update(v21);
        Map<String, EDBObjectEntry> data2v2 = new HashMap<String, EDBObjectEntry>();
        putValue("KeyA", "Value A 2", data2v2);
        putValue("KeyB", "Value A 1", data2v2);
        EDBObject v22 = new EDBObject("/test/object2", data2v2);
        ci.update(v22);

        long time2 = db.commit(ci);

        ci = getEDBCommit();
        Map<String, EDBObjectEntry> data2v3 = new HashMap<String, EDBObjectEntry>();
        putValue("KeyA", "Value A 2a", data2v3);
        putValue("KeyB", "Value A 1", data2v3);
        EDBObject v32 = new EDBObject("/test/object2", data2v3);
        ci.update(v32);
        Map<String, EDBObjectEntry> data4v1 = new HashMap<String, EDBObjectEntry>();
        putValue("KeyA", "Value A 4", data4v1);
        putValue("KeyB", "Value A 1", data4v1);
        EDBObject v33 = new EDBObject("/test/object4", data4v1);
        ci.insert(v33);

        long time3 = db.commit(ci);

        Map<String, Object> map = new HashMap<String, Object>();
View Full Code Here

    @Test
    public void testIfQueryingWithLikeWorks_shouldWork() throws Exception {
        Map<String, EDBObjectEntry> data1 = new HashMap<String, EDBObjectEntry>();
        putValue("bla", "teststring", data1);
        EDBObject v1 = new EDBObject("/test/query/8", data1);
        EDBCommit ci = getEDBCommit();
        ci.insert(v1);
        db.commit(ci);
        List<EDBObject> result = db.query(QueryRequest.query("bla", "test%").wildcardAware());
        assertThat(result.size(), is(1));
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.