Package org.openengsb.core.api.model

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


        Map<String, String> attributes = new HashMap<String, String>();
        attributes.put("value", "42");
        Hashtable<String, Object> properties = new Hashtable<String, Object>();
        properties.put("location.root", "domain/testdomain/default");
        serviceManager.createWithId("testdomain+testconnector+test-service",
            new ConnectorDescription("testdomain", "testconnector",
                attributes, properties));

        ServiceDescriptor serviceDescriptorMock = Mockito.mock(ServiceDescriptor.class);
        Mockito.when(serviceDescriptorMock.getName()).thenReturn(new PassThroughLocalizableString("service.name"));
        Mockito.when(serviceDescriptorMock.getDescription()).thenReturn(
View Full Code Here


    }

    public static ConnectorConfigurationJPAEntity generateFromConfigItem(
            ConfigItem<ConnectorDescription> config) {
        ConnectorConfigurationJPAEntity entity = new ConnectorConfigurationJPAEntity();
        ConnectorDescription desc = config.getContent();
        Map<String, String> metaData = config.getMetaData();

        entity.setInstanceId(metaData.get(Constants.CONNECTOR_PERSISTENT_ID));
        entity.setConnectorType(desc.getConnectorType());
        entity.setDomainType(desc.getDomainType());
        entity.setAttributes(desc.getAttributes());
        entity.setProperties(convertProperties(desc.getProperties()));
        return entity;
    }
View Full Code Here

            ConnectorConfigurationJPAEntity entity) throws PersistenceException {
        Map<String, String> metaData = new HashMap<String, String>();

        metaData.put(Constants.CONNECTOR_PERSISTENT_ID, entity.getInstanceId());

        ConnectorDescription desc = new ConnectorDescription();
        desc.setConnectorType(entity.getConnectorType());
        desc.setDomainType(entity.getDomainType());
        desc.setAttributes(entity.getAttributes());
        desc.setProperties(readProperties(entity.getProperties()));

        ConnectorConfiguration config = new ConnectorConfiguration(metaData,
            desc);
        return config;
    }
View Full Code Here

        // get attributes for connector
        Map<String, String> attributeMap = getConnectorAttributes(descriptor.getAttributes(), attributes);
        Map<String, Object> properties = new HashMap<String, Object>();

        ConnectorDescription connectorDescription =
            new ConnectorDescription(domainProviderId, connectorProvider.getId(), attributeMap, properties);
        if (force) {
            if (id != null && !id.isEmpty()) {
                serviceManager.forceCreateWithId(id, connectorDescription);
            } else {
                serviceManager.forceCreate(connectorDescription);
View Full Code Here

    public void testCreateService_shouldCreateInstanceWithFactory() throws Exception {
        Map<String, String> attributes = new HashMap<String, String>();
        attributes.put("answer", "42");
        Map<String, Object> properties = new Hashtable<String, Object>();
        properties.put("foo", "bar");
        ConnectorDescription connectorDescription = new ConnectorDescription("test", "testc", attributes, properties);

        connectorManager.create(connectorDescription);

        serviceUtils.getService("(foo=bar)", 100L);
    }
View Full Code Here

    public void testCreateService_shouldExist() throws Exception {
        Map<String, String> attributes = new HashMap<String, String>();
        attributes.put("answer", "42");
        Map<String, Object> properties = new Hashtable<String, Object>();
        properties.put("foo", "bar");
        ConnectorDescription connectorDescription = new ConnectorDescription("test", "testc", attributes, properties);

        String id = connectorManager.create(connectorDescription);

        boolean exists = connectorManager.connectorExists(id);
        assertTrue("Service doesn't exist after creation", exists);
View Full Code Here

    public void testUpdateService_shouldUpdateInstance() throws Exception {
        Map<String, String> attributes = new HashMap<String, String>();
        attributes.put("answer", "42");
        Map<String, Object> properties = new Hashtable<String, Object>();
        properties.put("foo", "bar");
        ConnectorDescription connectorDescription = new ConnectorDescription("test", "testc", attributes, properties);

        String uuid = connectorManager.create(connectorDescription);

        connectorDescription.getProperties().put("foo", "42");
        connectorDescription.getAttributes().put("answer", "43");
        connectorManager.update(uuid, connectorDescription);
    }
View Full Code Here

        when(factory.getValidationErrors(anyMap())).thenReturn(errorMessages);
        Map<String, String> attributes = new HashMap<String, String>();
        attributes.put("answer", "42");
        Map<String, Object> properties = new Hashtable<String, Object>();
        properties.put("foo", "bar");
        ConnectorDescription connectorDescription = new ConnectorDescription("test", "testc", attributes, properties);

        try {
            connectorManager.create(connectorDescription);
            fail("Exception expected");
        } catch (RuntimeException e) {
View Full Code Here

        when(factory.getValidationErrors(anyMap())).thenReturn(errorMessages);
        Map<String, String> attributes = new HashMap<String, String>();
        attributes.put("answer", "42");
        Map<String, Object> properties = new Hashtable<String, Object>();
        properties.put("foo", "bar");
        ConnectorDescription connectorDescription = new ConnectorDescription("test", "testc", attributes, properties);

        connectorManager.forceCreate(connectorDescription);

        try {
            serviceUtils.getService("(foo=bar)", 100L);
View Full Code Here

        when(factory.getValidationErrors(any(Connector.class), anyMap())).thenReturn(errorMessages);

        Map<String, String> attributes = new HashMap<String, String>();
        Map<String, Object> properties = new Hashtable<String, Object>();
        properties.put("foo", "bar");
        ConnectorDescription connectorDescription = new ConnectorDescription("test", "testc", attributes, properties);

        String connectorId = connectorManager.create(connectorDescription);
        serviceUtils.getService("(foo=bar)", 1L);

        connectorDescription.getProperties().put("foo", "42");
        try {
            connectorManager.update(connectorId, connectorDescription);
            fail("Exception expected");
        } catch (RuntimeException e) {
            assertThat(((ConnectorValidationFailedException) e.getCause()).getErrorMessages(), is(errorMessages));
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.