TimeSeriesToolActivator implements Activator { public static void convertAbsolutPathsToRelative(Product product, File outputDir) { final MetadataElement tsRootElem = product.getMetadataRoot().getElement(AbstractTimeSeries.TIME_SERIES_ROOT_NAME); final MetadataElement productLocations = tsRootElem.getElement(AbstractTimeSeries.PRODUCT_LOCATIONS); final MetadataElement sourceProductPaths = tsRootElem.getElement(AbstractTimeSeries.SOURCE_PRODUCT_PATHS); replaceWithRelativePaths(productLocations.getElements(), outputDir); replaceWithRelativePaths(sourceProductPaths.getElements(), outputDir); } TimeSeriesToolActivator(); @Override void start(ModuleContext moduleContext); @Override void stop(ModuleContext moduleContext); static void convertAbsolutPathsToRelative(Product product, File outputDir);  }
@Test public void testSomething() { File testOutputDir = new File(absOutputPath); TimeSeriesToolActivator.convertAbsolutPathsToRelative(testProduct, testOutputDir); assertEquals("and/a/product/file/product1.dim", getPathString(AbstractTimeSeries.PRODUCT_LOCATIONS, 0)); assertEquals("and/a/product/file/product2.dim", getPathString(AbstractTimeSeries.PRODUCT_LOCATIONS, 1)); assertEquals("and/a/product/file/product1.dim", getPathString(AbstractTimeSeries.SOURCE_PRODUCT_PATHS, 0)); assertEquals("and/a/product/file/product2.dim", getPathString(AbstractTimeSeries.SOURCE_PRODUCT_PATHS, 1)); }