Example usage for java.lang System setErr

List of usage examples for java.lang System setErr

Introduction

In this page you can find the example usage for java.lang System setErr.

Prototype

public static void setErr(PrintStream err) 

Source Link

Document

Reassigns the "standard" error output stream.

Usage

From source file:test.org.eclipse.dirigible.runtime.java.AbstractJavaExecutorTest.java

protected IScriptExecutor createExecutor() {
    try {//from  w w  w . jav  a 2  s . c  o  m
        return new JavaExecutorStub(getRepository(), ClassFileManager.getJars(getLibDirectory()),
                getRootPaths());
    } catch (IOException e) {
        System.setErr(printStream);
        fail(e.getMessage());
    }
    return null;
}

From source file:org.apache.zookeeper.server.persistence.TxnLogToolkitTest.java

@After
public void tearDown() throws IOException {
    System.setOut(System.out);
    System.setErr(System.err);
    mySnapDir.setWritable(true);//w  w w  . jav a2  s  . co  m
    FileUtils.deleteDirectory(mySnapDir);
}

From source file:edu.rit.flick.util.FlickTest.java

@BeforeClass
public static void setUpStreams() {
    oldOut = System.out;/*from  w w w  .j a  v  a  2s .c  o  m*/
    oldErr = System.err;
    System.setOut(new PrintStream(outContent));
    System.setErr(new PrintStream(errContent));
}

From source file:net.officefloor.tutorial.exceptionhttpserver.ExceptionHttpServerTest.java

@Override
protected void tearDown() throws Exception {

    // Reinstate stderr
    System.setErr(this.stderr);

    // Shutdown client
    this.client.close();

    // Stop server
    WoofOfficeFloorSource.stop();// ww  w. ja v a2 s .c om
}

From source file:com.tvh.infrastructure.openedge.Broker.java

public BrokerStatus getStatus() throws RemoteException {

    PrintStream nulloutput = new PrintStream(new NullOutputStream());
    PrintStream out = System.out;
    PrintStream err = System.err;
    int maxAgents = 0;
    int maxClients = 0;
    try {/*from  w w  w  .j  a va 2s  . c o  m*/
        System.setOut(nulloutput);
        System.setErr(nulloutput);

        IChimeraRemoteCommand connect = server.connect(getBrokerName());
        int result = connect.runIt(new String[] { (type == BrokerType.ASBROKER ? "AS" : "WS"), "q" });
        if (connect.getSystemOutput().contains("(8313)")) {
            return new BrokerStatus(BrokerStatus.RunningStatus.STOPPED);
        }
        connect.runIt(new String[] { (type == BrokerType.ASBROKER ? "AS" : "WS"), "z", "maxSrvrInstance" });
        maxAgents = Integer.parseInt(connect.getStructuredSystemOutput().get("maxSrvrInstance").toString());
        connect.runIt(new String[] { (type == BrokerType.ASBROKER ? "AS" : "WS"), "z", "maxClientInstance" });
        maxClients = Integer.parseInt(connect.getStructuredSystemOutput().get("maxClientInstance").toString());

    } finally {
        System.setOut(out);
        System.setErr(err);
    }

    HashMap<Integer, String> labels = new HashMap<>(15);
    HashMap<String, String> values = new HashMap<>(15);
    ToolRemoteCmdDescriptor cmd = new ToolRemoteCmdDescriptor();

    ToolRemoteCmdStatus cmdStatus;
    cmd.makeGetSummaryStatusLblPkt((type == BrokerType.ASBROKER ? "AS." : "WS.") + getBrokerName());
    /*cmd.makeGetSummaryStatusDataPkt( (type == BrokerType.ASBROKER ? "AS." : "WS.") + getBrokerName() );*/
    ToolRemoteCmdStatus labelFetcher = remoteStub.getRemoteManageObject().doRemoteToolCmd(cmd);
    Enumeration summaryLabels = labelFetcher.fetchGetSummaryStatuslblStatus();
    if (summaryLabels != null) {

        int i = 0;
        while (summaryLabels.hasMoreElements()) {
            String label = (String) summaryLabels.nextElement();
            labels.put(i, label.trim());
            i++;
        }

        cmd.makeGetSummaryStatusDataPkt((type == BrokerType.ASBROKER ? "AS." : "WS.") + getBrokerName());
        ToolRemoteCmdStatus statusFetcher = remoteStub.getRemoteManageObject().doRemoteToolCmd(cmd);
        Enumeration summaryValues = statusFetcher.fetchGetSummaryStatusDataStatus();
        i = 0;
        while (summaryValues.hasMoreElements()) {
            String value = (String) summaryValues.nextElement();
            values.put(labels.get(i), value.trim());
            i++;
        }
    }
    return new BrokerStatus(values, maxAgents, maxClients);

}

From source file:cpd3314.project.CPD3314ProjectTest.java

@After
public void tearDown() {
    System.setOut(null);
    System.setErr(null);
}

From source file:org.apache.hadoop.gateway.KnoxCliLdapFuncTestNegative.java

@BeforeClass
public static void setupSuite() throws Exception {
    LOG_ENTER();/* ww w  . j a v a 2  s  . co m*/
    System.setOut(new PrintStream(outContent));
    System.setErr(new PrintStream(errContent));
    setupLdap();
    setupGateway();
    LOG_EXIT();
}

From source file:com.iblsoft.iwxxm.webservice.Main.java

private static void runAsService() throws Exception {
    Configuration configuration = ConfigManager.getConfiguration();

    File logFilePath = new File(configuration.getLogDir(), configuration.getLogFileNamePattern());
    RolloverFileOutputStream os = new RolloverFileOutputStream(logFilePath.getAbsolutePath(), true,
            configuration.getLogRetainInDays(), TimeZone.getTimeZone("UTC"));
    PrintStream logStream = new PrintStream(os);

    Handler handler = createValidationServletHandler(configuration);
    if (configuration.isAccessLogEnabled()) {
        handler = createAccessLogHandler(configuration, handler);
    }/*from w w w  .  j a  v  a2  s  .  com*/

    printServiceHelp(configuration);

    Server server = new Server(configuration.getServerPort());
    server.setHandler(handler);

    System.setOut(logStream);
    System.setErr(logStream);
    server.start();
    Log.INSTANCE.info("IBL IWXXM Web Service started [{}]", configuration.getServerPort());

    server.join();
}

From source file:dbs_project.util.Utils.java

public static void revertStreams() {
    System.setOut(oldOut);
    System.setErr(oldErr);
}

From source file:org.gradle.util.RedirectStdOutAndErr.java

public Statement apply(final Statement base, FrameworkMethod method, Object target) {
    return new Statement() {
        @Override//w  ww.j  a  va2 s  . c o  m
        public void evaluate() throws Throwable {
            originalStdOut = System.out;
            originalStdErr = System.err;
            stdOutRouter.setOut(originalStdOut);
            stdErrRouter.setOut(originalStdErr);
            try {
                System.setOut(stdOutPrintStream);
                System.setErr(stdErrPrintStream);
                base.evaluate();
            } finally {
                System.setOut(originalStdOut);
                System.setErr(originalStdErr);
                stdOutRouter = null;
                stdErrRouter = null;
                stdOutPrintStream = null;
                stdErrPrintStream = null;
                stdoutContent = null;
                stderrContent = null;
            }
        }
    };
}