Examples of EDBObject


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

    }

    @Test
    public void testQueryForObject_shouldWork() throws Exception {
        EDBCommit commit = edbService.createEDBCommit(null, null, null);
        EDBObject testObject = new EDBObject("newtestobject1");
        testObject.putEDBObjectEntry("newtestkey1", "newtestvalue1");
        commit.insert(testObject);

        edbService.commit(commit);

        List<EDBObject> objects = edbService.query(QueryRequest.query("newtestkey1", "newtestvalue1"));
View Full Code Here

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

    }

    @Test(expected = EDBException.class)
    public void testConflictDetection_shouldThrowException() throws Exception {
        EDBCommit commit = edbService.createEDBCommit(null, null, null);
        EDBObject testObject = new EDBObject("newtestobject2");
        testObject.putEDBObjectEntry("newtestkey2", "newtestvalue2");
        commit.insert(testObject);

        edbService.commit(commit);

        commit = edbService.createEDBCommit(null, null, null);

        EDBObject obj = edbService.getObject("newtestobject2");
        obj.putEDBObjectEntry(EDBConstants.MODEL_VERSION, Integer.valueOf(0));
        obj.putEDBObjectEntry("test", "test");

        commit.update(obj);
        edbService.commit(commit);
    }
View Full Code Here

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

        model.setName("test");
        model.setEdbId("createevent/2");
        EKBCommit commit = getTestEKBCommit().addInsert(model.getModel());
        persist.commit(commit);

        EDBObject obj = edbService.getObject(getModelOid("createevent/2"));
        String name = obj.getString("name");
        Integer version = obj.getObject(EDBConstants.MODEL_VERSION, Integer.class);

        assertThat(name, is("test"));
        assertThat(version, is(1));
    }
View Full Code Here

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

        model.setName("test1");
        model.setEdbId("batchevent/1");
        EKBCommit commit = getTestEKBCommit().addInsert(model.getModel());
        persist.commit(commit);

        EDBObject obj = edbService.getObject(getModelOid("batchevent/1"));
        String name1 = obj.getString("name");
        Integer version1 = obj.getObject(EDBConstants.MODEL_VERSION, Integer.class);

        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);
        obj = edbService.getObject(getModelOid("batchevent/2"));
        String name3 = obj.getString("name");
        Integer version3 = obj.getObject(EDBConstants.MODEL_VERSION, Integer.class);

        assertThat(name1, is("test1"));
        assertThat(version1, is(1));
        assertThat(name2, is("test2"));
        assertThat(version2, is(2));
View Full Code Here

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

        assertThat(object.getDouble("wrappedDouble"), is(Double.MAX_VALUE));
    }

    @Test
    public void wrappedPropertyConversion_toModel_works() {
        EDBObject object = new EDBObject("test");
        object.putEDBObjectEntry(EDBConstants.MODEL_TYPE, WrappedPropertiesModel.class.getName());
        object.putEDBObjectEntry(EDBConstants.MODEL_OID, "test");
        object.putEDBObjectEntry(EDBConstants.MODEL_VERSION, Integer.valueOf(1));
        object.putEDBObjectEntry("id", "test");
        object.putEDBObjectEntry("booleanByGet", true);
        object.putEDBObjectEntry("booleanByIs", true);
        object.putEDBObjectEntry("wrappedChar", Character.MAX_VALUE);
        object.putEDBObjectEntry("wrappedShort", Short.MAX_VALUE);
        object.putEDBObjectEntry("wrappedInt", Integer.MAX_VALUE);
        object.putEDBObjectEntry("wrappedLong", Long.MAX_VALUE);
        object.putEDBObjectEntry("wrappedFloat", Float.MAX_VALUE);
        object.putEDBObjectEntry("wrappedDouble", Double.MAX_VALUE);

        WrappedPropertiesModel model = converter.convertEDBObjectToModel(WrappedPropertiesModel.class, object);
        assertThat(model.getId(), is("test"));
        assertThat(model.getBooleanByGet(), is(true));
        assertThat(model.isBooleanByIs(), is(true));
View Full Code Here

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

        model.setName("test1");
        model.setEdbId("updateevent/2");
        EKBCommit commit = getTestEKBCommit().addInsert(model.getModel());
        persist.commit(commit);

        EDBObject obj = edbService.getObject(getModelOid("updateevent/2"));
        String name1 = obj.getString("name");
        Integer version1 = obj.getObject(EDBConstants.MODEL_VERSION, Integer.class);
        model.setName("test2");
        commit = getTestEKBCommit().addUpdate(model.getModel());
        persist.commit(commit);

        obj = edbService.getObject(getModelOid("updateevent/2"));
        String name2 = obj.getString("name");
        Integer version2 = obj.getObject(EDBConstants.MODEL_VERSION, Integer.class);

        assertThat(name1, is("test1"));
        assertThat(version1, is(1));
        assertThat(name2, is("test2"));
        assertThat(version2, is(2));
View Full Code Here

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

    }

    @Test
    public void testIfLoadingOfCommitsWork_shouldWork() throws Exception {
        EDBCommit commit = edbService.createEDBCommit(null, null, null);
        EDBObject testObject = new EDBObject("commitload/1");
        testObject.putEDBObjectEntry("testkey", "testvalue");
        commit.insert(testObject);
        Long testtime = edbService.commit(commit);
        EDBCommit result = edbService.getCommit(testtime);
        assertThat(result.getInserts().size(), is(1));
    }
