@Test public void testPrepareBuildProduct() throws Exception { File basedir = TestUtil.getBasedir("unitTestResources"); File productFile = new File(basedir, "test.product"); ProductConfiguration productConfiguration = ProductConfiguration.read(productFile); BuildOutputDirectory buildBasedir = new BuildOutputDirectory(new File(tempDir, "buildBasedir")); Product buildProduct = PublishProductMojo.prepareBuildProduct( productFile, productConfiguration, buildBasedir, "buildQualifier"); Assert.assertEquals( buildBasedir.getChild("products/testproduct/p2.inf"), buildProduct.getP2infFile()); Assert.assertTrue(buildBasedir.getChild("products/testproduct/p2.inf").exists()); File buildProductRootDir = buildBasedir.getChild("products/testproduct"); assertFileExists("icons/linux.xpm", buildProductRootDir); assertFileExists("icons/mac.ico", buildProductRootDir); assertFileExists("icons/solaris.ico", buildProductRootDir); assertFileExists("icons/win.ico", buildProductRootDir); assertFileExists("configs/config_linux.ini", buildProductRootDir); assertFileExists("configs/config_macosx.ini", buildProductRootDir); assertFileExists("configs/config_win32.ini", buildProductRootDir); assertFileExists("configs/config_solaris.ini", buildProductRootDir); ProductConfiguration buildProductConfiguration = ProductConfiguration.read(buildProduct.getProductFile()); Assert.assertEquals("0.1.0.buildQualifier", buildProductConfiguration.getVersion()); }
@Test public void testPrepareBuildProductEmptyQualifier() throws Exception { File basedir = TestUtil.getBasedir("unitTestResources"); File productFile = new File(basedir, "test.product"); ProductConfiguration productConfiguration = ProductConfiguration.read(productFile); BuildOutputDirectory buildBasedir = new BuildOutputDirectory(new File(tempDir, "buildBasedir")); Product buildProduct = PublishProductMojo.prepareBuildProduct(productFile, productConfiguration, buildBasedir, ""); Assert.assertEquals( buildBasedir.getChild("products/testproduct/p2.inf"), buildProduct.getP2infFile()); Assert.assertTrue(buildBasedir.getChild("products/testproduct/p2.inf").exists()); ProductConfiguration buildProductConfiguration = ProductConfiguration.read(buildProduct.getProductFile()); Assert.assertEquals("0.1.0", buildProductConfiguration.getVersion()); }