Remove System.out/.err Calls From All Tests
This commit is contained in:
@@ -20,6 +20,9 @@ import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.gemstone.gemfire.cache.Cache;
|
||||
import com.gemstone.gemfire.cache.CacheFactory;
|
||||
import com.gemstone.gemfire.cache.Region;
|
||||
@@ -39,6 +42,8 @@ import com.gemstone.gemfire.cache.server.CacheServer;
|
||||
*/
|
||||
public class CacheServerProcess {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(CacheServerProcess.class);
|
||||
|
||||
private CacheServerProcess() {
|
||||
super();
|
||||
}
|
||||
@@ -49,7 +54,7 @@ public class CacheServerProcess {
|
||||
props.setProperty("name", "CacheServer");
|
||||
props.setProperty("log-level", "info");
|
||||
|
||||
System.out.println("\nConnecting to the distributed system and creating the cache.");
|
||||
logger.info("Connecting to the distributed system and creating the cache.");
|
||||
|
||||
Cache cache = new CacheFactory(props).create();
|
||||
|
||||
@@ -58,15 +63,15 @@ public class CacheServerProcess {
|
||||
.setScope(Scope.DISTRIBUTED_ACK)
|
||||
.create("test");
|
||||
|
||||
System.out.println("Test region, " + region.getFullPath() + ", created in cache.");
|
||||
logger.info("Test region, " + region.getFullPath() + ", created in cache.");
|
||||
|
||||
// Start Cache Server.
|
||||
CacheServer server = cache.addCacheServer();
|
||||
server.setPort(40404);
|
||||
System.out.println("Starting server");
|
||||
logger.info("Starting server");
|
||||
server.start();
|
||||
ForkUtil.createControlFile(CacheServerProcess.class.getName());
|
||||
System.out.println("Waiting for shutdown");
|
||||
logger.info("Waiting for shutdown");
|
||||
|
||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
|
||||
bufferedReader.readLine();
|
||||
|
||||
@@ -24,6 +24,9 @@ import java.io.OutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* Utility for forking Java processes. Modified from the SGF version for SI
|
||||
*
|
||||
@@ -35,6 +38,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
*/
|
||||
public class ForkUtil {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(ForkUtil.class);
|
||||
|
||||
private static String TEMP_DIR = System.getProperty("java.io.tmpdir");
|
||||
|
||||
private ForkUtil() {
|
||||
@@ -61,7 +66,7 @@ public class ForkUtil {
|
||||
throw new IllegalStateException("Cannot start command " + cmdArray, ioe);
|
||||
}
|
||||
|
||||
System.out.println("Started fork");
|
||||
logger.info("Started fork");
|
||||
final Process p = proc;
|
||||
|
||||
final BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
|
||||
@@ -77,7 +82,7 @@ public class ForkUtil {
|
||||
Runtime.getRuntime().addShutdownHook(new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
System.out.println("Stopping fork...");
|
||||
logger.info("Stopping fork...");
|
||||
run.set(false);
|
||||
if (p != null) {
|
||||
p.destroy();
|
||||
@@ -89,7 +94,7 @@ public class ForkUtil {
|
||||
catch (InterruptedException e) {
|
||||
// ignore
|
||||
}
|
||||
System.out.println("Fork stopped");
|
||||
logger.info("Fork stopped");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -144,7 +149,7 @@ public class ForkUtil {
|
||||
}
|
||||
}
|
||||
if (controlFileExists(className)) {
|
||||
System.out.println("Started cache server");
|
||||
logger.info("Started cache server");
|
||||
}
|
||||
else {
|
||||
throw new RuntimeException("could not fork cache server");
|
||||
|
||||
Reference in New Issue
Block a user