You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2015/02/12 06:05:16 UTC
svn commit: r1659151 - in /lucene/dev/branches/branch_5x: ./ solr/ solr/core/
solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java
solr/core/src/test/org/apache/solr/handler/TestReplicationHandlerBackup.java
Author: shalin
Date: Thu Feb 12 05:05:15 2015
New Revision: 1659151
URL: http://svn.apache.org/r1659151
Log:
SOLR-6775: Do not attempt cleanup of temp directory because it is handled by test framework
Modified:
lucene/dev/branches/branch_5x/ (props changed)
lucene/dev/branches/branch_5x/solr/ (props changed)
lucene/dev/branches/branch_5x/solr/core/ (props changed)
lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java
lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/TestReplicationHandlerBackup.java
Modified: lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java?rev=1659151&r1=1659150&r2=1659151&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java Thu Feb 12 05:05:15 2015
@@ -134,8 +134,6 @@ public class TestReplicationHandler exte
super.tearDown();
masterJetty.stop();
slaveJetty.stop();
- master.tearDown();
- slave.tearDown();
masterJetty = slaveJetty = null;
master = slave = null;
masterClient.close();
@@ -344,9 +342,6 @@ public class TestReplicationHandler exte
try {
if (repeaterJetty != null) repeaterJetty.stop();
} catch (Exception e) { /* :NOOP: */ }
- try {
- if (repeater != null) repeater.tearDown();
- } catch (Exception e) { /* :NOOP: */ }
if (repeaterClient != null) repeaterClient.close();
}
}
@@ -909,7 +904,6 @@ public class TestReplicationHandler exte
} finally {
if (repeater != null) {
repeaterJetty.stop();
- repeater.tearDown();
repeaterJetty = null;
}
if (repeaterClient != null) {
@@ -1505,10 +1499,6 @@ public class TestReplicationHandler exte
"solrconfig.snippet.randomindexconfig.xml");
}
- public void tearDown() throws Exception {
- IOUtils.rm(homeDir.toPath());
- }
-
public void copyConfigFile(String srcFile, String destFile)
throws IOException {
copyFile(getFile(srcFile),
Modified: lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/TestReplicationHandlerBackup.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/TestReplicationHandlerBackup.java?rev=1659151&r1=1659150&r2=1659151&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/TestReplicationHandlerBackup.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/TestReplicationHandlerBackup.java Thu Feb 12 05:05:15 2015
@@ -112,7 +112,6 @@ public class TestReplicationHandlerBacku
masterClient.close();
masterClient = null;
masterJetty.stop();
- master.tearDown();
masterJetty = null;
master = null;
}
@@ -167,60 +166,51 @@ public class TestReplicationHandlerBacku
Path[] snapDir = new Path[2];
boolean namedBackup = random().nextBoolean();
- try {
- String firstBackupTimestamp = null;
+ String firstBackupTimestamp = null;
- String[] backupNames = null;
- if (namedBackup) {
- backupNames = new String[2];
+ String[] backupNames = null;
+ if (namedBackup) {
+ backupNames = new String[2];
+ }
+ for (int i = 0; i < 2; i++) {
+ BackupCommand backupCommand;
+ final String backupName = TestUtil.randomSimpleString(random(), 1, 20);
+ if (!namedBackup) {
+ backupCommand = new BackupCommand(addNumberToKeepInRequest, backupKeepParamName, ReplicationHandler.CMD_BACKUP);
+ } else {
+ backupCommand = new BackupCommand(backupName, ReplicationHandler.CMD_BACKUP);
+ backupNames[i] = backupName;
}
- for (int i = 0; i < 2; i++) {
- BackupCommand backupCommand;
- final String backupName = TestUtil.randomSimpleString(random(), 1, 20);
- if (!namedBackup) {
- backupCommand = new BackupCommand(addNumberToKeepInRequest, backupKeepParamName, ReplicationHandler.CMD_BACKUP);
- } else {
- backupCommand = new BackupCommand(backupName, ReplicationHandler.CMD_BACKUP);
- backupNames[i] = backupName;
- }
- backupCommand.runCommand();
- if (backupCommand.fail != null) {
- fail(backupCommand.fail);
- }
-
- CheckBackupStatus checkBackupStatus = new CheckBackupStatus((HttpSolrClient) masterClient, firstBackupTimestamp);
- while (!checkBackupStatus.success) {
- checkBackupStatus.fetchStatus();
- Thread.sleep(1000);
- }
- if (i == 0) {
- firstBackupTimestamp = checkBackupStatus.backupTimestamp;
- }
-
- if (!namedBackup) {
- snapDir[i] = Files.newDirectoryStream(Paths.get(master.getDataDir()), "snapshot*").iterator().next();
- } else {
- snapDir[i] = Files.newDirectoryStream(Paths.get(master.getDataDir()), "snapshot." + backupName).iterator().next();
- }
- verify(snapDir[i], nDocs);
-
+ backupCommand.runCommand();
+ if (backupCommand.fail != null) {
+ fail(backupCommand.fail);
}
- if (!namedBackup && Files.exists(snapDir[0])) {
- fail("The first backup should have been cleaned up because " + backupKeepParamName + " was set to 1.");
+ CheckBackupStatus checkBackupStatus = new CheckBackupStatus((HttpSolrClient) masterClient, firstBackupTimestamp);
+ while (!checkBackupStatus.success) {
+ checkBackupStatus.fetchStatus();
+ Thread.sleep(1000);
}
-
- //Test Deletion of named backup
- if(namedBackup) {
- testDeleteNamedBackup(backupNames);
+ if (i == 0) {
+ firstBackupTimestamp = checkBackupStatus.backupTimestamp;
}
- } finally {
- if(!namedBackup) {
- for (int i = 0; i < snapDir.length; i++) {
- org.apache.lucene.util.IOUtils.rm(snapDir[i]);
- }
+ if (!namedBackup) {
+ snapDir[i] = Files.newDirectoryStream(Paths.get(master.getDataDir()), "snapshot*").iterator().next();
+ } else {
+ snapDir[i] = Files.newDirectoryStream(Paths.get(master.getDataDir()), "snapshot." + backupName).iterator().next();
}
+ verify(snapDir[i], nDocs);
+
+ }
+
+ if (!namedBackup && Files.exists(snapDir[0])) {
+ fail("The first backup should have been cleaned up because " + backupKeepParamName + " was set to 1.");
+ }
+
+ //Test Deletion of named backup
+ if(namedBackup) {
+ testDeleteNamedBackup(backupNames);
}
}