@Test public void isUpToDateOnRegularVersions() throws UnknownHostException { final DbArtifact artifact = new DbArtifact(); artifact.setGroupId("com.axway.tests"); artifact.setArtifactId("artifact"); final List<String> versions = new ArrayList<String>(); versions.add("0.1.0-SNAPSHOT"); versions.add("0.1.0-SNAPSHOT"); versions.add("1.1.0-SNAPSHOT"); versions.add("2.0.0-SNAPSHOT"); versions.add("2.1.0-1"); versions.add("4.0.0-SNAPSHOT"); when(repositoryHandler.getArtifactVersions((DbArtifact) anyObject())).thenReturn(versions); artifact.setVersion("3.0.0-SNAPSHOT"); assertFalse(versionsHandler.isUpToDate(artifact)); artifact.setVersion("2.1.0-1"); assertTrue(versionsHandler.isUpToDate(artifact)); artifact.setVersion("4.0.0-SNAPSHOT"); assertTrue(versionsHandler.isUpToDate(artifact)); }
public boolean isUpToDate(final DbArtifact artifact) { final List<String> versions = repoHandler.getArtifactVersions(artifact); final String currentVersion = artifact.getVersion(); final String lastDevVersion = getLastVersion(versions); final String lastReleaseVersion = getLastRelease(versions); if(lastDevVersion == null || lastReleaseVersion == null) { for(final String version: versions){ if(version.compareTo(currentVersion) > 0){ return false; } } return true; } else { return currentVersion.equals(lastDevVersion) || currentVersion.equals(lastReleaseVersion); } }
VersionsHandler { public boolean isUpToDate(final DbArtifact artifact) { final List<String> versions = repoHandler.getArtifactVersions(artifact); final String currentVersion = artifact.getVersion(); final String lastDevVersion = getLastVersion(versions); final String lastReleaseVersion = getLastRelease(versions); if(lastDevVersion == null || lastReleaseVersion == null) { for(final String version: versions){ if(version.compareTo(currentVersion) > 0){ return false; } } return true; } else { return currentVersion.equals(lastDevVersion) || currentVersion.equals(lastReleaseVersion); } } }
VersionsHandler { public boolean isUpToDate(final DbArtifact artifact) { final List<String> versions = repoHandler.getArtifactVersions(artifact); final String currentVersion = artifact.getVersion(); final String lastDevVersion = getLastVersion(versions); final String lastReleaseVersion = getLastRelease(versions); if(lastDevVersion == null || lastReleaseVersion == null) { for(final String version: versions){ if(version.compareTo(currentVersion) > 0){ return false; } } return true; } else { return currentVersion.equals(lastDevVersion) || currentVersion.equals(lastReleaseVersion); } } VersionsHandler(final RepositoryHandler repoHandler); }
VersionsHandler { public boolean isUpToDate(final DbArtifact artifact) { final List<String> versions = repoHandler.getArtifactVersions(artifact); final String currentVersion = artifact.getVersion(); final String lastDevVersion = getLastVersion(versions); final String lastReleaseVersion = getLastRelease(versions); if(lastDevVersion == null || lastReleaseVersion == null) { for(final String version: versions){ if(version.compareTo(currentVersion) > 0){ return false; } } return true; } else { return currentVersion.equals(lastDevVersion) || currentVersion.equals(lastReleaseVersion); } } VersionsHandler(final RepositoryHandler repoHandler); boolean isUpToDate(final DbArtifact artifact); String getLastRelease(final Collection<String> versions); String getLastVersion(final Collection<String> versions); }
VersionsHandler { public boolean isUpToDate(final DbArtifact artifact) { final List<String> versions = repoHandler.getArtifactVersions(artifact); final String currentVersion = artifact.getVersion(); final String lastDevVersion = getLastVersion(versions); final String lastReleaseVersion = getLastRelease(versions); if(lastDevVersion == null || lastReleaseVersion == null) { for(final String version: versions){ if(version.compareTo(currentVersion) > 0){ return false; } } return true; } else { return currentVersion.equals(lastDevVersion) || currentVersion.equals(lastReleaseVersion); } } VersionsHandler(final RepositoryHandler repoHandler); boolean isUpToDate(final DbArtifact artifact); String getLastRelease(final Collection<String> versions); String getLastVersion(final Collection<String> versions);  }