Package org.openengsb.core.edb.api

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


        model.setSubs(subs);

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

        EDBObject mainObject = edbService.getObject(getModelOid("testSub/3"));
        EDBObject subObject1 = edbService.getObject(getModelOid("testSub/4"));
        EDBObject subObject2 = edbService.getObject(getModelOid("testSub/5"));

        assertThat(subObject1, notNullValue());
        assertThat(subObject2, notNullValue());
        assertThat(mainObject.getString("subs.0"), is(getModelOid("testSub/4")));
        assertThat(mainObject.getString("subs.1"), is(getModelOid("testSub/5")));
View Full Code Here


        // test
        commit = getTestEKBCommit().addDelete(root.getModel());
        persist.commit(commit);

        // assert
        EDBObject rRoot = edbService.getObject(getModelOid("root/1"));
        EDBObject rChild1 = edbService.getObject(getModelOid("child1/1"));
        EDBObject rChild2 = edbService.getObject(getModelOid("child2/1"));
        EDBObject rChild11 = edbService.getObject(getModelOid("child11/1"));
        EDBObject rChild12 = edbService.getObject(getModelOid("child12/1"));
        EDBObject rLeaf = edbService.getObject(getModelOid("leaf/1"));

        assertThat(rRoot.isDeleted(), is(true));
        assertThat(rChild1.isDeleted(), is(true));
        assertThat(rChild2.isDeleted(), is(true));
        assertThat(rChild11.isDeleted(), is(true));
        assertThat(rChild12.isDeleted(), is(true));
        assertThat(rLeaf.isDeleted(), is(true));
    }
View Full Code Here

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

        EDBObject testModel = edbService.getObject(getModelOid("submodeltest/5"));
        EDBObject subModel = edbService.getObject(getModelOid("submodeltest/5/1"));
        assertThat(testModel.isDeleted(), is(true));
        assertThat(subModel.isDeleted(), is(true));
    }
View Full Code Here

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

        EDBObject testModel = edbService.getObject(getModelOid("submodeltest/6"));
        EDBObject subModel1 = edbService.getObject(getModelOid("submodeltest/6/1"));
        EDBObject subModel2 = edbService.getObject(getModelOid("submodeltest/6/2"));
        assertThat(testModel.isDeleted(), is(true));
        assertThat(subModel1.isDeleted(), is(true));
        assertThat(subModel2.isDeleted(), is(true));
    }
View Full Code Here

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

        // check edb object
        EDBObject edbObject = edbService.getObject(getModelOid("ppm/0"));
        // check entry types
        assertThat(edbObject.get("booleanByGet").getType(), is(Boolean.class.getName()));
        assertThat(edbObject.get("booleanByIs").getType(), is(Boolean.class.getName()));
        assertThat(edbObject.get("primitiveChar").getType(), is(Character.class.getName()));
        assertThat(edbObject.get("primitiveShort").getType(), is(Short.class.getName()));
        assertThat(edbObject.get("primitiveInt").getType(), is(Integer.class.getName()));
        assertThat(edbObject.get("primitiveLong").getType(), is(Long.class.getName()));
        assertThat(edbObject.get("primitiveFloat").getType(), is(Float.class.getName()));
        assertThat(edbObject.get("primitiveDouble").getType(), is(Double.class.getName()));

        // check values
        assertThat(edbObject.getBoolean("booleanByGet"), is(true));
        assertThat(edbObject.getBoolean("booleanByIs"), is(true));
        assertThat(edbObject.getChar("primitiveChar"), is(Character.MAX_VALUE));
        assertThat(edbObject.getShort("primitiveShort"), is(Short.MAX_VALUE));
        assertThat(edbObject.getInteger("primitiveInt"), is(Integer.MAX_VALUE));
        assertThat(edbObject.getLong("primitiveLong"), is(Long.MAX_VALUE));
        assertThat(edbObject.getFloat("primitiveFloat"), is(Float.MAX_VALUE));
        assertThat(edbObject.getDouble("primitiveDouble"), is(Double.MAX_VALUE));
    }
View Full Code Here

        sub.setValue("teststring");
        model.setSub(sub);
        ConnectorInformation id = getTestConnectorInformation();

        List<EDBObject> objects = converter.convertModelToEDBObject(model, id);
        EDBObject object = objects.get(1);
        assertThat(object.getString("sub"), is(ModelWrapper.wrap(sub).getCompleteModelOID()));
        EDBObject subObject = objects.get(0);
        assertThat(subObject.getString("id"), is("sub"));
        assertThat(subObject.getString(EDBConstants.MODEL_TYPE), is(SubModel.class.getName()));
    }
