public ConnectorCatalog(ConnectorCatalogProperties props) { connectorCatalog = new DefaultCamelConnectorCatalog(); camelCatalog = new DefaultCamelCatalog(true); prefetchConnectors(); maven = new DefaultMavenArtifactProvider(); for (Map.Entry<String, String> repo : props.getMavenRepos().entrySet()) { maven.addMavenRepository(repo.getKey(), repo.getValue()); } for (String gav : props.getConnectorGAVs()) { addConnector(gav); } }
public void init() throws Exception { connectorCatalog = new DefaultCamelConnectorCatalog(); camelCatalog = new DefaultCamelCatalog(true); maven = new DefaultMavenArtifactProvider(); // add 3rd party maven repos System.out.println("Adding bintray and jcenter as 3rd party Maven repositories"); maven.addMavenRepository("jcenter", "https://jcenter.bintray.com"); }
public ComponentProxyComponent(String componentId, String componentScheme) { this.componentId = componentId; this.componentScheme = componentScheme; this.componentSchemeAlias = Optional.empty(); this.options = new HashMap<>(); this.catalog = new DefaultCamelCatalog(false); try { this.definition = ComponentDefinition.forScheme(catalog, componentScheme); } catch (IOException e) { throw ObjectHelper.wrapRuntimeCamelException(e); } registerExtension(this::getComponentVerifierExtension); }
public CamelTextDocumentService() { camelCatalog = CompletableFuture.supplyAsync(() -> { DefaultCamelCatalog res = new DefaultCamelCatalog(true); res.loadVersion("2.20.1"); return res; }); }
@Override public ArchetypeCatalog getArchetypeCatalog() { if (cachedArchetypes == null) { // use the camel catalog to load the archetypes String xml = new DefaultCamelCatalog().archetypeCatalogAsXml(); if (xml != null) { try { cachedArchetypes = new ArchetypeCatalogXpp3Reader().read(new StringReader(xml)); } catch (Exception e) { logger.log(Level.SEVERE, "Error while retrieving archetypes", e); } } } return cachedArchetypes; }
private CamelCatalog createCamelCatalog() throws IOException{ CamelCatalog result = new DefaultCamelCatalog(true); //add funktion camel components Predicate<String> filter = new FilterBuilder().includePackage("io.fabric8.funktion.camel"); Reflections resources = new Reflections(new ConfigurationBuilder() .filterInputsBy(filter) .setScanners(new ResourcesScanner()) .setUrls(ClasspathHelper.forJavaClassPath())); Set<String> jsonFiles = resources.getResources(Pattern.compile(".*\\.json")); LOG.info("Processing Funktion Camel components ..."); for (String jsonFile: jsonFiles){ InputStream inputStream = getClass().getClassLoader().getResourceAsStream(jsonFile); ObjectMapper mapper = new ObjectMapper(); JsonNode root = mapper.readTree(inputStream); JsonNode component = root.path("component"); if (!component.isMissingNode()) { String scheme = component.path("scheme").asText(); String componentName = component.path("javaType").asText(); result.addComponent(scheme,componentName); LOG.info("Processed component " + scheme); }else{ LOG.error("Failed to find Component for " + jsonFile); } } return result; }
@Test public void testFindModelNames() { CamelCatalog catalog = new DefaultCamelCatalog(); List<String> names = catalog.findModelNames(); assertNotNull(names); LOG.info("Found {} names", names.size()); assertTrue("Should find some models", names.size() > 0); }
@Test public void testFindModelNamesFilter() { CamelCatalog catalog = new DefaultCamelCatalog(); List<String> names = catalog.findModelNames("transformation"); assertNotNull(names); LOG.info("Found {} names", names.size()); assertTrue("Should find some transformation models", names.size() > 0); }
@Test public void testFindModelNamesFilterWildcard() { CamelCatalog catalog = new DefaultCamelCatalog(); List<String> names = catalog.findModelNames("t*"); assertNotNull(names); LOG.info("Found {} names", names.size()); assertTrue("Should find some t* models", names.size() > 0); }
@Test public void testFindComponentNamesFilterNoMatch() { CamelCatalog catalog = new DefaultCamelCatalog(); List<String> names = catalog.findModelNames("cannotmatchme"); assertNotNull(names); assertTrue("Should not match any models", names.size() == 0); }
@Test public void testCoreComponentJson() { CamelCatalog catalog = new DefaultCamelCatalog(); String json = catalog.modelJSonSchema("split"); assertNotNull(json); LOG.info(json); assertTrue("Should find to split", json.contains("split")); }
@Test public void testLabels() { CamelCatalog catalog = new DefaultCamelCatalog(); Set<String> labels = catalog.findModelLabels(); assertNotNull(labels); assertTrue("Should find labels", labels.size() > 0); assertTrue("Should find transformation label", labels.contains("transformation")); }
@Test public void testFindComponentNames() { CamelCatalog catalog = new DefaultCamelCatalog(); List<String> names = catalog.findComponentNames(); assertNotNull("The names should not be null", names); LOG.info("Found {} names", names.size()); assertTrue("Should find some components", names.size() > 0); }
@Test public void testFindComponentNamesFilter() { CamelCatalog catalog = new DefaultCamelCatalog(); List<String> names = catalog.findComponentNames("testing"); assertNotNull("The names should not be null", names); LOG.info("Found {} names", names.size()); assertTrue("Should find some testing components", names.size() > 0); }
@Test public void testFindComponentNamesFilterWildcard() { CamelCatalog catalog = new DefaultCamelCatalog(); List<String> names = catalog.findComponentNames("t*"); assertNotNull("The names should not be null", names); LOG.info("Found {} names", names.size()); assertTrue("Should find some t* components", names.size() > 0); }
@Test public void testFindComponentNamesFilterTwo() { CamelCatalog catalog = new DefaultCamelCatalog(); List<String> names = catalog.findComponentNames("transformation"); assertNotNull("The names should not be null", names); LOG.info("Found {} names", names.size()); assertTrue("Should find some transformation components", names.size() > 0); }
@Test public void testFindComponentNamesFilterNoMatch() { CamelCatalog catalog = new DefaultCamelCatalog(); List<String> names = catalog.findComponentNames("cannotmatchme"); assertNotNull("The names should not be null", names); assertTrue("Should not match any components", names.size() == 0); }
@Test public void testCoreComponentJson() { CamelCatalog catalog = new DefaultCamelCatalog(); String json = catalog.componentJSonSchema("bean"); assertNotNull("Should find the json information about the bean component", json); LOG.info(json); assertTrue("Should find bean component", json.contains("bean")); }
@Test public void testFtpComponentJson() { CamelCatalog catalog = new DefaultCamelCatalog(); String json = catalog.componentJSonSchema("ftp"); assertNotNull("Should find the json information about the ftp component", json); LOG.info(json); assertTrue("Should find ftp component", json.contains("ftp")); }
@Test public void testLabels() { CamelCatalog catalog = new DefaultCamelCatalog(); Set<String> labels = catalog.findComponentLabels(); assertNotNull("Should component labels", labels); assertTrue("Should find labels", labels.size() > 0); assertTrue("Should find core label", labels.contains("core")); assertTrue("Should find testing label", labels.contains("testing")); assertTrue("Should find rest label", labels.contains("rest")); }
@Before public void createCamelCatalog() { catalog = new DefaultCamelCatalog(); catalog.setSuggestionStrategy(new LuceneSuggestionStrategy()); }
@BeforeClass public static void createCamelCatalog() { catalog = new DefaultCamelCatalog(); catalog.setRuntimeProvider(new WildFlyRuntimeProvider()); }