@Test public void initEnv_component() throws CoreException, URISyntaxException, IOException { SdrRoot sdr = SdrPluginLoader.getSdrRoot(PLUGIN_ID, DEFAULT_SDR_PATH); SoftPkg spd = sdr.getComponentsContainer().getSoftPkg("DCE:4f46ef40-8c58-47e3-904b-e725b366808b"); Assert.assertEquals("CppComponent", spd.getName()); Map<String, String> map = new HashMap<String, String>(); mapper.initEnv(spd.getImplementation("cpp"), map); Assert.assertEquals(1, map.size()); checkOctavePath(map, new String[0]); }
@Test public void initEnv_componentWithDeps() throws CoreException, URISyntaxException, IOException { SdrRoot sdr = SdrPluginLoader.getSdrRoot(PLUGIN_ID, DEFAULT_SDR_PATH); SoftPkg spd = sdr.getComponentsContainer().getSoftPkg("DCE:2fc3c8c5-a984-4be7-87c5-16ff9f0d0c8f"); Assert.assertEquals("CppComponentWithDeps", spd.getName()); Map<String, String> map = new HashMap<String, String>(); mapper.initEnv(spd.getImplementation("cpp"), map); Assert.assertEquals(1, map.size()); String sdrDom = getSdrDomLocation(); String[] paths = { sdrDom + "/deps/CppDepD/cpp/lib", sdrDom + "/deps/CppDepDE/cpp/lib", sdrDom + "/deps/CppDepA/cpp/lib", sdrDom + "/deps/CppDepAC/cpp/lib", sdrDom + "/deps/CppDepAB/cpp/lib" }; checkOctavePath(map, paths); }
private String getSdrDomLocation() throws URISyntaxException, IOException, CoreException { String domUri = SdrPluginLoader.getSdrRoot(PLUGIN_ID, DEFAULT_SDR_PATH).getDomFileSystemRoot().toString(); URI javaDomUri = URI.create(domUri); return EFS.getStore(javaDomUri).toLocalFile(0, null).toString(); }