Package org.openengsb.core.ekb.persistence.query.edb.models

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


            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

        }
    }

    @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

        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

        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

        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

        assertThat(sub.get(1).getValue(), is("DDDDD"));
    }

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

        List<SubModel> sub = model.getSubs();
        assertThat(sub.get(0).getId(), is("AAAAA"));
        assertThat(sub.get(0).getValue(), is("BBBBB"));
        assertThat(sub.get(1).getId(), is("CCCCC"));
        assertThat(sub.get(1).getValue(), is("DDDDD"));
    }
View Full Code Here

        assertThat(sub.get(1).getValue(), is("DDDDD"));
    }

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

        SubModel sub = model.getSub();
        assertThat(sub.getId(), is("testid"));
        assertThat(sub.getValue(), is("testvalue"));

        sub.setId("blabla");
        sub.setValue("blublub");
View Full Code Here

        assertThat(model.getEnumeration(), is(ENUM.B));
    }

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

        ENUM temp = model.getEnumeration();
        model.setEnumeration(ENUM.B);
        assertThat(temp, is(ENUM.A));
        assertThat(model.getEnumeration(), is(ENUM.B));
    }
View Full Code Here

        assertThat(model.getEnumeration(), is(ENUM.B));
    }

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

        boolean testExists = false;
        Object testValue = null;
        for (OpenEngSBModelEntry entry : entries) {
View Full Code Here

TOP

Related Classes of org.openengsb.core.ekb.persistence.query.edb.models.TestModel

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.