@Test
  public void testCopyMissingP2Inf() throws IOException {
    File productFile = new File(sourceDirectory, "test.product");
    productFile.createNewFile();

    File p2InfTarget = new File(targetDirectory, "p2.inf");
    PublishProductMojo.copyP2Inf(PublishProductMojo.getSourceP2InfFile(productFile), p2InfTarget);
    Assert.assertFalse(p2InfTarget.exists());
  }
  @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 testQualifyVersionsEmptyVersions() throws IOException {
    File basedir = TestUtil.getBasedir("unitTestResources");
    File productFile = new File(basedir, "emptyVersion.product");
    ProductConfiguration product = ProductConfiguration.read(productFile);
    PublishProductMojo.qualifyVersions(product, "20100623");

    Assert.assertEquals("", product.getVersion());
  }
  @Test
  public void testQualifyVersions() throws IOException {
    File basedir = TestUtil.getBasedir("unitTestResources");
    File productFile = new File(basedir, "test.product");
    ProductConfiguration product = ProductConfiguration.read(productFile);
    PublishProductMojo.qualifyVersions(product, "20100623");

    Assert.assertEquals("0.1.0.20100623", product.getVersion());
    Assert.assertEquals("0.1.0.20100623", product.getFeatures().get(0).getVersion());
    Assert.assertEquals("0.1.0.qual", product.getFeatures().get(1).getVersion());
    Assert.assertEquals("0.1.0.20100623", product.getPlugins().get(0).getVersion());
    Assert.assertEquals("0.1.0.qual", product.getPlugins().get(1).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());
  }
 @Test
 public void testGetSourceP2InfFile() throws IOException {
   String p2InfFile =
       PublishProductMojo.getSourceP2InfFile(new File("./test/test.product")).getCanonicalPath();
   Assert.assertEquals(new File("./test/test.p2.inf").getCanonicalPath(), p2InfFile);
 }