Package org.openengsb.core.api.model

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


        assertTrue(service.supports(ConnectorConfiguration.class));
    }

    @Test
    public void testServiceInsertConfigurationWithBasicType_shouldInsertAndLoadConfiguration() throws Exception {
        ConnectorDescription desc1 = new ConnectorDescription();
        desc1.getAttributes().put("attr1", "attr1");
        desc1.getProperties().put("the answer to live", 42);
        desc1.getProperties().put("basic", "value");
        desc1.setConnectorType("connectorType1");
        desc1.setDomainType("domainType1");
        String id = UUID.randomUUID().toString();
        ConnectorConfiguration conf1 = new ConnectorConfiguration(id, desc1);
        persist(conf1);

        List<ConfigItem<ConnectorDescription>> loaded = service
            .load(ImmutableMap.of(Constants.CONNECTOR_PERSISTENT_ID, id));
        assertThat(loaded.size(), is(1));
        ConnectorConfiguration conf = (ConnectorConfiguration) loaded.get(0);
        assertEquals(conf.getConnectorId(), id);

        ConnectorDescription loadedDesc = conf.getContent();
        assertEquals("connectorType1", loadedDesc.getConnectorType());
        assertEquals("domainType1", loadedDesc.getDomainType());
        assertEquals(desc1.getAttributes(), loadedDesc.getAttributes());
        assertEquals(42, loadedDesc.getProperties().get("the answer to live"));
        assertEquals("value", loadedDesc.getProperties().get("basic"));
    }
View Full Code Here


    }

    @Test
    public void testServiceInsertConfigurationWithArray_shouldInsertAndLoadConfiguration() throws Exception {
        String id2 = UUID.randomUUID().toString();
        ConnectorDescription desc2 = new ConnectorDescription();
        desc2.getAttributes().put("attr2", "attr2");
        desc2.getAttributes().put("foo", "bar");
        int[] property = new int[]{ 5, 10, 15, 25 };
        String[] property2 = new String[]{ "a", "b", "c" };
        desc2.getProperties().put("prop1", property);
        desc2.getProperties().put("prop2", property2);
        desc2.setConnectorType("connectorType2");
        desc2.setDomainType("domainType2");
        ConnectorConfiguration conf2 = new ConnectorConfiguration(id2, desc2);
        persist(conf2);

        List<ConfigItem<ConnectorDescription>> loaded = service
            .load(ImmutableMap.of(Constants.CONNECTOR_PERSISTENT_ID, id2));
        assertThat(loaded.size(), is(1));
        ConnectorConfiguration conf = (ConnectorConfiguration) loaded.get(0);
        assertEquals(conf.getConnectorId(), id2);

        ConnectorDescription loadedDesc = conf.getContent();
        assertEquals(desc2.getAttributes(), loadedDesc.getAttributes());
        assertTrue(Arrays.equals(property, (int[]) loadedDesc.getProperties()
            .get("prop1")));
        assertTrue(Arrays.equals(property2, (String[]) loadedDesc
            .getProperties().get("prop2")));
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    @Test
    public void testServiceInsertConfigurationWithCollection_shouldInsertAndLoadConfigurations() throws Exception {
        String id3 = UUID.randomUUID().toString();
        ConnectorDescription desc3 = new ConnectorDescription();
        desc3.setConnectorType("connectorType3");
        desc3.setDomainType("domainTyp3");
        desc3.getAttributes().put("attr3", "attr3");
        Set<String> stringSet = new HashSet<String>();
        stringSet.add("foo");
        stringSet.add("bar");
        desc3.getProperties().put("prop1", stringSet);
        List<Integer> intList = new LinkedList<Integer>();
        intList.add(5);
        intList.add(33);
        desc3.getProperties().put("prop2", intList);
        ConnectorConfiguration conf3 = new ConnectorConfiguration(id3, desc3);
        persist(conf3);

        List<ConfigItem<ConnectorDescription>> loaded = service
            .load(ImmutableMap.of(Constants.CONNECTOR_PERSISTENT_ID, id3));
        assertThat(loaded.size(), is(1));
        ConnectorConfiguration conf = (ConnectorConfiguration) loaded.get(0);
        assertEquals(conf.getConnectorId(), id3);

        ConnectorDescription loadedDesc = conf.getContent();
        assertEquals(desc3.getAttributes(), loadedDesc.getAttributes());

        Set<String> loadedSet = (HashSet<String>) loadedDesc.getProperties()
            .get("prop1");
        assertThat(loadedSet.size(), is(2));
        assertTrue(loadedSet.containsAll(stringSet));

        List<Integer> loadedList = (LinkedList<Integer>) loadedDesc
            .getProperties().get("prop2");
        assertThat(loadedList.size(), is(2));
        assertTrue(loadedList.equals(intList));
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    @Test
    public void testServiceUpdateConfiguration_shouldUpdateConfiguration() throws Exception {
        String id4 = UUID.randomUUID().toString();
        ConnectorDescription desc = new ConnectorDescription();
        desc.setConnectorType("connectorType4");
        desc.setDomainType("domainType4");
        desc.getAttributes().put("attr", "attr");
        Set<String> stringSet = new HashSet<String>();
        stringSet.add("foo");
        stringSet.add("bar");
        desc.getProperties().put("prop", stringSet);
        ConnectorConfiguration conf = new ConnectorConfiguration(id4, desc);
        persist(conf);

        List<Integer> intList = new ArrayList<Integer>();
        intList.add(42);
        desc.getProperties().put("prop", intList);
        persist(conf);

        List<ConfigItem<ConnectorDescription>> loaded = service
            .load(ImmutableMap.of(Constants.CONNECTOR_PERSISTENT_ID, id4));
        assertThat(loaded.size(), is(1));
        ConnectorConfiguration loadedConf = (ConnectorConfiguration) loaded
            .get(0);
        assertEquals(conf.getConnectorId(), id4);

        ConnectorDescription loadedDesc = loadedConf.getContent();
        assertEquals(desc.getAttributes(), loadedDesc.getAttributes());
        assertThat(loadedDesc.getProperties().size(), is(1));
        List<Integer> loadedList = (ArrayList<Integer>) loadedDesc
            .getProperties().get("prop");
        assertThat(loadedList.size(), is(1));
        assertTrue(loadedList.equals(intList));
    }
View Full Code Here

    }

    @Test
    public void testServiceRemoveConfiguration_shouldDeleteConfiguration() throws Exception {
        String id5 = UUID.randomUUID().toString();
        ConnectorDescription desc = new ConnectorDescription();
        desc.setConnectorType("connectorType5");
        desc.setDomainType("domainType5");
        desc.getAttributes().put("attr", "attr");
        Set<String> stringSet = new HashSet<String>();
        stringSet.add("foo");
        stringSet.add("bar");
        desc.getProperties().put("prop", stringSet);
        ConnectorConfiguration conf = new ConnectorConfiguration(id5, desc);

        persist(conf);
        List<ConfigItem<ConnectorDescription>> loaded = service
            .load(ImmutableMap.of(Constants.CONNECTOR_PERSISTENT_ID, id5));
View Full Code Here

    /*
     * edit an existing connector
     */
    public ConnectorEditorPage(String id) {
        ConnectorDescription desc = serviceManager.getAttributeValues(id);
        connectorType = desc.getConnectorType();
        domainType = desc.getDomainType();
        initEditor();
        createEditor(id, desc);
    }
View Full Code Here

        connectorType = parameters.get("connectorType").toOptionalString();
        initEditor();
        StringValue idValue = parameters.get("id");
        if (!idValue.isEmpty()) {
            String id = idValue.toString();
            ConnectorDescription desc = serviceManager.getAttributeValues(id);
            createEditor(id, desc);
        } else {
            createEditor();
        }
View Full Code Here

            if (def.getDefaultValue() != null) {
                String value = def.getDefaultValue().getString(Locale.getDefault());
                values.put(def.getId(), value);
            }
        }
        ConnectorDescription description = new ConnectorDescription(domainType, connectorType, values, null);
        editor =
            new ConnectorServiceEditor("editor", domainType, connectorType, attributes, description.getAttributes(),
                description.getProperties(), descriptor.getFormValidator());
        add(editor);
    }
View Full Code Here

            this.attributeMap = attributeMap;
        }

        @Override
        public void onSubmit() {
            ConnectorDescription connectorDescription =
                new ConnectorDescription(domainType, connectorType, attributeMap, properties);
            try {
                if (createMode) {
                    if (isValidating()) {
                        serviceManager.create(connectorDescription);
                    } else {
View Full Code Here

                LOGGER.debug("Start wiring {} with {}", globalName, instanceId);
                if (noGlobalNameSet() || noInstanceIdSet() || noContextSet()) {
                    target.add(feedbackPanel);
                    return;
                }
                ConnectorDescription description;
                try {
                    description = serviceManager.getAttributeValues(instanceId);
                    if (!typeOfGlobalAndServiceAreEqual(description.getDomainType())) {
                        target.add(feedbackPanel);
                        return;
                    }
                } catch (Exception e) {
                    presentAndLogError(new StringResourceModel("wiringInitError", this, null).getString(), e);
View Full Code Here

TOP

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

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.