Fixes
This commit is contained in:
parent
511fbcc876
commit
4bf2c7ba0c
17 changed files with 144 additions and 121 deletions
|
@ -1,13 +1,41 @@
|
|||
version=2.0.0-RC5
|
||||
project.git = true
|
||||
project.excludeFilters = [
|
||||
scalafmt-benchmarks/src/resources,
|
||||
sbt-test
|
||||
bin/issue
|
||||
]
|
||||
align = none
|
||||
# Disabled in default since this operation is potentially
|
||||
# dangerous if you define your own stripMargin with different
|
||||
# semantics from the stdlib stripMargin.
|
||||
assumeStandardLibraryStripMargin = true
|
||||
onTestFailure = "To fix this, run ./scalafmt from the project root directory"
|
||||
style = default
|
||||
align.openParenCallSite=false
|
||||
align.openParenDefnSite=false
|
||||
align.tokens = []
|
||||
assumeStandardLibraryStripMargin = true
|
||||
binPack.parentConstructors = false
|
||||
danglingParentheses = false
|
||||
docstrings = ScalaDoc
|
||||
maxColumn = 100
|
||||
optIn.annotationNewlines = true
|
||||
optIn.breakChainOnFirstMethodDot = true
|
||||
optIn.selfAnnotationNewline = true
|
||||
project.git = true
|
||||
project.includeFilters = [
|
||||
build.sbt
|
||||
ExpectSuite.scala
|
||||
scalameta/contrib
|
||||
scalameta/semanticdb
|
||||
]
|
||||
project.excludeFilters = [
|
||||
scalafmt-benchmarks/src/resources
|
||||
sbt-test
|
||||
bin/issue
|
||||
semanticdb/semanticdb/src/main/generated
|
||||
sbt-test
|
||||
contrib/package.scala
|
||||
scalac-plugin.xml
|
||||
SemanticdbAnalyzer.scala
|
||||
Scalalib.scala
|
||||
com.sun.source.util.Plugin
|
||||
/java/
|
||||
.proto
|
||||
.md
|
||||
]
|
||||
runner.dialect = Scala212
|
||||
runner.optimizer.forceConfigStyleOnOffset = -1
|
||||
|
|
45
build.sbt
45
build.sbt
|
@ -154,6 +154,11 @@ lazy val rep = project
|
|||
)
|
||||
.dependsOn(core)
|
||||
|
||||
val testLibraryDependencies = Seq (
|
||||
"junit" % "junit" % "4.12" % Test,
|
||||
"com.novocode" % "junit-interface" % "0.11" % Test
|
||||
)
|
||||
|
||||
lazy val test = project
|
||||
.in(file("stasis-test"))
|
||||
.settings(
|
||||
|
@ -204,27 +209,43 @@ lazy val test = project
|
|||
s"-Ddoclet.jar=${docdir}/HidingDoclet.jar",
|
||||
)
|
||||
},
|
||||
libraryDependencies ++= Seq(
|
||||
"junit" % "junit" % "4.12" % Test,
|
||||
"com.novocode" % "junit-interface" % "0.11" % Test
|
||||
)
|
||||
libraryDependencies ++= testLibraryDependencies
|
||||
)
|
||||
.disablePlugins(plugins.JUnitXmlReportPlugin)
|
||||
.dependsOn(core, persist, rep)
|
||||
|
||||
val testJavacOptions =Seq(
|
||||
"-Xlint:deprecation",
|
||||
"-Xlint:unchecked"
|
||||
)
|
||||
|
||||
lazy val test_examples = project
|
||||
.in(file("stasis-test-examples"))
|
||||
.settings(
|
||||
moduleName := "stasis-test-examples",
|
||||
assemblyJarName.in(assembly) := "stasis-test-examples.jar",
|
||||
Test / javacOptions := Seq(
|
||||
"-Xlint:deprecation",
|
||||
"-Xlint:unchecked"
|
||||
),
|
||||
libraryDependencies ++= Seq(
|
||||
"junit" % "junit" % "4.12" % Test,
|
||||
"com.novocode" % "junit-interface" % "0.11" % Test
|
||||
)
|
||||
Test / javacOptions := testJavacOptions,
|
||||
libraryDependencies ++= testLibraryDependencies
|
||||
)
|
||||
.dependsOn(core, persist, rep, test)
|
||||
|
||||
lazy val test_dpl_v0 = project
|
||||
.in(file("stasis-test-dpl-v0"))
|
||||
.settings(
|
||||
moduleName := "stasis-test-dpl-v0",
|
||||
assemblyJarName.in(assembly) := "stasis-test-dpl-v0.jar",
|
||||
Test / javacOptions := testJavacOptions,
|
||||
libraryDependencies ++= testLibraryDependencies
|
||||
)
|
||||
.dependsOn(core, persist, rep, test)
|
||||
|
||||
lazy val test_dpl_v1 = project
|
||||
.in(file("stasis-test-dpl-v1"))
|
||||
.settings(
|
||||
moduleName := "stasis-test-dpl-v1",
|
||||
assemblyJarName.in(assembly) := "stasis-test-dpl-v1.jar",
|
||||
Test / javacOptions := testJavacOptions,
|
||||
libraryDependencies ++= testLibraryDependencies
|
||||
)
|
||||
.dependsOn(core, persist, rep, test)
|
||||
|
||||
|
|
|
@ -614,8 +614,7 @@ public class EnvironmentMutableConfig implements Cloneable, Serializable {
|
|||
void checkImmutablePropsForEquality(Properties handleConfigProps)
|
||||
throws IllegalArgumentException {
|
||||
|
||||
Iterator<String> iter =
|
||||
EnvironmentParams.SUPPORTED_PARAMS.keySet().iterator();
|
||||
Iterator<String> iter = EnvironmentParams.SUPPORTED_PARAMS.keySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
String paramName = iter.next();
|
||||
ConfigParam param =
|
||||
|
|
|
@ -505,7 +505,7 @@ public class DbConfigManager {
|
|||
|
||||
if (param == null) {
|
||||
|
||||
/* See if the parameter is an multi-value parameter. */
|
||||
/* See if the parameter is a multi-value parameter. */
|
||||
String mvParamName = ConfigParam.multiValueParamName(paramName);
|
||||
param = EnvironmentParams.SUPPORTED_PARAMS.get(mvParamName);
|
||||
if (param == null) {
|
||||
|
|
|
@ -41,6 +41,7 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
@ -1031,7 +1032,8 @@ public class EnvironmentImpl implements EnvConfigObserver {
|
|||
|
||||
try {
|
||||
Class<?> newClass = Class.forName(className);
|
||||
MBeanRegistrar mBeanReg = (MBeanRegistrar) newClass.newInstance();
|
||||
Constructor constructor = newClass.getConstructor(String.class);
|
||||
MBeanRegistrar mBeanReg = (MBeanRegistrar)constructor.newInstance();
|
||||
mBeanReg.doRegister(env);
|
||||
mBeanRegList.add(mBeanReg);
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -13,6 +13,10 @@
|
|||
|
||||
package com.sleepycat.je.utilint;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.TimeZone;
|
||||
|
||||
/**
|
||||
* Duplicate of java.sql.Timestamp
|
||||
* This duplicate keeps our implementation constant in case the java.sql.Timestamp implementation
|
||||
|
@ -62,12 +66,13 @@ public class Timestamp extends java.util.Date {
|
|||
* {@code yyyy-mm-dd hh:mm:ss.fffffffff} format
|
||||
*/
|
||||
public String toString() {
|
||||
int year = super.getYear() + 1900;
|
||||
int month = super.getMonth() + 1;
|
||||
int day = super.getDate();
|
||||
int hour = super.getHours();
|
||||
int minute = super.getMinutes();
|
||||
int second = super.getSeconds();
|
||||
Calendar cal = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
|
||||
int year = cal.get(Calendar.YEAR) - 1900;
|
||||
int month = cal.get(Calendar.MONTH) + 1;
|
||||
int day = cal.get(Calendar.DAY_OF_MONTH) + 1;
|
||||
int hour = cal.get(Calendar.HOUR_OF_DAY) + 1;
|
||||
int minute = cal.get(Calendar.MINUTE) + 1;
|
||||
int second = cal.get(Calendar.SECOND) + 1;
|
||||
String yearString;
|
||||
String monthString;
|
||||
String dayString;
|
||||
|
|
|
@ -96,9 +96,15 @@ public class StoredClassCatalogTest extends TestBase
|
|||
* Copy the environment generated by StoredClassCatalogTestInit in
|
||||
* test dest dir, which is required to perform this test.
|
||||
*/
|
||||
SharedTestUtils.copyDir(
|
||||
new File(SharedTestUtils.getDestDir(), customName),
|
||||
new File(SharedTestUtils.getTestDir(), customName));
|
||||
File dirA = new File(SharedTestUtils.getDestDir().getAbsolutePath(), customName);
|
||||
File dirB = new File(SharedTestUtils.getTestDir().getAbsolutePath(), customName);
|
||||
if (!dirA.exists()) {
|
||||
dirA.mkdirs();
|
||||
}
|
||||
if (!dirB.exists()) {
|
||||
dirB.mkdirs();
|
||||
}
|
||||
SharedTestUtils.copyDir(dirA, dirB);
|
||||
|
||||
env = testEnv.open(customName, false);
|
||||
runner = new TransactionRunner(env);
|
||||
|
@ -106,10 +112,8 @@ public class StoredClassCatalogTest extends TestBase
|
|||
catalog = new StoredClassCatalog(openDb(CATALOG_FILE, false));
|
||||
catalog2 = new StoredClassCatalog(openDb("catalog2.db", true));
|
||||
|
||||
SerialBinding keyBinding = new SerialBinding(catalog,
|
||||
String.class);
|
||||
SerialBinding valueBinding = new SerialBinding(catalog,
|
||||
TestSerial.class);
|
||||
SerialBinding keyBinding = new SerialBinding(catalog, String.class);
|
||||
SerialBinding valueBinding = new SerialBinding(catalog, TestSerial.class);
|
||||
store = openDb(STORE_FILE, false);
|
||||
|
||||
map = new StoredMap(store, keyBinding, valueBinding, true);
|
||||
|
@ -158,7 +162,6 @@ public class StoredClassCatalogTest extends TestBase
|
|||
}
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void runTest()
|
||||
throws Exception {
|
||||
|
|
|
@ -90,8 +90,7 @@ public class StoredClassCatalogTestInit extends TestBase
|
|||
catalog = new StoredClassCatalog(openDb(CATALOG_FILE));
|
||||
|
||||
SerialBinding keyBinding = new SerialBinding(catalog, String.class);
|
||||
SerialBinding valueBinding =
|
||||
new SerialBinding(catalog, TestSerial.class);
|
||||
SerialBinding valueBinding = new SerialBinding(catalog, TestSerial.class);
|
||||
store = openDb(STORE_FILE);
|
||||
|
||||
map = new StoredMap(store, keyBinding, valueBinding, true);
|
||||
|
@ -128,8 +127,11 @@ public class StoredClassCatalogTestInit extends TestBase
|
|||
* Copy environment generated by this test to test dest dir.
|
||||
* Since the environment is necessary for StoreClassCatalogTest.
|
||||
*/
|
||||
SharedTestUtils.copyDir(testEnv.getDirectory(customName, false),
|
||||
new File(SharedTestUtils.getDestDir(), customName));
|
||||
File destDir = new File(SharedTestUtils.getDestDir().getAbsolutePath(), customName);
|
||||
if (!destDir.isDirectory()) {
|
||||
destDir.mkdirs();
|
||||
}
|
||||
SharedTestUtils.copyDir(testEnv.getDirectory(customName, false), destDir);
|
||||
|
||||
} catch (Exception e) {
|
||||
System.err.println("Ignored exception during tearDown: ");
|
||||
|
@ -145,11 +147,9 @@ public class StoredClassCatalogTestInit extends TestBase
|
|||
}
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void runTest()
|
||||
throws Exception {
|
||||
|
||||
runner.run(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -128,8 +128,7 @@ public class EnvironmentConfigTest extends TestBase {
|
|||
}
|
||||
|
||||
/* Read the je.properties. */
|
||||
ArrayList<String> formerLines = TestUtils.readWriteJEProperties
|
||||
(envHome, propName + "=" + propValue + "\n");
|
||||
ArrayList<String> formerLines = TestUtils.readWriteJEProperties(envHome, propName + "=" + propValue + "\n");
|
||||
|
||||
/* Check this behavior is valid. */
|
||||
Environment env = null;
|
||||
|
|
|
@ -52,7 +52,7 @@ public class StatCaptureTest extends TestBase {
|
|||
private static final String DB_NAME = "foo";
|
||||
|
||||
public StatCaptureTest() {
|
||||
envHome = SharedTestUtils.getTestDir();
|
||||
envHome = new File(SharedTestUtils.getTestDir().getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -573,14 +573,14 @@ public class StatCaptureTest extends TestBase {
|
|||
envConfig.setConfigParam(
|
||||
EnvironmentParams.STATS_COLLECT_INTERVAL.getName(), "1 s");
|
||||
envConfig.setConfigParam(EnvironmentConfig.VERIFY_BTREE, "false");
|
||||
repEnvInfo = RepTestUtils.setupEnvInfos(
|
||||
envHome, 2, envConfig, new ReplicationConfig());
|
||||
repEnvInfo = RepTestUtils.setupEnvInfos(envHome, 2, envConfig, new ReplicationConfig());
|
||||
repEnvHome = new File[repEnvInfo.length];
|
||||
for (int i = 0; i < repEnvInfo.length; i++) {
|
||||
repEnvHome[i] = repEnvInfo[i].getEnvHome();
|
||||
SharedTestUtils.cleanUpTestDir(repEnvHome[i]);
|
||||
}
|
||||
|
||||
/* remove any existing stats files. */
|
||||
/* Remove any existing stats files. */
|
||||
for (RepEnvInfo ri : repEnvInfo) {
|
||||
File[] files = ri.getEnvHome().listFiles(ff);
|
||||
for (File f : files) {
|
||||
|
@ -602,8 +602,7 @@ public class StatCaptureTest extends TestBase {
|
|||
fastconfig.setClear(true);
|
||||
|
||||
/*
|
||||
* sleep to allow at least one row to be captured in stat file
|
||||
* before doing work.
|
||||
* Sleep to allow at least one row to be captured in stat file before doing work.
|
||||
*/
|
||||
Thread.sleep(1000);
|
||||
ReplicatedEnvironmentStats rs = replica.getRepStats(fastconfig);
|
||||
|
@ -628,10 +627,9 @@ public class StatCaptureTest extends TestBase {
|
|||
Thread.sleep(2000);
|
||||
RepTestUtils.shutdownRepEnvs(repEnvInfo);
|
||||
}
|
||||
/* Check master statistics */
|
||||
File statcsv =
|
||||
new File(repEnvHome[0].getAbsolutePath() + File.separator +
|
||||
"je.stat.csv");
|
||||
|
||||
/* Check master statistics. */
|
||||
File statcsv = new File(repEnvHome[0].getAbsolutePath() + File.separator + "je.stat.csv");
|
||||
Map<String, Long> values = StatFile.sumItUp(statcsv);
|
||||
Long putCount = values.get("Op:priInsert");
|
||||
assertEquals(putCount.longValue(), DATACOUNT);
|
||||
|
|
|
@ -66,7 +66,7 @@ public class ReadOnlyLockingTest extends CleanerTestBase {
|
|||
private Process readerProcess;
|
||||
|
||||
private static File getProcessFile() {
|
||||
return SharedTestUtils.getDestDirChlid("ReadOnlyProcessFile");
|
||||
return SharedTestUtils.getDestDirChild("ReadOnlyProcessFile");
|
||||
}
|
||||
|
||||
private static void deleteProcessFile() {
|
||||
|
|
|
@ -86,7 +86,7 @@ public class DbEnvPoolTest extends TestBase {
|
|||
Environment envA = new Environment(envHomeA, envConfig);
|
||||
|
||||
/* Look in the environment pool with the relative path name. */
|
||||
File file2 = new File(SharedTestUtils.DEFAULT_DEST_DIR);
|
||||
File file2 = new File(SharedTestUtils.defaultDestDir());
|
||||
assertTrue(DbEnvPool.getInstance().isOpen(file2));
|
||||
|
||||
envA.close();
|
||||
|
|
|
@ -147,11 +147,10 @@ public class UpgradeTest extends TestBase {
|
|||
}
|
||||
final ClassLoader parentClassLoader = Thread.currentThread().getContextClassLoader();
|
||||
for (int i = 0; i < N_APP_VERSIONS; i += 1) {
|
||||
final ClassLoader myLoader = new SimpleClassLoader
|
||||
(parentClassLoader,
|
||||
new File(evolveParentDir, "dplUpgrade." + i));
|
||||
appClasses[i] =
|
||||
Class.forName(APP_IMPL, true /*initialize*/, myLoader);
|
||||
File dir = new File(new File(SharedTestUtils.getCwd()).getParentFile().getParentFile().getAbsolutePath(),
|
||||
"stasis-test-dpl-v" + String.valueOf(i) + File.separator + SharedTestUtils.defaultDestDir());
|
||||
final ClassLoader myLoader = new SimpleClassLoader(parentClassLoader, dir);
|
||||
appClasses[i] = Class.forName(APP_IMPL, true /*initialize*/, myLoader);
|
||||
}
|
||||
|
||||
/* Open v0 app objects. */
|
||||
|
|
|
@ -214,49 +214,17 @@ public class RepTestUtils {
|
|||
|
||||
/**
|
||||
* Create a directory within the envRoot directory nodes for housing a
|
||||
* single replicated environment. The directory will be named
|
||||
* <envRoot>/rep<i>
|
||||
* single replicated environment. Name the directory `<envRoot>/rep<i>`.
|
||||
*/
|
||||
public static File makeRepEnvDir(File envRoot, int i)
|
||||
throws IOException {
|
||||
|
||||
File jeProperties = new File(envRoot, "je.properties");
|
||||
/* Make a sub-directory for the replica. */
|
||||
File envHome = new File(envRoot, REPDIR + i);
|
||||
envHome.mkdir();
|
||||
|
||||
/* Copy the test je.properties into the new directories. */
|
||||
File repProperties = new File(envHome, "je.properties");
|
||||
FileInputStream from = null;
|
||||
FileOutputStream to = null;
|
||||
try {
|
||||
try {
|
||||
from = new FileInputStream(jeProperties);
|
||||
} catch (FileNotFoundException e) {
|
||||
jeProperties.createNewFile();
|
||||
|
||||
from = new FileInputStream(jeProperties);
|
||||
}
|
||||
to = new FileOutputStream(repProperties);
|
||||
byte[] buffer = new byte[4096];
|
||||
int bytesRead;
|
||||
|
||||
while ((bytesRead = from.read(buffer)) != -1) {
|
||||
to.write(buffer, 0, bytesRead);
|
||||
}
|
||||
} finally {
|
||||
if (from != null) {
|
||||
try {
|
||||
from.close();
|
||||
} catch (IOException ignore) {
|
||||
}
|
||||
}
|
||||
if (to != null) {
|
||||
try {
|
||||
to.close();
|
||||
} catch (IOException ignore) {
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Copy the test je.properties into the directory. */
|
||||
SharedTestUtils.copyFile(new File(envRoot, "je.properties"), envHome);
|
||||
|
||||
return envHome;
|
||||
}
|
||||
|
@ -439,17 +407,16 @@ public class RepTestUtils {
|
|||
/*
|
||||
* Give all the environments the same environment configuration.
|
||||
*
|
||||
* If the file size is not set by the calling test, stagger their log
|
||||
* file length to give them slightly different logs and VLSNs. Disable
|
||||
* parameter validation because we want to make the log file length
|
||||
* smaller than the minimums, for testing.
|
||||
* Stagger the log file length when not set to give them slightly
|
||||
* different logs and VLSNs. Disable parameter validation because
|
||||
* we want to make the log file length smaller than the minimums,
|
||||
* for testing.
|
||||
*/
|
||||
if (!envConfig.isConfigParamSet(EnvironmentConfig.LOG_FILE_MAX)) {
|
||||
DbInternal.disableParameterValidation(envConfig);
|
||||
/* Vary the file size */
|
||||
/* Vary the file size. */
|
||||
long fileLen = ((envCount++ % 100) + 1) * 10000;
|
||||
envConfig.setConfigParam(EnvironmentConfig.LOG_FILE_MAX,
|
||||
Long.toString(fileLen));
|
||||
envConfig.setConfigParam(EnvironmentConfig.LOG_FILE_MAX, Long.toString(fileLen));
|
||||
}
|
||||
|
||||
repConfig.setHelperHosts((helper == null) ?
|
||||
|
@ -457,7 +424,7 @@ public class RepTestUtils {
|
|||
helper.getRepConfig().getNodeHostPort());
|
||||
|
||||
/*
|
||||
* If -DlongTimeout is true, then this test will run with very long
|
||||
* NOTE: When `-DlongTimeout` is `true`, then this test will run with very long
|
||||
* timeouts, to make interactive debugging easier.
|
||||
*/
|
||||
if (longTimeout) {
|
||||
|
@ -465,8 +432,7 @@ public class RepTestUtils {
|
|||
}
|
||||
|
||||
/*
|
||||
* If -DlongAckTimeout is true, then the test will set the
|
||||
* REPLICA_TIMEOUT to 50secs.
|
||||
* When `-DlongAckTimeout` is `true`, then the test will set the `REPLICA_TIMEOUT` to `50secs`.
|
||||
*/
|
||||
if (Boolean.getBoolean("longAckTimeout")) {
|
||||
repConfig.setReplicaAckTimeout(50, TimeUnit.SECONDS);
|
||||
|
|
|
@ -34,11 +34,13 @@ import com.sleepycat.je.DatabaseConfig;
|
|||
*/
|
||||
public class SharedTestUtils {
|
||||
|
||||
/* @see defaultDestDir() */
|
||||
private static String DEFAULT_DEST_DIR = "target/scala-%s/test-classes"; // util.Properties.versionNumberString
|
||||
|
||||
/* Common system properties for running tests */
|
||||
public static String DEST_DIR = "testdestdir";
|
||||
public static String TEST_ENV_DIR = "testenvdirroot";
|
||||
public static String FAILURE_DIR = "failurecopydir";
|
||||
public static String DEFAULT_DEST_DIR = "target/scala-%s/test-classes"; // util.Properties.versionNumberString
|
||||
public static String DEFAULT_TEST_DIR_ROOT = "target/envdata";
|
||||
public static String DEFAULT_FAIL_DIR = "target/failures";
|
||||
public static String NO_SYNC = "txnnosync";
|
||||
|
@ -50,6 +52,10 @@ public class SharedTestUtils {
|
|||
DBCONFIG_CREATE.setAllowCreate(true);
|
||||
}
|
||||
|
||||
public static String getCwd() {
|
||||
return System.getProperty("user.dir");
|
||||
}
|
||||
|
||||
public static String defaultDestDir() {
|
||||
String version = System.getProperty("scala.version");
|
||||
return String.format(DEFAULT_DEST_DIR, version == null ? "2.13" : version);
|
||||
|
@ -72,7 +78,7 @@ public class SharedTestUtils {
|
|||
* The environment store compiled class files and generated environment by
|
||||
* test that is distinctive with test environment.
|
||||
*/
|
||||
public static File getDestDirChlid(String child) {
|
||||
public static File getDestDirChild(String child) {
|
||||
String dir = System.getProperty(DEST_DIR, defaultDestDir());
|
||||
File file = new File(dir, child);
|
||||
|
||||
|
@ -280,8 +286,8 @@ public class SharedTestUtils {
|
|||
/**
|
||||
* Copy file to specified location.
|
||||
*/
|
||||
private static void copyFile(File from, File to)
|
||||
throws Exception {
|
||||
public static void copyFile(File from, File to)
|
||||
throws IOException {
|
||||
|
||||
if (to.isDirectory())
|
||||
to = new File(to, from.getName());
|
||||
|
@ -313,8 +319,7 @@ public class SharedTestUtils {
|
|||
*/
|
||||
public static void cleanUpTestDir(File dir) {
|
||||
if (!dir.isDirectory() || !dir.exists())
|
||||
throw new IllegalStateException(
|
||||
"Not an existing directory: " + dir);
|
||||
throw new IllegalStateException("Not an existing directory: " + dir);
|
||||
File[] files = dir.listFiles();
|
||||
if (files == null)
|
||||
return;
|
||||
|
@ -327,12 +332,10 @@ public class SharedTestUtils {
|
|||
cleanUpTestDir(file);
|
||||
|
||||
if (file.list().length == 0 && !file.delete())
|
||||
throw new IllegalStateException(
|
||||
"Unable to delete" + file);
|
||||
throw new IllegalStateException("Unable to delete" + file);
|
||||
} else {
|
||||
if(!file.delete())
|
||||
throw new IllegalStateException(
|
||||
"Unable to delete " + file);
|
||||
throw new IllegalStateException("Unable to delete " + file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue