ComponentDescription extends Observable implements Comparable<ComponentDescription> { public static boolean isVersionNewerThan(String oneVersion, String otherVersion) { if (oneVersion == null || otherVersion == null) { return false; } if (otherVersion.equals(oneVersion+"-SNAPSHOT")) { return true; } if (oneVersion.equals(otherVersion+"-SNAPSHOT")) { return false; } return oneVersion.compareTo(otherVersion) > 0; } protected  ComponentDescription(String name, String version, String packageFilename); protected  ComponentDescription(Element xmlDescription); void replaceWithUpdate(); String getComponentTypeString(); String getName(); Locale getLocale(); void setLocale(Locale aLocale); String getVersion(); void setVersion(String aVersion); String getDescription(); void setDescription(String aDescription); URL getLicenseURL(); void setLicenseURL(URL aLicense); List<URL> getLocations(); void removeAllLocations(); void addLocation(URL aLocation); String getPackageFilename(); void setPackageFilename(String aPackageFilename); int getPackageSize(); void setPackageSize(int aSize); String getDisplayPackageSize(); String getPackageMD5Sum(); void setPackageMD5Sum(String aMD5); boolean isSelected(); void setSelected(boolean value); Status getStatus(); LinkedList<String> getInstalledFileNames(); void setSharedFiles(Set<String> fileList); String toString(); @Override boolean equals(Object obj); void pause(); void resume(boolean synchronous); void cancel(); void download(boolean synchronous); void install(boolean synchronous); boolean uninstall(); int getProgress(); Document createComponentXML(); boolean isUpdateAvailable(); ComponentDescription getAvailableUpdate(); void setAvailableUpdate(ComponentDescription aDesc); boolean isUpdateOf(ComponentDescription other); static boolean isVersionNewerThan(String oneVersion, String otherVersion); int compareTo(ComponentDescription o); static final void copyInputStream(InputStream in, OutputStream out); static final String installerNamespaceURI; }
@Test public void versionNewer() { assertTrue(ComponentDescription.isVersionNewerThan("0.2", "0.1")); }
@Test public void snapshotNotNewer() { assertFalse(ComponentDescription.isVersionNewerThan("5.0-SNAPSHOT", "5.0")); }
@Test public void newerThanSnapshot() { assertTrue(ComponentDescription.isVersionNewerThan("5.0", "5.0-SNAPSHOT")); }
@Test public void snapshotNewer1() { assertTrue(ComponentDescription.isVersionNewerThan("5.1-SNAPSHOT", "5.0")); }
@Test public void snapshotNewer2() { assertTrue(ComponentDescription.isVersionNewerThan("5.1-SNAPSHOT", "5.0-SNAPSHOT")); }
@Test public void notNewerThanMyself() { assertFalse(ComponentDescription.isVersionNewerThan("5.1-SNAPSHOT", "5.1-SNAPSHOT")); }