DataHubImpl implements DataHub { @Override public boolean isServerVersionValid(String versionString) { try{ Versions.MarkLogicVersion serverVersion = versions.getMLVersion(versionString); if (!(serverVersion.getMajor() == 9 || serverVersion.getMajor() == 10)) { return false; } if(serverVersion.isNightly()){ if(serverVersion.getMajor() == 9) { Date minDate = new GregorianCalendar(2019, Calendar.JULY, 25).getTime(); Date date = new SimpleDateFormat("y-M-d").parse(serverVersion.getDateString()); if (date.before(minDate)) { return false; } } if(serverVersion.getMajor() == 10) { Date minDate = new GregorianCalendar(2019, Calendar.JUNE, 20).getTime(); Date date = new SimpleDateFormat("y-M-d").parse(serverVersion.getDateString()); if (date.before(minDate)) { return false; } } } else { if(serverVersion.getMajor() == 9){ if(serverVersion.getMinor() < 1000) { return false; } } if(serverVersion.getMajor() == 10){ if(serverVersion.getMinor() < 200) { return false; } } } } catch (Exception e) { throw new ServerValidationException(e.toString()); } return true; }  @Override void clearDatabase(String database); @Override FlowRunner getFlowRunner(); @Override InstallInfo isInstalled(); @Override boolean isServerVersionValid(String versionString); @Override void initProject(); @Override void clearUserModules(); void deleteDocument(String uri, DatabaseKind databaseKind); List<Command> buildListOfCommands(); List<Command> getSecurityCommandList(); @Override HashMap<String, Boolean> runPreInstallCheck(); @Override void install(); @Override void install(HubDeployStatusListener listener); @Override void updateIndexes(); @Override void uninstall(); @Override void uninstall(HubDeployStatusListener listener); Map<String, List<Command>> buildCommandMap(); @Override boolean isSafeToInstall(); @Override boolean isPortInUse(DatabaseKind kind); @Override void setPortInUseBy(DatabaseKind kind, String usedBy); @Override String getPortInUseBy(DatabaseKind kind); @Override boolean isServerVersionOk(); @Override void setServerVersionOk(boolean serverVersionOk); @Override String getServerVersion(); @Override void setServerVersion(String serverVersion); @Override boolean upgradeHub(); void setHubConfig(HubConfigImpl hubConfig); void setVersions(Versions versions); static String MIN_UPGRADE_VERSION; }
@Test public void testValidateServerPriorTo8withDot() { assertFalse(dh.isServerVersionValid("7.0-6.6")); }
@Test public void testValidateServerPriorTo8sansDot() { assertFalse(dh.isServerVersionValid("7.0")); }
@Test public void testValidateServerPriorTo804() { assertFalse(dh.isServerVersionValid("8.0-3.4")); }
@Test public void testValidateServer804() { assertFalse(dh.isServerVersionValid("8.0-4")); }
@Test public void testValidateServerBeyond804() { assertFalse(dh.isServerVersionValid("8.0-5")); }
@Test public void testValidateServer807() { assertFalse(dh.isServerVersionValid("8.0-7")); }
@Test public void testValidateServer809() { assertFalse(dh.isServerVersionValid("8.0-9")); }
@Test public void testValidateServerBeyond804WithDot() { assertFalse(dh.isServerVersionValid("8.0-5.2")); }
@Test public void testValidateServer8nightly() { assertFalse(dh.isServerVersionValid("8.0-20160719")); }
@Test public void testValidateServer9nightly() { assertTrue(dh.isServerVersionValid("9.0-20191110")); }
@Test public void testValidateServer8nightlyValid() { assertFalse(dh.isServerVersionValid("8.0-20170702")); }
@Test public void testValidateServer8nightlyValidEdge() { assertFalse(dh.isServerVersionValid("8.0-20170701")); }
@Test public void testValidateServer8nightlyInValid() { assertFalse(dh.isServerVersionValid("8.0-20170630")); }
@Test public void testInvalidServer9nightly() { assertFalse(dh.isServerVersionValid("9.0-20180719")); }
@Test public void testInvalidServer9nightly1() { assertFalse(dh.isServerVersionValid("9.0-20180504")); }
@Test public void testValidateServer9() { assertFalse(dh.isServerVersionValid("9.0")); }
@Test public void testValidateServer9041() { assertFalse(dh.isServerVersionValid("9.0-4.1")); }
@Test public void testValidateServer905() { assertFalse(dh.isServerVersionValid("9.0-5")); }
@Test public void testValidateServer906() { assertFalse(dh.isServerVersionValid("9.0-6.2")); assertFalse(dh.isServerVersionValid("9.0-6.99")); }
@Test public void testValidateServerBeyond907() { assertFalse(dh.isServerVersionValid("9.0-7")); assertFalse(dh.isServerVersionValid("9.0-7.10")); }
@Test public void testValidateServerBeyond909() { assertFalse(dh.isServerVersionValid("9.0-9")); assertTrue(dh.isServerVersionValid("9.0-10.10")); }
@Test public void testValidateServerBeyond10() { assertFalse(dh.isServerVersionValid("10.0-1.34")); assertTrue(dh.isServerVersionValid("10.0-2")); assertTrue(dh.isServerVersionValid("10.0-5.10")); }
@Test public void testValidateServer10Nightly() { assertFalse(dh.isServerVersionValid("10.0-20170801")); }
@Test public void testValidateServer10NightlyValid() { assertFalse(dh.isServerVersionValid("10.0-20180505")); }