@Test void testLocalConfigurationFromEnvironment(@TempDir final File temporaryFolder) throws Exception { final File pluginFolder = new File(temporaryFolder, "test-plugins_" + UUID.randomUUID().toString()); pluginFolder.mkdirs(); final File plugin = pluginGenerator.createPlugin(pluginFolder, "plugin.jar"); try (final ComponentManager manager = new ComponentManager(new File("target/test-dependencies"), "META-INF/test/dependencies", null)) { manager.addPlugin(plugin.getAbsolutePath()); final Container container = manager.getContainer().findAll().stream().findFirst().orElse(null); assertNotNull(container); final LocalConfiguration envConf = LocalConfiguration.class .cast(container.get(AllServices.class).getServices().get(LocalConfiguration.class)); assertEquals("/home/user", envConf.get("USER_PATH")); assertEquals("/home/user", envConf.get("USER.PATH")); assertEquals("/home/user", envConf.get("user_path")); assertEquals("/home/user", envConf.get("user_PATH")); assertEquals("/home/user", envConf.get("talend_localconfig_user_home")); assertEquals("/home/user", envConf.get("talend.localconfig.user.home")); assertEquals("true", envConf.get("talend.LOCALCONFIG.test.0")); assertEquals("true", envConf.get("talend.localconfig.test_0")); assertEquals("true", envConf.get("talend.localconfig.TEST.0")); assertEquals("true", envConf.get("talend.localconfig.test#0")); assertEquals("true", envConf.get("talend$localconfig.test+0")); assertNull(envConf.get("talend.compmgr.exists")); assertNull(envConf.get("HOMER")); assertNull(envConf.get("TALEND_LOCALCONFIG_USER_HOME")); } finally { doCleanup(pluginFolder); } }
public synchronized String addPlugin(final String pluginRootFile) { final Optional<Container> pl = findPlugin(pluginRootFile); if (pl.isPresent()) { return pl.get().getId(); } final String id = this.container .builder(pluginRootFile) .withCustomizer(createContainerCustomizer(pluginRootFile)) .withAdditionalClasspath(findAdditionalClasspathFor(container.buildAutoIdFromName(pluginRootFile))) .create() .getId(); info("Adding plugin: " + pluginRootFile + ", as " + id); return id; }
ComponentManager implements AutoCloseable { public synchronized String addPlugin(final String pluginRootFile) { final Optional<Container> pl = findPlugin(pluginRootFile); if (pl.isPresent()) { return pl.get().getId(); } final String id = this.container .builder(pluginRootFile) .withCustomizer(createContainerCustomizer(pluginRootFile)) .withAdditionalClasspath(findAdditionalClasspathFor(container.buildAutoIdFromName(pluginRootFile))) .create() .getId(); info("Adding plugin: " + pluginRootFile + ", as " + id); return id; } }
ComponentManager implements AutoCloseable { public synchronized String addPlugin(final String pluginRootFile) { final Optional<Container> pl = findPlugin(pluginRootFile); if (pl.isPresent()) { return pl.get().getId(); } final String id = this.container .builder(pluginRootFile) .withCustomizer(createContainerCustomizer(pluginRootFile)) .withAdditionalClasspath(findAdditionalClasspathFor(container.buildAutoIdFromName(pluginRootFile))) .create() .getId(); info("Adding plugin: " + pluginRootFile + ", as " + id); return id; } ComponentManager(final File m2);  ComponentManager(final File m2, final String dependenciesResource, final String jmxNamePattern);  ComponentManager(final Path m2);  ComponentManager(final Path m2, final String dependenciesResource, final String jmxNamePattern); }
ComponentManager implements AutoCloseable { public synchronized String addPlugin(final String pluginRootFile) { final Optional<Container> pl = findPlugin(pluginRootFile); if (pl.isPresent()) { return pl.get().getId(); } final String id = this.container .builder(pluginRootFile) .withCustomizer(createContainerCustomizer(pluginRootFile)) .withAdditionalClasspath(findAdditionalClasspathFor(container.buildAutoIdFromName(pluginRootFile))) .create() .getId(); info("Adding plugin: " + pluginRootFile + ", as " + id); return id; } ComponentManager(final File m2);  ComponentManager(final File m2, final String dependenciesResource, final String jmxNamePattern);  ComponentManager(final Path m2);  ComponentManager(final Path m2, final String dependenciesResource, final String jmxNamePattern); static ComponentManager instance(); static Path findM2(); void addCallerAsPlugin(); Stream<T> find(final Function<Container, Stream<T>> mapper); Optional<Object> createComponent(final String plugin, final String name, final ComponentType componentType,
            final int version, final Map<String, String> configuration); void autoDiscoverPlugins(final boolean callers, final boolean classpath); Optional<Mapper> findMapper(final String plugin, final String name, final int version,
            final Map<String, String> configuration); Optional<org.talend.sdk.component.runtime.output.Processor> findProcessor(final String plugin,
            final String name, final int version, final Map<String, String> configuration); boolean hasPlugin(final String plugin); Optional<Container> findPlugin(final String plugin); synchronized String addPlugin(final String pluginRootFile); String addWithLocationPlugin(final String location, final String pluginRootFile); void removePlugin(final String id); @Override void close(); List<String> availablePlugins(); }
ComponentManager implements AutoCloseable { public synchronized String addPlugin(final String pluginRootFile) { final Optional<Container> pl = findPlugin(pluginRootFile); if (pl.isPresent()) { return pl.get().getId(); } final String id = this.container .builder(pluginRootFile) .withCustomizer(createContainerCustomizer(pluginRootFile)) .withAdditionalClasspath(findAdditionalClasspathFor(container.buildAutoIdFromName(pluginRootFile))) .create() .getId(); info("Adding plugin: " + pluginRootFile + ", as " + id); return id; } ComponentManager(final File m2);  ComponentManager(final File m2, final String dependenciesResource, final String jmxNamePattern);  ComponentManager(final Path m2);  ComponentManager(final Path m2, final String dependenciesResource, final String jmxNamePattern); static ComponentManager instance(); static Path findM2(); void addCallerAsPlugin(); Stream<T> find(final Function<Container, Stream<T>> mapper); Optional<Object> createComponent(final String plugin, final String name, final ComponentType componentType,
            final int version, final Map<String, String> configuration); void autoDiscoverPlugins(final boolean callers, final boolean classpath); Optional<Mapper> findMapper(final String plugin, final String name, final int version,
            final Map<String, String> configuration); Optional<org.talend.sdk.component.runtime.output.Processor> findProcessor(final String plugin,
            final String name, final int version, final Map<String, String> configuration); boolean hasPlugin(final String plugin); Optional<Container> findPlugin(final String plugin); synchronized String addPlugin(final String pluginRootFile); String addWithLocationPlugin(final String location, final String pluginRootFile); void removePlugin(final String id); @Override void close(); List<String> availablePlugins();  }