Package org.openengsb.core.api

Examples of org.openengsb.core.api.ConnectorProvider


    private void retrieveDescriptor(String connectorType) {
        Filter filter =
            FilterUtils.makeFilter(ConnectorProvider.class,
                String.format("(%s=%s)", Constants.CONNECTOR_KEY, connectorType));

        ConnectorProvider connectorProvider = serviceUtils.getOsgiServiceProxy(filter, ConnectorProvider.class);
        descriptor = connectorProvider.getDescriptor();
    }
View Full Code Here


        ServiceDescriptor d =
            ServiceDescriptor.builder(new PassThroughStringLocalizer()).implementationType(NullDomainImpl.class)
                .id("a").name("sn").description("sd").attribute(attrib1)
                .build();

        ConnectorProvider provider = createConnectorProviderMock("testconnector", "testdomain");
        when(provider.getDescriptor()).thenReturn(d);
        createDomainProviderMock(NullDomain.class, "testdomain");
        factoryMock = createFactoryMock("testconnector", NullDomainImpl.class, "testdomain");
        tester.getApplication().getComponentInstantiationListeners()
            .add(new PaxWicketSpringBeanComponentInjector(tester.getApplication(), context));
    }
View Full Code Here

     * creates a ConnectorProvider with for the given connectorType and domains. This creates a mock of
     * {@link ConnectorProvider} that returns a descriptor-mock when calling {@link ConnectorProvider#getDescriptor()}
     * Also the service is registered with the mocked service-registry
     */
    protected ConnectorProvider createConnectorProviderMock(String connectorType, String... domains) {
        ConnectorProvider connectorProvider = mock(ConnectorProvider.class);
        when(connectorProvider.getId()).thenReturn(connectorType);

        Dictionary<String, Object> props = new Hashtable<String, Object>();
        props.put(org.openengsb.core.api.Constants.CONNECTOR_KEY, connectorType);
        props.put(org.openengsb.core.api.Constants.DOMAIN_KEY, domains);
        registerService(connectorProvider, props, ConnectorProvider.class);

        ServiceDescriptor descriptor = mock(ServiceDescriptor.class);
        when(descriptor.getId()).thenReturn(connectorType);
        LocalizableString name = mockLocalizeableString("service.name");
        when(descriptor.getName()).thenReturn(name);
        LocalizableString desc = mockLocalizeableString("service.description");
        when(descriptor.getDescription()).thenReturn(desc);
        when(connectorProvider.getDescriptor()).thenReturn(descriptor);
        return connectorProvider;
    }
View Full Code Here

            if (provider.getName().getString(Locale.getDefault()).equals(domainProviderName)) {
                domainProviderId = provider.getId();
            }
        }
        // get the connector which should be created
        ConnectorProvider connectorProvider =
            getConnectorToCreate(domainProviderId, attributes.get(ServiceCommands.CONNECTOR_TYPE));

        String id;
        if (attributes.isEmpty() || !attributes.containsKey(org.osgi.framework.Constants.SERVICE_PID)) {
            OutputStreamFormater.printValue("Please enter an ID");
            id = readUserInput();
        } else {
            id = attributes.get(org.osgi.framework.Constants.SERVICE_PID);
        }

        ServiceDescriptor descriptor = connectorProvider.getDescriptor();
        OutputStreamFormater.printValue(String.format("Please enter the attributes for %s, keep empty for default",
            descriptor.getName().getString(Locale.getDefault())));

        // 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

        }

        OutputStreamFormater.printValue("Please select the connector you want to create: ");
        Collections.sort(connectorProviders, Comparators.forConnectorProvider());
        for (int i = 0; i < connectorProviders.size(); i++) {
            ConnectorProvider connectorProvider = connectorProviders.get(i);
            ServiceDescriptor descriptor = connectorProvider.getDescriptor();
            OutputStreamFormater.printTabbedValues(9, String.format("[%s] %s", i,
                descriptor.getName().getString(Locale.getDefault())),
                descriptor.getDescription().getString(Locale.getDefault()));
        }
        String positionString = readUserInput();
View Full Code Here

        assertThat(list.get(1).getId(), is("b"));
        assertThat(list.get(2).getId(), is("z"));
    }

    private ConnectorProvider mockConnectorProvider(String id) {
        ConnectorProvider p1 = mock(ConnectorProvider.class);
        when(p1.getId()).thenReturn(id);
        return p1;
    }
View Full Code Here

        assertThat(provider.getId(), is("example"));
    }

    @Test
    public void testOsgiServiceProxy_shouldProxyService() throws Exception {
        ConnectorProvider proxy = getServiceUtils().getOsgiServiceProxy(
            FilterUtils.makeFilter(ConnectorProvider.class, String.format("(%s=example)",
                org.openengsb.core.api.Constants.CONNECTOR_KEY)), ConnectorProvider.class);
        assertThat(proxy.getId(), is("example"));
    }
View Full Code Here

TOP

Related Classes of org.openengsb.core.api.ConnectorProvider

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.