View Full Code Here

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

        model.setCheck3(false);

        ConnectorInformation id = getTestConnectorInformation();

        List<EDBObject> objects = converter.convertModelToEDBObject(model, id);
        EDBObject object = objects.get(0);

        assertThat(object.getString("connectorId"), is("testconnector"));
        assertThat(object.getString("id"), is("test"));
        assertThat(object.getString("oid"), is(ModelWrapper.wrap(model).getCompleteModelOID()));
        assertThat(object.getString("domainId"), is("testdomain"));
        assertThat(object.getString("name"), is("testobject"));
        assertThat(object.getString("instanceId"), is("testinstance"));
        assertThat(object.getObject("enumeration", ENUM.class), is(ENUM.A));
        assertThat(object.getObject("date", Date.class), is(date));
        assertThat(object.getObject("check", Boolean.class), is(false));
        assertThat(object.getObject("check2", Boolean.class), is(true));
        assertThat(object.getObject("check3", Boolean.class), is(false));
        assertThat(object.getString(EDBConstants.MODEL_TYPE), is(TestModel.class.getName()));
    }
View Full Code Here

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

        model.setName("test");
        model.setEdbId("updateevent/3");
        EKBCommit commit = getTestEKBCommit().addInsert(model.getModel());
        persist.commit(commit);

        EDBObject obj = edbService.getObject(getModelOid("updateevent/3"));
        Integer version1 = obj.getObject(EDBConstants.MODEL_VERSION, Integer.class);
        OpenEngSBModelEntry entry = new OpenEngSBModelEntry(EDBConstants.MODEL_VERSION, 0, Integer.class);
        ModelWrapper.wrap(model.getModel()).addOpenEngSBModelEntry(entry);
        commit = getTestEKBCommit().addUpdate(model.getModel());
        persist.commit(commit);

        // results in no conflict because the values are the same even if the version is different
        obj = edbService.getObject(getModelOid("updateevent/3"));
        Integer version2 = obj.getObject(EDBConstants.MODEL_VERSION, Integer.class);

        assertThat(version1, is(1));
        assertThat(version2, is(2));
    }
View Full Code Here

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

        model.setSubModel(sub.getModel());

        EKBCommit commit = getTestEKBCommit().addInsert(model.getModel());
        persist.commit(commit);

        EDBObject mainObject = edbService.getObject(getModelOid("testSub/1"));
        EDBObject subObject = edbService.getObject(getModelOid("testSub/2"));

        assertThat(subObject, notNullValue());
        assertThat(mainObject.getString("subModel"), is(getModelOid("testSub/2")));
    }
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.