org.eclipse.jdt.junit.runtime_3.4.300.v20110928-1453

16:45:09.224 INFO  jd.cli.Main - Decompiling org.eclipse.jdt.junit.runtime_3.4.300.v20110928-1453.jar
package org.eclipse.jdt.internal.junit.runner;

public abstract class AbstractTestLoader
  implements ITestLoader
{
  protected ClassLoader fClassLoader = getClass().getClassLoader();
  
  public void setClassLoader(ClassLoader classLoader)
  {
    fClassLoader = classLoader;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.runner.AbstractTestLoader
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.runner;

import java.util.Enumeration;
import java.util.NoSuchElementException;

final class CustomHashtable$EmptyEnumerator
  implements Enumeration
{
  CustomHashtable$EmptyEnumerator(EmptyEnumerator paramEmptyEnumerator)
  {
    this();
  }
  
  public boolean hasMoreElements()
  {
    return false;
  }
  
  public Object nextElement()
  {
    throw new NoSuchElementException();
  }
  
  private CustomHashtable$EmptyEnumerator() {}
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.runner.CustomHashtable.EmptyEnumerator
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.runner;

import java.util.Enumeration;
import java.util.NoSuchElementException;

class CustomHashtable$HashEnumerator
  implements Enumeration
{
  boolean key;
  int start;
  CustomHashtable.HashMapEntry entry;
  final CustomHashtable this$0;
  
  CustomHashtable$HashEnumerator(CustomHashtable paramCustomHashtable, boolean isKey)
  {
    this$0 = paramCustomHashtable;
    key = isKey;
    start = firstSlot;
  }
  
  public boolean hasMoreElements()
  {
    if (entry != null) {
      return true;
    }
    while (start <= this$0.lastSlot) {
      if (this$0.elementData[(start++)] != null)
      {
        entry = this$0.elementData[(start - 1)];
        return true;
      }
    }
    return false;
  }
  
  public Object nextElement()
  {
    if (hasMoreElements())
    {
      Object result = key ? entry.key : entry.value;
      entry = entry.next;
      return result;
    }
    throw new NoSuchElementException();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.runner.CustomHashtable.HashEnumerator
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.runner;

class CustomHashtable$HashMapEntry
{
  Object key;
  Object value;
  HashMapEntry next;
  
  CustomHashtable$HashMapEntry(Object theKey, Object theValue)
  {
    key = theKey;
    value = theValue;
  }
  
  public String toString()
  {
    StringBuffer buffer = new StringBuffer();
    appendToStringWithCommaNL(buffer);
    int length = buffer.length();
    if (length >= 2) {
      return buffer.substring(0, length - 2);
    }
    return buffer.toString();
  }
  
  private void appendToStringWithCommaNL(StringBuffer buffer)
  {
    HashMapEntry hashMapEntry = this;
    do
    {
      buffer.append(key);
      buffer.append('=');
      buffer.append(value);
      buffer.append(",\n");
      hashMapEntry = next;
    } while (hashMapEntry != null);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.runner.CustomHashtable.HashMapEntry
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.runner;

import java.util.Enumeration;
import java.util.NoSuchElementException;

public final class CustomHashtable
{
  transient int elementCount;
  transient HashMapEntry[] elementData;
  private float loadFactor;
  private int threshold;
  
  private static class HashMapEntry
  {
    Object key;
    Object value;
    HashMapEntry next;
    
    HashMapEntry(Object theKey, Object theValue)
    {
      key = theKey;
      value = theValue;
    }
    
    public String toString()
    {
      StringBuffer buffer = new StringBuffer();
      appendToStringWithCommaNL(buffer);
      int length = buffer.length();
      if (length >= 2) {
        return buffer.substring(0, length - 2);
      }
      return buffer.toString();
    }
    
    private void appendToStringWithCommaNL(StringBuffer buffer)
    {
      HashMapEntry hashMapEntry = this;
      do
      {
        buffer.append(key);
        buffer.append('=');
        buffer.append(value);
        buffer.append(",\n");
        hashMapEntry = next;
      } while (hashMapEntry != null);
    }
  }
  
  private static final class EmptyEnumerator
    implements Enumeration
  {
    EmptyEnumerator(EmptyEnumerator paramEmptyEnumerator)
    {
      this();
    }
    
    public boolean hasMoreElements()
    {
      return false;
    }
    
    public Object nextElement()
    {
      throw new NoSuchElementException();
    }
    
    private EmptyEnumerator() {}
  }
  
  private class HashEnumerator
    implements Enumeration
  {
    boolean key;
    int start;
    CustomHashtable.HashMapEntry entry;
    
    HashEnumerator(boolean isKey)
    {
      key = isKey;
      start = firstSlot;
    }
    
    public boolean hasMoreElements()
    {
      if (entry != null) {
        return true;
      }
      while (start <= lastSlot) {
        if (elementData[(start++)] != null)
        {
          entry = elementData[(start - 1)];
          return true;
        }
      }
      return false;
    }
    
    public Object nextElement()
    {
      if (hasMoreElements())
      {
        Object result = key ? entry.key : entry.value;
        entry = entry.next;
        return result;
      }
      throw new NoSuchElementException();
    }
  }
  
  transient int firstSlot = 0;
  transient int lastSlot = -1;
  private transient IElementComparer comparer;
  private static final EmptyEnumerator emptyEnumerator = new EmptyEnumerator(null);
  public static final int DEFAULT_CAPACITY = 13;
  
  public CustomHashtable()
  {
    this(13);
  }
  
  public CustomHashtable(int capacity)
  {
    this(capacity, null);
  }
  
  public CustomHashtable(IElementComparer comparer)
  {
    this(13, comparer);
  }
  
  public CustomHashtable(int capacity, IElementComparer comparer)
  {
    if (capacity >= 0)
    {
      elementCount = 0;
      elementData = new HashMapEntry[capacity == 0 ? 1 : capacity];
      firstSlot = elementData.length;
      loadFactor = 0.75F;
      computeMaxSize();
    }
    else
    {
      throw new IllegalArgumentException();
    }
    this.comparer = comparer;
  }
  
  public CustomHashtable(CustomHashtable table, IElementComparer comparer)
  {
    this(table.size() * 2, comparer);
    int i = elementData.length;
    do
    {
      HashMapEntry entry = elementData[i];
      while (entry != null)
      {
        put(key, value);
        entry = next;
      }
      i--;
    } while (i >= 0);
  }
  
  private void computeMaxSize()
  {
    threshold = ((int)(elementData.length * loadFactor));
  }
  
  public boolean containsKey(Object key)
  {
    return getEntry(key) != null;
  }
  
  public Enumeration elements()
  {
    if (elementCount == 0) {
      return emptyEnumerator;
    }
    return new HashEnumerator(false);
  }
  
  public Object get(Object key)
  {
    int index = (hashCode(key) & 0x7FFFFFFF) % elementData.length;
    HashMapEntry entry = elementData[index];
    while (entry != null)
    {
      if (keyEquals(key, key)) {
        return value;
      }
      entry = next;
    }
    return null;
  }
  
  public Object getKey(Object key)
  {
    int index = (hashCode(key) & 0x7FFFFFFF) % elementData.length;
    HashMapEntry entry = elementData[index];
    while (entry != null)
    {
      if (keyEquals(key, key)) {
        return key;
      }
      entry = next;
    }
    return null;
  }
  
  private HashMapEntry getEntry(Object key)
  {
    int index = (hashCode(key) & 0x7FFFFFFF) % elementData.length;
    HashMapEntry entry = elementData[index];
    while (entry != null)
    {
      if (keyEquals(key, key)) {
        return entry;
      }
      entry = next;
    }
    return null;
  }
  
  private int hashCode(Object key)
  {
    if (comparer == null) {
      return key.hashCode();
    }
    return comparer.hashCode(key);
  }
  
  private boolean keyEquals(Object a, Object b)
  {
    if (comparer == null) {
      return a.equals(b);
    }
    return comparer.equals(a, b);
  }
  
  public Enumeration keys()
  {
    if (elementCount == 0) {
      return emptyEnumerator;
    }
    return new HashEnumerator(true);
  }
  
  public Object put(Object key, Object value)
  {
    if ((key != null) && (value != null))
    {
      int index = (hashCode(key) & 0x7FFFFFFF) % elementData.length;
      HashMapEntry entry = elementData[index];
      while ((entry != null) && (!keyEquals(key, key))) {
        entry = next;
      }
      if (entry == null)
      {
        if (++elementCount > threshold)
        {
          rehash();
          index = (hashCode(key) & 0x7FFFFFFF) % elementData.length;
        }
        if (index < firstSlot) {
          firstSlot = index;
        }
        if (index > lastSlot) {
          lastSlot = index;
        }
        entry = new HashMapEntry(key, value);
        next = elementData[index];
        elementData[index] = entry;
        return null;
      }
      Object result = value;
      key = key;
      
      value = value;
      return result;
    }
    throw new NullPointerException();
  }
  
  private void rehash()
  {
    int length = elementData.length << 1;
    if (length == 0) {
      length = 1;
    }
    firstSlot = length;
    lastSlot = -1;
    HashMapEntry[] newData = new HashMapEntry[length];
    int i = elementData.length;
    do
    {
      HashMapEntry entry = elementData[i];
      while (entry != null)
      {
        int index = (hashCode(key) & 0x7FFFFFFF) % length;
        if (index < firstSlot) {
          firstSlot = index;
        }
        if (index > lastSlot) {
          lastSlot = index;
        }
        HashMapEntry next = next;
        next = newData[index];
        newData[index] = entry;
        entry = next;
      }
      i--;
    } while (i >= 0);
    elementData = newData;
    computeMaxSize();
  }
  
  public Object remove(Object key)
  {
    HashMapEntry last = null;
    int index = (hashCode(key) & 0x7FFFFFFF) % elementData.length;
    HashMapEntry entry = elementData[index];
    while ((entry != null) && (!keyEquals(key, key)))
    {
      last = entry;
      entry = next;
    }
    if (entry != null)
    {
      if (last == null) {
        elementData[index] = next;
      } else {
        next = next;
      }
      elementCount -= 1;
      return value;
    }
    return null;
  }
  
  public int size()
  {
    return elementCount;
  }
  
  public String toString()
  {
    if (size() == 0) {
      return "{}";
    }
    StringBuffer buffer = new StringBuffer();
    buffer.append('{');
    int i = elementData.length;
    do
    {
      HashMapEntry entry = elementData[i];
      if (entry != null) {
        entry.appendToStringWithCommaNL(buffer);
      }
      i--;
    } while (i >= 0);
    if (elementCount > 0) {
      buffer.setLength(buffer.length() - 2);
    }
    buffer.append('}');
    return buffer.toString();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.runner.CustomHashtable
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.runner;

import java.io.PrintWriter;
import java.io.StringWriter;

public class DefaultClassifier
  implements IClassifiesThrowables
{
  private String fVersion;
  
  public DefaultClassifier(String version)
  {
    fVersion = version;
  }
  
  public String getTrace(Throwable t)
  {
    StringWriter stringWriter = new StringWriter();
    PrintWriter writer = new PrintWriter(stringWriter);
    t.printStackTrace(writer);
    StringBuffer buffer = stringWriter.getBuffer();
    return buffer.toString();
  }
  
  public boolean isComparisonFailure(Throwable throwable)
  {
    if (!fVersion.equals("3")) {
      return false;
    }
    return throwable.getClass().getName().equals("junit.framework.ComparisonFailure");
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.runner.DefaultClassifier
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.runner;

public class FailedComparison
{
  private final String fExpected;
  private final String fActual;
  
  public FailedComparison(String expected, String actual)
  {
    fExpected = expected;
    fActual = actual;
  }
  
  public String getActual()
  {
    return fActual;
  }
  
  public String getExpected()
  {
    return fExpected;
  }
  
  void sendMessages(MessageSender sender)
  {
    sender.sendMessage("%EXPECTS");
    sender.sendMessage(getExpected());
    sender.sendMessage("%EXPECTE");
    
    sender.sendMessage("%ACTUALS");
    sender.sendMessage(getActual());
    sender.sendMessage("%ACTUALE");
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.runner.FailedComparison
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.runner;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.List;
import java.util.Vector;
import junit.extensions.TestDecorator;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

public class FailuresFirstPrioritizer
  implements ITestPrioritizer
{
  private HashSet fPriorities;
  
  public FailuresFirstPrioritizer(String[] priorities)
  {
    fPriorities = new HashSet(Arrays.asList(priorities));
  }
  
  public Test prioritize(Test suite)
  {
    doPrioritize(suite, new ArrayList());
    return suite;
  }
  
  private void doPrioritize(Test suite, List path)
  {
    if ((suite instanceof TestCase))
    {
      TestCase testCase = (TestCase)suite;
      if (hasPriority(testCase)) {
        reorder(testCase, path);
      }
    }
    else if ((suite instanceof TestSuite))
    {
      TestSuite aSuite = (TestSuite)suite;
      path.add(suite);
      loopTests(path, aSuite);
      path.remove(path.size() - 1);
    }
    else if ((suite instanceof TestDecorator))
    {
      TestDecorator aDecorator = (TestDecorator)suite;
      path.add(aDecorator);
      doPrioritize(aDecorator.getTest(), path);
      path.remove(path.size() - 1);
    }
  }
  
  private void loopTests(List path, TestSuite aSuite)
  {
    for (Enumeration e = aSuite.tests(); e.hasMoreElements();) {
      doPrioritize((Test)e.nextElement(), path);
    }
  }
  
  private void reorder(Test test, List path)
  {
    doReorder(test, path, path.size() - 1);
  }
  
  private void doReorder(Test test, List path, int top)
  {
    if (top < 0) {
      return;
    }
    Test topTest = (Test)path.get(top);
    if ((topTest instanceof TestSuite))
    {
      TestSuite suite = (TestSuite)topTest;
      moveTestToFront(suite, test);
    }
    doReorder(topTest, path, top - 1);
  }
  
  void moveTestToFront(TestSuite suite, Test test)
  {
    Vector tests = (Vector)getField(suite, "fTests");
    for (int i = 0; i < tests.size(); i++) {
      if (tests.get(i) == test)
      {
        tests.remove(i);
        tests.insertElementAt(test, 0);
      }
    }
  }
  
  private boolean hasPriority(TestCase testCase)
  {
    return fPriorities.contains(testCase.toString());
  }
  
  public static Object getField(Object object, String fieldName)
  {
    return getFieldInClass(object, fieldName, object.getClass());
  }
  
  private static Object getFieldInClass(Object object, String fieldName, Class clazz)
  {
    Field field = null;
    if (clazz == null) {
      return null;
    }
    try
    {
      field = clazz.getDeclaredField(fieldName);
      field.setAccessible(true);
      return field.get(object);
    }
    catch (Exception localException) {}
    return getFieldInClass(object, fieldName, clazz.getSuperclass());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.runner.FailuresFirstPrioritizer
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.runner;

public class FirstRunExecutionListener
  implements IListensToTestExecutions
{
  protected MessageSender fSender;
  private TestIdMap fIds;
  
  FirstRunExecutionListener(MessageSender sender, TestIdMap ids)
  {
    fSender = sender;
    if (ids == null) {
      throw new NullPointerException();
    }
    fIds = ids;
  }
  
  public void notifyTestEnded(ITestIdentifier test)
  {
    sendMessage(test, "%TESTE  ");
  }
  
  public void notifyTestFailed(TestReferenceFailure failure)
  {
    sendMessage(failure.getTest(), failure.getStatus());
    sendFailure(failure, "%TRACES ", "%TRACEE ");
  }
  
  public void notifyTestStarted(ITestIdentifier test)
  {
    sendMessage(test, "%TESTS  ");
    fSender.flush();
  }
  
  private String getTestId(ITestIdentifier test)
  {
    return fIds.getTestId(test);
  }
  
  protected void sendFailure(TestReferenceFailure failure, String startTrace, String endTrace)
  {
    FailedComparison comparison = failure.getComparison();
    if (comparison != null) {
      comparison.sendMessages(fSender);
    }
    fSender.sendMessage(startTrace);
    fSender.sendMessage(failure.getTrace());
    fSender.sendMessage(endTrace);
    fSender.flush();
  }
  
  private void sendMessage(ITestIdentifier test, String status)
  {
    fSender.sendMessage(status + getTestId(test) + ',' + test.getName());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.runner.FirstRunExecutionListener
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.runner;

public abstract interface IClassifiesThrowables
{
  public abstract boolean isComparisonFailure(Throwable paramThrowable);
  
  public abstract String getTrace(Throwable paramThrowable);
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.runner.IClassifiesThrowables
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.runner;

public abstract interface IElementComparer
{
  public abstract boolean equals(Object paramObject1, Object paramObject2);
  
  public abstract int hashCode(Object paramObject);
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.runner.IElementComparer
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.runner;

public abstract interface IListensToTestExecutions
{
  public abstract void notifyTestFailed(TestReferenceFailure paramTestReferenceFailure);
  
  public abstract void notifyTestStarted(ITestIdentifier paramITestIdentifier);
  
  public abstract void notifyTestEnded(ITestIdentifier paramITestIdentifier);
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.runner.IListensToTestExecutions
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.runner;

public abstract interface IStopListener
{
  public abstract void stop();
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.runner.IStopListener
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.runner;

public abstract interface ITestIdentifier
{
  public abstract String getName();
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.runner.ITestIdentifier
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.runner;

public abstract interface ITestLoader
{
  public abstract ITestReference[] loadTests(Class[] paramArrayOfClass, String paramString, String[] paramArrayOfString, RemoteTestRunner paramRemoteTestRunner);
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.runner.ITestLoader
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.runner;

import junit.framework.Test;

public abstract interface ITestPrioritizer
{
  public abstract Test prioritize(Test paramTest);
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.runner.ITestPrioritizer
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.runner;

public abstract interface ITestReference
{
  public abstract int countTestCases();
  
  public abstract void sendTree(IVisitsTestTrees paramIVisitsTestTrees);
  
  public abstract void run(TestExecution paramTestExecution);
  
  public abstract ITestIdentifier getIdentifier();
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.runner.ITestReference
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.runner;

public abstract interface ITestRunner
{
  public abstract void runTests(TestExecution paramTestExecution);
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.runner.ITestRunner
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.runner;

public abstract interface IVisitsTestTrees
{
  public abstract void visitTreeEntry(ITestIdentifier paramITestIdentifier, boolean paramBoolean, int paramInt);
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.runner.IVisitsTestTrees
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.runner;

import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;

public class JUnitMessages
{
  private static final String BUNDLE_NAME = "org.eclipse.jdt.internal.junit.runner.JUnitMessages";
  private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle("org.eclipse.jdt.internal.junit.runner.JUnitMessages");
  
  public static String getFormattedString(String key, Object arg)
  {
    return MessageFormat.format(getString(key), new Object[] { arg });
  }
  
  public static String getFormattedString(String key, Object[] args)
  {
    return MessageFormat.format(getString(key), args);
  }
  
  public static String getString(String key)
  {
    try
    {
      return RESOURCE_BUNDLE.getString(key);
    }
    catch (MissingResourceException localMissingResourceException) {}
    return '!' + key + '!';
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.runner.JUnitMessages
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.runner;

public class MessageIds
{
  public static final int MSG_HEADER_LENGTH = 8;
  public static final String TRACE_START = "%TRACES ";
  public static final String TRACE_END = "%TRACEE ";
  public static final String EXPECTED_START = "%EXPECTS";
  public static final String EXPECTED_END = "%EXPECTE";
  public static final String ACTUAL_START = "%ACTUALS";
  public static final String ACTUAL_END = "%ACTUALE";
  public static final String RTRACE_START = "%RTRACES";
  public static final String RTRACE_END = "%RTRACEE";
  public static final String TEST_RUN_START = "%TESTC  ";
  public static final String TEST_START = "%TESTS  ";
  public static final String TEST_END = "%TESTE  ";
  public static final String TEST_ERROR = "%ERROR  ";
  public static final String TEST_FAILED = "%FAILED ";
  public static final String TEST_RUN_END = "%RUNTIME";
  public static final String TEST_STOPPED = "%TSTSTP ";
  public static final String TEST_RERAN = "%TSTRERN";
  public static final String TEST_TREE = "%TSTTREE";
  public static final String TEST_STOP = ">STOP   ";
  public static final String TEST_RERUN = ">RERUN  ";
  public static final String TEST_IDENTIFIER_MESSAGE_FORMAT = "{0}({1})";
  public static final String IGNORED_TEST_PREFIX = "@Ignore: ";
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.runner.MessageIds
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.runner;

public abstract interface MessageSender
{
  public abstract void sendMessage(String paramString);
  
  public abstract void flush();
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.runner.MessageSender
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.runner;

import junit.framework.Test;

public class NullPrioritizer
  implements ITestPrioritizer
{
  public Test prioritize(Test input)
  {
    return input;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.runner.NullPrioritizer
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.runner;

import java.io.BufferedReader;
import java.util.Vector;

class RemoteTestRunner$ReaderThread
  extends Thread
{
  final RemoteTestRunner this$0;
  
  public RemoteTestRunner$ReaderThread(RemoteTestRunner paramRemoteTestRunner)
  {
    super("ReaderThread");
    this$0 = paramRemoteTestRunner;
  }
  
  public void run()
  {
    try
    {
      String message = null;
      for (;;)
      {
        if ((message = RemoteTestRunner.access$0(this$0).readLine()) != null)
        {
          if (message.startsWith(">STOP   "))
          {
            RemoteTestRunner.access$1(this$0, true);
            this$0.stop();
            synchronized (this$0)
            {
              this$0.notifyAll();
            }
          }
          if (message.startsWith(">RERUN  "))
          {
            String arg = message.substring(8);
            
            int c0 = arg.indexOf(' ');
            int c1 = arg.indexOf(' ', c0 + 1);
            String s = arg.substring(0, c0);
            int testId = Integer.parseInt(s);
            String className = arg.substring(c0 + 1, c1);
            String testName = arg.substring(c1 + 1, arg.length());
            synchronized (this$0)
            {
              RemoteTestRunner.access$2(this$0).add(new RemoteTestRunner.RerunRequest(testId, className, testName));
              this$0.notifyAll();
            }
          }
        }
      }
    }
    catch (Exception localException)
    {
      this$0.stop();
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.ReaderThread
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.runner;

class RemoteTestRunner$RerunRequest
{
  String fRerunClassName;
  String fRerunTestName;
  int fRerunTestId;
  
  public RemoteTestRunner$RerunRequest(int testId, String className, String testName)
  {
    fRerunTestId = testId;
    fRerunClassName = className;
    fRerunTestName = testName;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.RerunRequest
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.runner;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
import java.net.Socket;
import java.util.Vector;
import org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader;

public class RemoteTestRunner
  implements MessageSender, IVisitsTestTrees
{
  public static final String RERAN_FAILURE = "FAILURE";
  public static final String RERAN_ERROR = "ERROR";
  public static final String RERAN_OK = "OK";
  private String[] fTestClassNames;
  private String fTestName;
  private TestExecution fExecution;
  
  private static class RerunRequest
  {
    String fRerunClassName;
    String fRerunTestName;
    int fRerunTestId;
    
    public RerunRequest(int testId, String className, String testName)
    {
      fRerunTestId = testId;
      fRerunClassName = className;
      fRerunTestName = testName;
    }
  }
  
  private String fVersion = "";
  private Socket fClientSocket;
  private PrintWriter fWriter;
  private BufferedReader fReader;
  private String fHost = "";
  private int fPort = -1;
  private boolean fDebugMode = false;
  private boolean fKeepAlive = false;
  private boolean fStopped = false;
  private Vector fRerunRequests = new Vector(10);
  private ReaderThread fReaderThread;
  private String fRerunTest;
  private final TestIdMap fIds = new TestIdMap();
  private String[] fFailureNames;
  private ITestLoader fLoader;
  private MessageSender fSender;
  private boolean fConsoleMode = false;
  
  private class ReaderThread
    extends Thread
  {
    public ReaderThread()
    {
      super();
    }
    
    public void run()
    {
      try
      {
        String message = null;
        for (;;)
        {
          if ((message = fReader.readLine()) != null)
          {
            if (message.startsWith(">STOP   "))
            {
              fStopped = true;
              stop();
              synchronized (RemoteTestRunner.this)
              {
                notifyAll();
              }
            }
            if (message.startsWith(">RERUN  "))
            {
              String arg = message.substring(8);
              
              int c0 = arg.indexOf(' ');
              int c1 = arg.indexOf(' ', c0 + 1);
              String s = arg.substring(0, c0);
              int testId = Integer.parseInt(s);
              String className = arg.substring(c0 + 1, c1);
              String testName = arg.substring(c1 + 1, arg.length());
              synchronized (RemoteTestRunner.this)
              {
                fRerunRequests.add(new RemoteTestRunner.RerunRequest(testId, className, testName));
                notifyAll();
              }
            }
          }
        }
      }
      catch (Exception localException)
      {
        stop();
      }
    }
  }
  
  public RemoteTestRunner()
  {
    setMessageSender(this);
  }
  
  public void setMessageSender(MessageSender sender)
  {
    fSender = sender;
  }
  
  /* Error */
  public static void main(String[] args)
  {
    // Byte code:
    //   0: new 347	org/eclipse/jdt/internal/junit/runner/RemoteTestRunner
    //   3: dup
    //   4: invokespecial 675	org/eclipse/jdt/internal/junit/runner/RemoteTestRunner:<init>	()V
    //   7: astore_1
    //   8: aload_1
    //   9: aload_0
    //   10: invokevirtual 690	org/eclipse/jdt/internal/junit/runner/RemoteTestRunner:init	([Ljava/lang/String;)V
    //   13: aload_1
    //   14: invokevirtual 677	org/eclipse/jdt/internal/junit/runner/RemoteTestRunner:run	()V
    //   17: goto +22 -> 39
    //   20: astore_1
    //   21: aload_1
    //   22: invokevirtual 658	java/lang/Throwable:printStackTrace	()V
    //   25: iconst_0
    //   26: invokestatic 656	java/lang/System:exit	(I)V
    //   29: goto +14 -> 43
    //   32: astore_2
    //   33: iconst_0
    //   34: invokestatic 656	java/lang/System:exit	(I)V
    //   37: aload_2
    //   38: athrow
    //   39: iconst_0
    //   40: invokestatic 656	java/lang/System:exit	(I)V
    //   43: return
    // Line number table:
    //   Java source line #195	-> byte code offset #0
    //   Java source line #196	-> byte code offset #8
    //   Java source line #197	-> byte code offset #13
    //   Java source line #198	-> byte code offset #20
    //   Java source line #199	-> byte code offset #21
    //   Java source line #202	-> byte code offset #25
    //   Java source line #200	-> byte code offset #32
    //   Java source line #202	-> byte code offset #33
    //   Java source line #203	-> byte code offset #37
    //   Java source line #202	-> byte code offset #39
    //   Java source line #204	-> byte code offset #43
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	44	0	args	String[]
    //   7	7	1	testRunServer	RemoteTestRunner
    //   20	2	1	e	Throwable
    //   32	6	2	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   0	17	20	java/lang/Throwable
    //   0	25	32	finally
  }
  
  protected void init(String[] args)
  {
    defaultInit(args);
  }
  
  protected ClassLoader getTestClassLoader()
  {
    return getClass().getClassLoader();
  }
  
  protected final void defaultInit(String[] args)
  {
    for (int i = 0; i < args.length; i++) {
      if ((args[i].toLowerCase().equals("-classnames")) || (args[i].toLowerCase().equals("-classname")))
      {
        Vector list = new Vector();
        for (int j = i + 1; j < args.length; j++)
        {
          if (args[j].startsWith("-")) {
            break;
          }
          list.add(args[j]);
        }
        fTestClassNames = ((String[])list.toArray(new String[list.size()]));
      }
      else if (args[i].toLowerCase().equals("-test"))
      {
        String testName = args[(i + 1)];
        int p = testName.indexOf(':');
        if (p == -1) {
          throw new IllegalArgumentException("Testname not separated by '%'");
        }
        fTestName = testName.substring(p + 1);
        fTestClassNames = new String[] { testName.substring(0, p) };
        i++;
      }
      else if (args[i].toLowerCase().equals("-testnamefile"))
      {
        String testNameFile = args[(i + 1)];
        try
        {
          readTestNames(testNameFile);
        }
        catch (IOException localIOException1)
        {
          throw new IllegalArgumentException("Cannot read testname file.");
        }
        i++;
      }
      else if (args[i].toLowerCase().equals("-testfailures"))
      {
        String testFailuresFile = args[(i + 1)];
        try
        {
          readFailureNames(testFailuresFile);
        }
        catch (IOException localIOException2)
        {
          throw new IllegalArgumentException("Cannot read testfailures file.");
        }
        i++;
      }
      else if (args[i].toLowerCase().equals("-port"))
      {
        fPort = Integer.parseInt(args[(i + 1)]);
        i++;
      }
      else if (args[i].toLowerCase().equals("-host"))
      {
        fHost = args[(i + 1)];
        i++;
      }
      else if (args[i].toLowerCase().equals("-rerun"))
      {
        fRerunTest = args[(i + 1)];
        i++;
      }
      else if (args[i].toLowerCase().equals("-keepalive"))
      {
        fKeepAlive = true;
      }
      else if ((args[i].toLowerCase().equals("-debugging")) || (args[i].toLowerCase().equals("-debug")))
      {
        fDebugMode = true;
      }
      else if (args[i].toLowerCase().equals("-version"))
      {
        fVersion = args[(i + 1)];
        i++;
      }
      else if (args[i].toLowerCase().equals("-junitconsole"))
      {
        fConsoleMode = true;
      }
      else if (args[i].toLowerCase().equals("-testloaderclass"))
      {
        String className = args[(i + 1)];
        createLoader(className);
        i++;
      }
    }
    if (getTestLoader() == null) {
      initDefaultLoader();
    }
    if ((fTestClassNames == null) || (fTestClassNames.length == 0)) {
      throw new IllegalArgumentException(JUnitMessages.getString("RemoteTestRunner.error.classnamemissing"));
    }
    if (fPort == -1) {
      throw new IllegalArgumentException(JUnitMessages.getString("RemoteTestRunner.error.portmissing"));
    }
    if (fDebugMode) {
      System.out.println("keepalive " + fKeepAlive);
    }
  }
  
  public void initDefaultLoader()
  {
    createLoader(JUnit3TestLoader.class.getName());
  }
  
  public void createLoader(String className)
  {
    setLoader(createRawTestLoader(className));
  }
  
  protected ITestLoader createRawTestLoader(String className)
  {
    try
    {
      return (ITestLoader)loadTestLoaderClass(className).newInstance();
    }
    catch (Exception e)
    {
      StringWriter trace = new StringWriter();
      e.printStackTrace(new PrintWriter(trace));
      String message = JUnitMessages.getFormattedString("RemoteTestRunner.error.invalidloader", new Object[] { className, trace.toString() });
      throw new IllegalArgumentException(message);
    }
  }
  
  protected Class loadTestLoaderClass(String className)
    throws ClassNotFoundException
  {
    return Class.forName(className);
  }
  
  public void setLoader(ITestLoader newInstance)
  {
    fLoader = newInstance;
  }
  
  /* Error */
  private void readTestNames(String testNameFile)
    throws IOException
  {
    // Byte code:
    //   0: new 312	java/io/BufferedReader
    //   3: dup
    //   4: new 317	java/io/InputStreamReader
    //   7: dup
    //   8: new 315	java/io/FileInputStream
    //   11: dup
    //   12: new 314	java/io/File
    //   15: dup
    //   16: aload_1
    //   17: invokespecial 607	java/io/File:<init>	(Ljava/lang/String;)V
    //   20: invokespecial 608	java/io/FileInputStream:<init>	(Ljava/io/File;)V
    //   23: ldc_w 302
    //   26: invokespecial 611	java/io/InputStreamReader:<init>	(Ljava/io/InputStream;Ljava/lang/String;)V
    //   29: invokespecial 604	java/io/BufferedReader:<init>	(Ljava/io/Reader;)V
    //   32: astore_2
    //   33: new 338	java/util/Vector
    //   36: dup
    //   37: invokespecial 665	java/util/Vector:<init>	()V
    //   40: astore 4
    //   42: goto +10 -> 52
    //   45: aload 4
    //   47: aload_3
    //   48: invokevirtual 668	java/util/Vector:add	(Ljava/lang/Object;)Z
    //   51: pop
    //   52: aload_2
    //   53: invokevirtual 605	java/io/BufferedReader:readLine	()Ljava/lang/String;
    //   56: dup
    //   57: astore_3
    //   58: ifnonnull -13 -> 45
    //   61: aload_0
    //   62: aload 4
    //   64: aload 4
    //   66: invokevirtual 664	java/util/Vector:size	()I
    //   69: anewarray 332	java/lang/String
    //   72: invokevirtual 669	java/util/Vector:toArray	([Ljava/lang/Object;)[Ljava/lang/Object;
    //   75: checkcast 311	[Ljava/lang/String;
    //   78: putfield 592	org/eclipse/jdt/internal/junit/runner/RemoteTestRunner:fTestClassNames	[Ljava/lang/String;
    //   81: goto +12 -> 93
    //   84: astore 5
    //   86: aload_2
    //   87: invokevirtual 603	java/io/BufferedReader:close	()V
    //   90: aload 5
    //   92: athrow
    //   93: aload_2
    //   94: invokevirtual 603	java/io/BufferedReader:close	()V
    //   97: aload_0
    //   98: getfield 581	org/eclipse/jdt/internal/junit/runner/RemoteTestRunner:fDebugMode	Z
    //   101: ifeq +57 -> 158
    //   104: getstatic 578	java/lang/System:out	Ljava/io/PrintStream;
    //   107: ldc_w 301
    //   110: invokevirtual 615	java/io/PrintStream:println	(Ljava/lang/String;)V
    //   113: iconst_0
    //   114: istore_3
    //   115: goto +34 -> 149
    //   118: getstatic 578	java/lang/System:out	Ljava/io/PrintStream;
    //   121: new 333	java/lang/StringBuffer
    //   124: dup
    //   125: ldc_w 286
    //   128: invokespecial 649	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   131: aload_0
    //   132: getfield 592	org/eclipse/jdt/internal/junit/runner/RemoteTestRunner:fTestClassNames	[Ljava/lang/String;
    //   135: iload_3
    //   136: aaload
    //   137: invokevirtual 654	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   140: invokevirtual 648	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   143: invokevirtual 615	java/io/PrintStream:println	(Ljava/lang/String;)V
    //   146: iinc 3 1
    //   149: iload_3
    //   150: aload_0
    //   151: getfield 592	org/eclipse/jdt/internal/junit/runner/RemoteTestRunner:fTestClassNames	[Ljava/lang/String;
    //   154: arraylength
    //   155: if_icmplt -37 -> 118
    //   158: return
    // Line number table:
    //   Java source line #336	-> byte code offset #0
    //   Java source line #339	-> byte code offset #33
    //   Java source line #340	-> byte code offset #42
    //   Java source line #341	-> byte code offset #45
    //   Java source line #340	-> byte code offset #52
    //   Java source line #343	-> byte code offset #61
    //   Java source line #345	-> byte code offset #84
    //   Java source line #346	-> 
1 2

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd