Package org.openengsb.core.api.model

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


   
    @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


    }

    @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

    }

    @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

    @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

    }
   
    @Test
    public void testIfPrimitiveModelCreationThroughEntriesWork_shouldWork() throws Exception {
        List<OpenEngSBModelEntry> entries = new ArrayList<OpenEngSBModelEntry>();
        entries.add(new OpenEngSBModelEntry("value1", 5, Integer.class));
        entries.add(new OpenEngSBModelEntry("value2", 42L, Long.class));
        entries.add(new OpenEngSBModelEntry("value3", true, Boolean.class));
        PrimitiveModel model = ModelUtils.createModel(PrimitiveModel.class, entries);
        assertThat(model.getValue1(), is(5));
        assertThat(model.getValue2(), is(42L));
        assertThat(model.isValue3(), is(true));
    }
View Full Code Here

        return entries;
    }
   
    @Override
    public List<OpenEngSBModelEntry> toOpenEngSBModelValues() {
        List<OpenEngSBModelEntry> entries = Arrays.asList(new OpenEngSBModelEntry("id", id, String.class),
            new OpenEngSBModelEntry("name", name, String.class),
            new OpenEngSBModelEntry("date", date, Date.class),
            new OpenEngSBModelEntry("test", enumeration, ENUM.class));
        for (int i = 0; i < list.size(); i++) {
            entries.add(new OpenEngSBModelEntry("list" + i, list.get(i), String.class));
        }
        if (sub != null) {
            entries.add(new OpenEngSBModelEntry("sub.id", sub.getId(), String.class));
            entries.add(new OpenEngSBModelEntry("sub.value", sub.getValue(), String.class));
        }
        return entries;
    }
View Full Code Here

        return entries;
    }
   
    @Override
    public List<OpenEngSBModelEntry> toOpenEngSBModelValues() {
        List<OpenEngSBModelEntry> entries = Arrays.asList(new OpenEngSBModelEntry("id", id, String.class),
            new OpenEngSBModelEntry("name", name, String.class),
            new OpenEngSBModelEntry("date", date, Date.class),
            new OpenEngSBModelEntry("test", enumeration, ENUM.class));
        for (int i = 0; i < list.size(); i++) {
            entries.add(new OpenEngSBModelEntry("list" + i, list.get(i), String.class));
        }
        if (sub != null) {
            entries.add(new OpenEngSBModelEntry("sub.id", sub.getId(), String.class));
            entries.add(new OpenEngSBModelEntry("sub.value", sub.getValue(), String.class));
        }
        return entries;
    }
View Full Code Here

    }

    @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

        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
View Full Code Here

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

        model.setName("test2");
        OpenEngSBModelEntry entry = new OpenEngSBModelEntry(EDBConstants.MODEL_VERSION, 0, Integer.class);
        ModelWrapper.wrap(model.getModel()).addOpenEngSBModelEntry(entry);
        commit = getTestEKBCommit().addUpdate(model.getModel());
        persist.commit(commit);
    }
View Full Code Here

TOP

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

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.