Package org.openengsb.core.api.model

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


        assertThat(bool, is(model.getTestBoolean()));
    }

    @Test
    public void testIfAddOpenEngSBModelEntryWork_shouldWork() throws Exception {
        ModelWrapper wrapper = ModelWrapper.wrap(new TestModel());
        wrapper.addOpenEngSBModelEntry(new OpenEngSBModelEntry("test", "test", String.class));
        List<OpenEngSBModelEntry> entries = wrapper.toOpenEngSBModelEntries();
        String test = null;
        for (OpenEngSBModelEntry entry : entries) {
            if (entry.getKey().equals("test")) {
                test = (String) entry.getValue();
            }
View Full Code Here


        assertThat(test, is("test"));
    }
   
    @Test
    public void testIfToOpenEngSBModelValuesWork_shouldWork() throws Exception {
        ModelWrapper wrapper = ModelWrapper.wrap(new TestModel());
        int before = wrapper.toOpenEngSBModelValues().size();
        wrapper.addOpenEngSBModelEntry(new OpenEngSBModelEntry("test", "test", String.class));
        int after = wrapper.toOpenEngSBModelValues().size();
        assertThat(before, is(after));
    }
View Full Code Here

        assertThat(before, is(after));
    }

    @Test
    public void testIfRemoveOpenEngSBModelEntryWork_shouldWork() throws Exception {
        ModelWrapper wrapper = ModelWrapper.wrap(new TestModel());
        wrapper.addOpenEngSBModelEntry(new OpenEngSBModelEntry("test", "test", String.class));
        wrapper.removeOpenEngSBModelEntry("test");
        // the result has three elements even though the model has four properties,
        // since the third property is ignored
        assertThat(wrapper.toOpenEngSBModelEntries().size(), is(3));
    }
View Full Code Here

        assertThat(id, is(model.getId()));
    }

    @Test
    public void testIfModelTailRetrievingWorks_shouldWork() throws Exception {
        ModelWrapper wrapper = ModelWrapper.wrap(new TestModel());
        wrapper.addOpenEngSBModelEntry(new OpenEngSBModelEntry("test", "test", String.class));
        List<OpenEngSBModelEntry> tail = wrapper.getOpenEngSBModelTail();
        assertThat(tail.size(), is(1));
        assertThat(tail.get(0).getKey(), is("test"));
    }
View Full Code Here

        assertThat(tail.get(0).getKey(), is("test"));
    }

    @Test
    public void testIfModelTailSettingWorks_shouldWork() throws Exception {
        ModelWrapper wrapper = ModelWrapper.wrap(new TestModel());
        List<OpenEngSBModelEntry> entries = new ArrayList<OpenEngSBModelEntry>();
        entries.add(new OpenEngSBModelEntry("test", "test", String.class));
        entries.add(new OpenEngSBModelEntry("test2", "test2", String.class));
        entries.add(new OpenEngSBModelEntry("test3", "test3", String.class));
        wrapper.setOpenEngSBModelTail(entries);
        assertThat(wrapper.getOpenEngSBModelTail().size(), is(3));
    }
View Full Code Here

        assertThat(wrapper.getOpenEngSBModelTail().size(), is(3));
    }

    @Test
    public void testIfNullModelTailSettingWorks_shouldThrowNoException() throws Exception {
        ModelWrapper wrapper = ModelWrapper.wrap(new TestModel());
        wrapper.setOpenEngSBModelTail(null);
        assertThat(wrapper.getOpenEngSBModelTail().size(), is(0));
    }
View Full Code Here

    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

        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

        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

        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

TOP

Related Classes of org.openengsb.core.api.model.ModelWrapper

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.