Package org.openengsb.core.ekb.api.transformation

Examples of org.openengsb.core.ekb.api.transformation.TransformationDescription


        assertThat(result.getTestB(), is("works?!"));
    }

    @Test
    public void testRemoveLeadingText_shouldWork() throws Exception {
        TransformationDescription desc = getDescriptionForModelBToModelA();
        desc.removeLeadingField("idB", "idA", "[#?]+", "3");
        desc.removeLeadingField("testB", "testA", "#+", "2");
        desc.removeLeadingField("blubB", "blubA", "[#?]+", "0");
        desc.removeLeadingField("blubB", "blaA", "#+", "3");
        installTransformation(desc);

        ModelB model = new ModelB();
        model.setIdB("#?##blub");
        model.setTestB("##blub");
View Full Code Here


        assertThat(result.getBlaA(), is("?#?#?test"));
    }

    @Test
    public void testInstantiate_shouldWork() throws Exception {
        TransformationDescription desc = getDescriptionForModelAToModelB();
        desc.instantiateField("intValue", Integer.class.getName(), "parseInt", "idA");
        installTransformation(desc);

        ModelA model = new ModelA();
        model.setIdA("42");
View Full Code Here

        assertThat(result.getIntValue(), is(42));
    }

    @Test
    public void testInitiateWithNoParameters_shouldCreateInstance() throws Exception {
        TransformationDescription desc = getDescriptionForModelAToModelB();
        desc.instantiateField("elements", ArrayList.class.getName(), null);
        installTransformation(desc);
        ModelA model = new ModelA();
        ModelB result = transformModelAToModelB(model);
        assertThat(result.getElements(), notNullValue());
    }
View Full Code Here

        assertThat(result.getElements(), notNullValue());
    }
   
    @Test
    public void testInitiateWithParameters_shouldCreateInstance() throws Exception {
        TransformationDescription desc = getDescriptionForModelBToModelA();
        desc.instantiateField("nested", NestedObject.class.getName(), null, "testB", "blubB");
        installTransformation(desc);
        ModelB model = new ModelB();
        model.setTestB("testvalue1");
        model.setBlubB("testvalue2");
        ModelA result = transformModelBToModelA(model);
View Full Code Here

        assertThat(result.getNested().getValue2(), is(model.getBlubB()));
    }

    @Test
    public void testIfMergeIsWorking_shouldNotChangeUnusedField() throws Exception {
        TransformationDescription desc = getDescriptionForModelAToModelB();
        desc.forwardField("idA", "idB");
        desc.forwardField("testA", "testB");
        desc.forwardField("blubA", "#test");
        desc.forwardField("#test", "blubB");
        installTransformation(desc);

        ModelA model = new ModelA();
        model.setIdA("test1");
        model.setTestA("test2");
View Full Code Here

        assertThat(resultB.getIntValue(), is(1));
    }

    @Test
    public void testNestedFieldAccess_shouldWork() throws Exception {
        TransformationDescription desc = getDescriptionForModelAToModelB();
        desc.forwardField("idA", "idB");
        desc.forwardField("nested.value1", "testB");
        desc.forwardField("nested.value2", "blubB");
        installTransformation(desc);

        ModelA model = new ModelA();
        model.setIdA("test1");
View Full Code Here

        assertThat(result.getBlubB(), is("test3"));
    }

    @Test
    public void testNestedObjectsReadAccess_shouldWork() throws Exception {
        TransformationDescription desc = getDescriptionForModelAToModelB();
        desc.forwardField("idA", "idB");
        desc.forwardField("nested", "#test");
        desc.forwardField("#test.value1", "testB");
        desc.forwardField("#test.value2", "blubB");
        installTransformation(desc);

        ModelA model = new ModelA();
        model.setIdA("test1");
View Full Code Here

        assertThat(result.getBlubB(), is("test3"));
    }

    @Test
    public void testNestedObjectsWriteAccess_shouldWork() throws Exception {
        TransformationDescription desc = getDescriptionForModelAToModelB();
        desc.forwardField("idA", "idB");
        desc.forwardField("nested", "#test");
        desc.forwardField("blaA", "#test.value1");
        desc.forwardField("blubA", "#test.value2");
        desc.forwardField("#test.value1", "testB");
        desc.forwardField("#test.value2", "blubB");
        installTransformation(desc);

        ModelA model = new ModelA();
        model.setIdA("test1");
        model.setBlaA("test2");
View Full Code Here

            getExampleRequestDescription(), model);
    }

    @Test
    public void testIfTransformationWorks_shouldWork() throws Exception {
        TransformationDescription description =
            new TransformationDescription(getExampleRequestDescription(), getExampleResponseDescription());
        description.concatField("result", "-", "name", "id");
        transformationEngine.saveDescription(description);

        ExampleRequestModel modelA = new ExampleRequestModel();
        modelA.setName("test");
        modelA.setId(42);
View Full Code Here

        BundleContext context = getBundleContext();
        Dictionary<String, String> dictionary = new Hashtable<String, String>();
        dictionary.put("transformation.operation", "dummy");
        context.registerService(TransformationOperation.class, new DummyTransformationOperation(), dictionary);

        TransformationDescription description =
            new TransformationDescription(getExampleResponseDescription(), getExampleRequestDescription());
        description.addStep("dummy", Arrays.asList("result"), "name", new HashMap<String, String>());
        transformationEngine.saveDescription(description);

        ExampleResponseModel modelA = new ExampleResponseModel();
        modelA.setResult("teststring");
View Full Code Here

TOP

Related Classes of org.openengsb.core.ekb.api.transformation.TransformationDescription

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.