View Full Code Here

        ConnectorInformation id = getTestConnectorInformation();

        // test
        List<EDBObject> objects = converter.convertModelToEDBObject(root, id);
        // assert
        EDBObject obj = objects.get(3);
        assertThat(obj.getString("id"), is("root"));
        assertThat(obj.getString(EDBConstants.MODEL_TYPE), is(RecursiveModel.class.getName()));
        assertThat(obj.getString("child"), is(ModelWrapper.wrap(rootChild).getCompleteModelOID()));

        obj = objects.get(2);
        assertThat(obj.getString("id"), is("root_child"));
        assertThat(obj.getString(EDBConstants.MODEL_TYPE), is(RecursiveModel.class.getName()));
        assertThat(obj.getString("child"), is(ModelWrapper.wrap(rootChildChild).getCompleteModelOID()));

        obj = objects.get(1);
        assertThat(obj.getString("id"), is("root_child_child"));
        assertThat(obj.getString(EDBConstants.MODEL_TYPE), is(RecursiveModel.class.getName()));
        assertThat(obj.getString("child"), is(ModelWrapper.wrap(rootChildChildChild).getCompleteModelOID()));

        obj = objects.get(0);
        assertThat(obj.getString("id"), is("root_child_child_child"));
        assertThat(obj.getString(EDBConstants.MODEL_TYPE), is(RecursiveModel.class.getName()));
        assertThat(obj.getString("child"), nullValue());
    }
View Full Code Here

        rootChild2.setChildren(child2Children);
        ConnectorInformation id = getTestConnectorInformation();
        // test
        List<EDBObject> objects = converter.convertModelToEDBObject(root, id);
        // assert
        EDBObject obj = objects.get(5);
        assertThat(obj.getString("id"), is("root"));
        assertThat(obj.getString(EDBConstants.MODEL_TYPE), is(RecursiveModel.class.getName()));
        assertThat(obj.getString("children.0"), is(ModelWrapper.wrap(rootChild1).getCompleteModelOID()));
        assertThat(obj.getString("children.1"), is(ModelWrapper.wrap(rootChild2).getCompleteModelOID()));

        obj = objects.get(4);
        assertThat(obj.getString("id"), is("root_child2"));
        assertThat(obj.getString(EDBConstants.MODEL_TYPE), is(RecursiveModel.class.getName()));
        assertThat(obj.getString("children.0"), is(ModelWrapper.wrap(child2Child1).getCompleteModelOID()));
        assertThat(obj.getString("children.1"), is(ModelWrapper.wrap(child2Child2).getCompleteModelOID()));

        obj = objects.get(3);
        assertThat(obj.getString("id"), is("child2_child2"));
        assertThat(obj.getString(EDBConstants.MODEL_TYPE), is(RecursiveModel.class.getName()));

        obj = objects.get(2);
        assertThat(obj.getString("id"), is("child2_child1"));
        assertThat(obj.getString(EDBConstants.MODEL_TYPE), is(RecursiveModel.class.getName()));

        obj = objects.get(1);
        assertThat(obj.getString("id"), is("root_child1"));
        assertThat(obj.getString(EDBConstants.MODEL_TYPE), is(RecursiveModel.class.getName()));
        assertThat(obj.getString("child"), is(ModelWrapper.wrap(child1Child1).getCompleteModelOID()));

        obj = objects.get(0);
        assertThat(obj.getString("id"), is("child1_child1"));
        assertThat(obj.getString(EDBConstants.MODEL_TYPE), is(RecursiveModel.class.getName()));
    }
View Full Code Here

    public void testIfEDBObjectsContainCorrectType_shouldWork() throws Exception {
        TestModel model = new TestModel();
        model.setNumber(42);
        ConnectorInformation id = getTestConnectorInformation();
        List<EDBObject> objects = converter.convertModelToEDBObject(model, id);
        EDBObject object = objects.get(0);
        EDBObjectEntry entry = object.get("number");
        assertThat(entry.getType(), is(Integer.class.getName()));
    }
View Full Code Here

        subs.add(sub1);
        subs.add(sub2);
        model.setSubs(subs);
        ConnectorInformation id = getTestConnectorInformation();
        List<EDBObject> objects = converter.convertModelToEDBObject(model, id);
        EDBObject object = objects.get(2);
        EDBObject subObject1 = objects.get(0);
        EDBObject subObject2 = objects.get(1);

        assertThat(object.getString(EDBConverter.getEntryNameForList("subs", 0)),
            is(ModelWrapper.wrap(sub1).getCompleteModelOID()));
        assertThat(object.getString(EDBConverter.getEntryNameForList("subs", 1)),
            is(ModelWrapper.wrap(sub2).getCompleteModelOID()));
        assertThat(subObject1.getString("id"), is("sub1"));
        assertThat(subObject1.getString(EDBConstants.MODEL_TYPE), is(SubModel.class.getName()));
        assertThat(subObject2.getString("id"), is("sub2"));
        assertThat(subObject2.getString(EDBConstants.MODEL_TYPE), is(SubModel.class.getName()));
    }
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.