order test output & junit control seqs (IDEA-62424)

This commit is contained in:
anna
2010-12-06 22:11:39 +03:00
parent 567dfb55ba
commit 8580be3756
4 changed files with 82 additions and 20 deletions
@@ -17,8 +17,10 @@ package com.intellij.execution.junit2.segments;
import com.intellij.execution.junit.SegmentedInputStreamReader;
import com.intellij.execution.junit2.SegmentedInputStream;
import com.intellij.execution.testframework.Printable;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.rt.execution.junit.segments.PacketProcessor;
import java.io.InputStream;
@@ -31,6 +33,8 @@ import java.nio.charset.Charset;
public class Extractor {
private DeferredActionsQueue myFulfilledWorkGate = null;
private final SegmentedInputStream myStream;
private OutputPacketProcessor myEventsDispatcher;
private static final Logger LOG = Logger.getInstance("#" + Extractor.class.getName());
public Extractor(final InputStream stream, final Charset charset) {
myStream = new SegmentedInputStream(stream, charset);
@@ -54,7 +58,7 @@ public class Extractor {
queue.setDispactchListener(listener);
}
};
myStream.setEventsDispatcher(new PacketProcessor() {
myEventsDispatcher = new OutputPacketProcessor() {
public void processPacket(final String packet) {
myFulfilledWorkGate.addLast(new Runnable() {
public void run() {
@@ -62,7 +66,22 @@ public class Extractor {
}
});
}
});
@Override
public void processOutput(final Printable printable) {
LOG.assertTrue(packetProcessor instanceof OutputPacketProcessor);
myFulfilledWorkGate.addLast(new Runnable() {
public void run() {
((OutputPacketProcessor)packetProcessor).processOutput(printable);
}
});
}
};
myStream.setEventsDispatcher(myEventsDispatcher);
}
public OutputPacketProcessor getEventsDispatcher() {
return myEventsDispatcher;
}
public Reader createReader() {
@@ -0,0 +1,27 @@
/*
* Copyright 2000-2010 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.execution.junit2.segments;
import com.intellij.execution.testframework.Printable;
import com.intellij.rt.execution.junit.segments.PacketProcessor;
/**
* User: anna
* Date: 12/6/10
*/
public interface OutputPacketProcessor extends PacketProcessor{
void processOutput(Printable printable);
}