예제 #1
0
  public static void testBump() throws Exception {
    File tmp = new File("tmp-ws");
    if (tmp.exists()) IO.deleteWithException(tmp);
    tmp.mkdir();
    assertTrue(tmp.isDirectory());

    try {
      IO.copy(new File("test/ws"), tmp);
      Workspace ws = Workspace.getWorkspace(tmp);
      Project project = ws.getProject("p1");
      int size = project.getProperties().size();
      Version old = new Version(project.getProperty("Bundle-Version"));
      System.err.println("Old version " + old);
      project.bump("=+0");
      Version newv = new Version(project.getProperty("Bundle-Version"));
      System.err.println("New version " + newv);
      assertEquals(old.getMajor(), newv.getMajor());
      assertEquals(old.getMinor() + 1, newv.getMinor());
      assertEquals(0, newv.getMicro());
      assertEquals(size, project.getProperties().size());
      assertEquals("sometime", newv.getQualifier());
    } finally {
      IO.deleteWithException(tmp);
    }
  }
예제 #2
0
  public static void testBumpIncludeFile() throws Exception {
    File tmp = new File("tmp-ws");
    if (tmp.exists()) IO.deleteWithException(tmp);
    tmp.mkdir();
    assertTrue(tmp.isDirectory());

    try {
      IO.copy(new File("test/ws"), tmp);
      Workspace ws = Workspace.getWorkspace(tmp);
      Project project = ws.getProject("bump-included");
      project.setTrace(true);
      Version old = new Version(project.getProperty("Bundle-Version"));
      assertEquals(new Version(1, 0, 0), old);
      project.bump("=+0");

      Processor processor = new Processor();
      processor.setProperties(project.getFile("include.txt"));

      Version newv = new Version(processor.getProperty("Bundle-Version"));
      System.err.println("New version " + newv);
      assertEquals(1, newv.getMajor());
      assertEquals(1, newv.getMinor());
      assertEquals(0, newv.getMicro());
    } finally {
      IO.deleteWithException(tmp);
    }
  }
예제 #3
0
 private void testGenericVersion(
     final int major, final int minor, final int patch, final String input) {
   final Version version = Version.parseVersion(input);
   Assert.assertEquals(major, version.getMajor());
   Assert.assertEquals(minor, version.getMinor());
   Assert.assertEquals(patch, version.getPatch());
 }
예제 #4
0
 private void testJdkParsing(
     final int major,
     final int minor,
     final int patch,
     final int update,
     final int build,
     final String input) {
   final Version version = Version.parseJavaRuntimeVersion(input);
   Assert.assertEquals(major, version.getMajor());
   Assert.assertEquals(minor, version.getMinor());
   Assert.assertEquals(patch, version.getPatch());
   Assert.assertEquals(update, version.getUpdate());
   Assert.assertEquals(build, version.getBuild());
 }
  public static String getTargetVersionString() {
    IMonitorModelBase model = MonitorRegistry.findModel(IPDEBuildConstants.BUNDLE_OSGI);
    if (model == null) return ICoreConstants.TARGET37;

    String version = model.getMonitorBase().getVersion();
    if (VersionUtil.validateVersion(version).getSeverity() == IStatus.OK) {
      Version vid = new Version(version);
      int major = vid.getMajor();
      int minor = vid.getMinor();
      if (major == 3 && minor == 0) return ICoreConstants.TARGET30;
      if (major == 3 && minor == 1) return ICoreConstants.TARGET31;
      if (major == 3 && minor == 2) return ICoreConstants.TARGET32;
      if (major == 3 && minor == 3) return ICoreConstants.TARGET33;
      if (major == 3 && minor == 4) return ICoreConstants.TARGET34;
      if (major == 3 && minor == 5) return ICoreConstants.TARGET35;
      if (major == 3 && minor == 6) return ICoreConstants.TARGET36;
    }
    return ICoreConstants.TARGET37;
  }