Search in sources :

Example 1 with ConnectorDto

use of org.apache.camel.catalog.connector.ConnectorDto in project camel by apache.

the class MavenArtifactProviderTest method testAddConnector.

@Test
public void testAddConnector() {
    CamelCatalog camelCatalog = new DefaultCamelCatalog();
    CamelConnectorCatalog camelConnectorCatalog = new DefaultCamelConnectorCatalog();
    MavenArtifactProvider provider = new DefaultMavenArtifactProvider();
    provider.setCacheDirectory("target/cache");
    int before = camelCatalog.findComponentNames().size();
    List<ConnectorDto> list = camelConnectorCatalog.findConnector("foo", false);
    assertEquals(0, list.size());
    Set<String> names = provider.addArtifactToCatalog(camelCatalog, camelConnectorCatalog, "org.apache.camel", "myfoo-connector", camelCatalog.getCatalogVersion());
    assertTrue(names.contains("MyFoo"));
    int after = camelCatalog.findComponentNames().size();
    assertTrue("Should find 1 new component", after - before == 1);
    list = camelConnectorCatalog.findConnector("foo", false);
    assertEquals(1, list.size());
    assertEquals("MyFoo", list.get(0).getName());
    assertTrue(camelCatalog.findComponentNames().contains("my-foo"));
}
Also used : DefaultCamelConnectorCatalog(org.apache.camel.catalog.connector.DefaultCamelConnectorCatalog) CamelCatalog(org.apache.camel.catalog.CamelCatalog) DefaultCamelCatalog(org.apache.camel.catalog.DefaultCamelCatalog) CamelConnectorCatalog(org.apache.camel.catalog.connector.CamelConnectorCatalog) DefaultCamelConnectorCatalog(org.apache.camel.catalog.connector.DefaultCamelConnectorCatalog) ConnectorDto(org.apache.camel.catalog.connector.ConnectorDto) DefaultCamelCatalog(org.apache.camel.catalog.DefaultCamelCatalog) Test(org.junit.Test)

Aggregations

CamelCatalog (org.apache.camel.catalog.CamelCatalog)1 DefaultCamelCatalog (org.apache.camel.catalog.DefaultCamelCatalog)1 CamelConnectorCatalog (org.apache.camel.catalog.connector.CamelConnectorCatalog)1 ConnectorDto (org.apache.camel.catalog.connector.ConnectorDto)1 DefaultCamelConnectorCatalog (org.apache.camel.catalog.connector.DefaultCamelConnectorCatalog)1 Test (org.junit.Test)1