Package org.openengsb.core.services.internal.model

Examples of org.openengsb.core.services.internal.model.NullModel


        NullDomain service = (NullDomain) serviceUtils.getService("(foo=bar)", 100L);
        DummyModel dummyModel = new DummyModel();
        dummyModel.setId("42");
        dummyModel.setValue("foo");

        NullModel nullModel = new NullModel();
        nullModel.setId(42);
        nullModel.setValue("foo");
        when(transformationEngine.performTransformation(
            any(ModelDescription.class), any(ModelDescription.class), eq(dummyModel)))
            .thenReturn(nullModel);

        service.commitModel(dummyModel);
View Full Code Here


    public JsonSupportTest() {
        mapper = new ObjectMapper();
    }

    private NullModel createTestModel() {
        NullModel model = new NullModel();
        model.setId(20);
        model.setValue("test");
        SubModel sub1 = new SubModel();
        sub1.setId("sub1");
        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

        return model;
    }

    @Test(expected = IOException.class)
    public void tryConvertJSONIntoModelWithoutAdditionalSerializer_shouldThrowException() throws Exception {
        NullModel model = createTestModel();
        String result = mapper.writeValueAsString(model);
        // the read value call without the additional serialzer throws an IOException because it can not
        // deserialize the model tail
        mapper.readValue(result, NullModel.class);
    }
View Full Code Here

        mapper.readValue(result, NullModel.class);
    }

    @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()));
        assertThat(model.getValue(), is(other.getValue()));
        assertThat(model.getSubs().size(), is(other.getSubs().size()));
        assertThat(model.getSubs().get(0).getId(), is(other.getSubs().get(0).getId()));
        assertThat(model.getSubs().get(0).getName(), is(other.getSubs().get(0).getName()));
        assertThat(model.getSubs().get(1).getId(), is(other.getSubs().get(1).getId()));
        assertThat(model.getSubs().get(1).getName(), is(other.getSubs().get(1).getName()));
        assertThat(entries.size(), is(3));
        assertThat(entries.contains(new OpenEngSBModelEntry("test", "test", String.class)), is(true));
        assertThat(entries.contains(new OpenEngSBModelEntry("test2", "test2", String.class)), is(true));
        assertThat(entries.contains(new OpenEngSBModelEntry("number", 42, Integer.class)), is(true));
    }
View Full Code Here

TOP

Related Classes of org.openengsb.core.services.internal.model.NullModel

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.