Examples of TestModel


Examples of org.openengsb.core.ekb.common.models.TestModel

        assertThat(entry.getType(), is(Integer.class.getName()));
    }

    @Test
    public void testComplexListModelToEDBObjectConversion_shouldWork() throws Exception {
        TestModel model = new TestModel();
        model.setId("test");
        SubModel sub1 = new SubModel();
        sub1.setId("sub1");
        sub1.setValue("teststring1");
        SubModel sub2 = new SubModel();
        sub2.setId("sub2");
        sub2.setValue("teststring2");
        List<SubModel> subs = new ArrayList<SubModel>();
        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);
View Full Code Here

Examples of org.openengsb.core.ekb.common.models.TestModel

    @Test
    public void testMapModelToEDBObjectConversion_shouldWork() throws Exception {
        Map<String, String> map = new HashMap<String, String>();
        map.put("keyA", "valueA");
        map.put("keyB", "valueB");
        TestModel model = new TestModel();
        model.setId("test");
        model.setMap(map);
        ConnectorInformation id = getTestConnectorInformation();
        EDBObject object = converter.convertModelToEDBObject(model, id).get(0);

        assertThat(object.getString(EDBConverter.getEntryNameForMapKey("map", 0)), is("keyA"));
        assertThat(object.getString(EDBConverter.getEntryNameForMapValue("map", 0)), is("valueA"));
View Full Code Here

Examples of org.openengsb.core.ekb.persistence.persist.edb.models.TestModel

        ContextHolder.get().setCurrentContextId("test");
    }

    @Test
    public void testIfModelAgentIsSet_shouldWork() throws Exception {
        TestModel model = new TestModel();
        assertThat("TestModel isn't enhanced. Maybe you forgot to set the java agent?",
            ModelWrapper.isModel(model.getClass()), is(true));
    }
View Full Code Here

Examples of org.openengsb.core.ekb.persistence.persist.edb.models.TestModel

public class ModelDiffTest {

    @Test
    public void testIfModelAgentIsSet_shouldWork() throws Exception {
        TestModel model = new TestModel();
        assertThat("TestModel isn't enhanced. Maybe you forgot to set the java agent?",
            ModelWrapper.isModel(model.getClass()), is(true));
    }
View Full Code Here

Examples of org.openengsb.core.ekb.persistence.query.edb.models.TestModel

        service.setQueryParsers(parsers);
    }

    @Test
    public void testIfModelAgentIsSet_shouldWork() throws Exception {
        TestModel model = new TestModel();
        assertThat("TestModel isn't enhanced. Maybe you forgot to set the java agent?",
            ModelWrapper.isModel(model.getClass()), is(true));
    }
View Full Code Here

Examples of org.openengsb.core.ekb.persistence.query.edb.models.TestModel

            ModelWrapper.isModel(model.getClass()), is(true));
    }

    @Test
    public void testGetOpenEngSBModelGeneral_shouldWork() throws Exception {
        TestModel model = service.getModel(TestModel.class, "testoid");
        TestModel model2 = ModelUtils.createModel(TestModel.class,
            ModelWrapper.wrap(model).toOpenEngSBModelEntries());

        assertThat(model.getId().equals(model2.getId()), is(true));
        assertThat(model.getDate().equals(model2.getDate()), is(true));
        assertThat(model.getEnumeration().equals(model2.getEnumeration()), is(true));
        assertThat(model.getName().equals(model2.getName()), is(true));
        assertThat(model.getSub().toString().equals(model2.getSub().toString()), is(true));
        List<SubModel> list = model.getSubs();
        List<SubModel> list2 = model2.getSubs();
        for (int i = 0; i < list.size(); i++) {
            assertThat(list.get(i).toString().equals(list2.get(i).toString()), is(true));
        }
    }
View Full Code Here

Examples of org.openengsb.core.ekb.persistence.query.edb.models.TestModel

        }
    }

    @Test
    public void testGetOpenEngSBModelEntriesForComplexElementWithProxiedInterface_shouldWork() throws Exception {
        TestModel model = service.getModel(TestModel.class, "testoid");
        List<OpenEngSBModelEntry> entries = ModelWrapper.wrap(model).toOpenEngSBModelEntries();
        SubModel sub = model.getSub();
        boolean subValue = false;

        for (OpenEngSBModelEntry entry : entries) {
            if (entry.getKey().equals("sub")) {
                SubModel s = (SubModel) entry.getValue();
View Full Code Here

Examples of org.openengsb.core.ekb.persistence.query.edb.models.TestModel

        assertThat(sub.getValue(), is("testvalue"));
    }

    @Test
    public void testGetOpenEngSBModelEntriesForListOfComplexElementsWithProxiedInterface_shouldWork() throws Exception {
        TestModel model = service.getModel(TestModel.class, "testoid");
        List<OpenEngSBModelEntry> entries = ModelWrapper.wrap(model).toOpenEngSBModelEntries();

        SubModel subModel1 = null;
        SubModel subModel2 = null;
View Full Code Here

Examples of org.openengsb.core.ekb.persistence.query.edb.models.TestModel

        assertThat(subModel2.getValue(), is("DDDDD"));
    }

    @Test
    public void testGetModelWithProxiedInterface_shouldWork() throws Exception {
        TestModel model = service.getModel(TestModel.class, "testoid");

        assertThat(model.getName(), is("testname"));
        assertThat(model.getId(), is("testid"));
        assertThat(model.getDate(), instanceOf(Date.class));
        assertThat(model.getEnumeration(), is(ENUM.A));
    }
View Full Code Here

Examples of org.openengsb.core.ekb.persistence.query.edb.models.TestModel

        assertThat(testList.get(2), is("test3"));
    }

    @Test
    public void testListAsParameterWithProxiedInterface_shouldWork() throws Exception {
        TestModel model = service.getModel(TestModel.class, "testoid");

        List<String> testList = model.getList();
        assertThat(testList.size(), is(3));
        assertThat(testList.get(0), is("blub"));
        assertThat(testList.get(1), is("blab"));
        assertThat(testList.get(2), is("blob"));

        List<String> temp = new ArrayList<String>();
        temp.add("test1");
        temp.add("test2");
        temp.add("test3");
        model.setList(temp);
        testList = model.getList();
        assertThat(testList.size(), is(3));
        assertThat(testList.get(0), is("test1"));
        assertThat(testList.get(1), is("test2"));
        assertThat(testList.get(2), is("test3"));
    }
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.