Examples of ModelWrapper


Examples of org.openengsb.core.api.model.ModelWrapper

    public void testIfSuperModelsSupportWork_shouldWork() throws Exception {
        ChildModel model = new ChildModel();
        model.setId("testId");
        model.setName("testName");
        model.setChild("testChild");
        ModelWrapper wrapper = ModelWrapper.wrap(model);
        List<OpenEngSBModelEntry> entries = wrapper.toOpenEngSBModelEntries();
        assertThat((String) getEntryByName(entries, "id"), is("testId"));
        assertThat((String) getEntryByName(entries, "name"), is("testName"));
        assertThat((String) getEntryByName(entries, "child"), is("testChild"));
        assertThat((String) wrapper.retrieveInternalModelId(), is("testId"));
        assertThat((String) wrapper.retrieveInternalModelIdName(), is("id"));
    }
View Full Code Here

Examples of org.openengsb.core.api.model.ModelWrapper

        assertThat((String) wrapper.retrieveInternalModelIdName(), is("id"));
    }
   
    @Test
    public void testIfRetrieveModelNameWork_shouldReturnModelName() throws Exception {
        ModelWrapper wrapper = ModelWrapper.wrap(new TestModel());
        assertThat(wrapper.retrieveModelName(), is(TestModel.class.getName()));
    }
View Full Code Here

Examples of org.openengsb.core.api.model.ModelWrapper

        assertThat(wrapper.retrieveModelName(), is(TestModel.class.getName()));
    }
   
    @Test
    public void testIfRetrieveModelVersionWork_shouldReturnModelVersion() throws Exception {
        ModelWrapper wrapper = ModelWrapper.wrap(new TestModel());
        assertThat(wrapper.retrieveModelVersion(), is(new Version("1.0.0").toString()));
    }
View Full Code Here

Examples of org.openengsb.core.api.model.ModelWrapper

        sub1.setName("test1");
        SubModel sub2 = new SubModel();
        sub2.setId("sub2");
        sub2.setName("test2");
        model.setSubs(Arrays.asList(sub1, sub2));
        ModelWrapper wrapper = ModelWrapper.wrap(model);
        wrapper.addOpenEngSBModelEntry(new OpenEngSBModelEntry("test", "test", String.class));
        wrapper.addOpenEngSBModelEntry(new OpenEngSBModelEntry("test2", "test2", String.class));
        return model;
    }
View Full Code Here

Examples of org.openengsb.core.api.model.ModelWrapper

    }

    @Test
    public void tryConvertJSONIntoModelWithAdditionalSerializer_shouldThrowNoException() throws Exception {
        NullModel model = createTestModel();
        ModelWrapper wrapper = ModelWrapper.wrap(model);
        wrapper.addOpenEngSBModelEntry(new OpenEngSBModelEntry("number", 42, Integer.class));
        String result = mapper.writeValueAsString(model);

        NullModel other = JsonUtils.convertObject(result, NullModel.class);
        List<OpenEngSBModelEntry> entries = ModelWrapper.wrap(other).getOpenEngSBModelTail();
        assertThat(model.getId(), is(other.getId()));
View Full Code Here

Examples of org.openengsb.core.api.model.ModelWrapper

        model.setName("blub");

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

        ModelWrapper result = ModelWrapper.wrap(query.getModel(getTestModel(), getModelOid("modeltailtest/1")));
        Boolean versionPresent = result.retrieveInternalModelVersion() != null;
        assertThat(versionPresent, is(true));
    }
View Full Code Here

Examples of org.openengsb.core.api.model.ModelWrapper

        model.setName("blub");
        model.setEdbId("modelmetatest/1");

        EKBCommit commit = getTestEKBCommit().addInsert(model.getModel());
        persist.commit(commit);
        ModelWrapper wrapper = ModelWrapper.wrap(query.getModel(getTestModel(), getModelOid("modelmetatest/1")));
        assertThat(wrapper.toOpenEngSBModelEntries(), notNullValue());
        assertThat(wrapper.retrieveInternalModelId(), notNullValue());
        assertThat(wrapper.retrieveInternalModelVersion(), notNullValue());
        assertThat(wrapper.retrieveInternalModelTimestamp(), notNullValue());
    }
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.