diff --git a/src/jdk15/org/testng/v6/AfterOperationSet.java b/src/jdk15/org/testng/v6/AfterOperationSet.java
deleted file mode 100644
index 61f45f1..0000000
--- a/src/jdk15/org/testng/v6/AfterOperationSet.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.testng.v6;
-
-import java.util.List;
-import java.util.Set;
-
-public class AfterOperationSet {
- private Set<Operation> m_afterOperations = Sets.newHashSet();
-
- public void add(Operation operation) {
- m_afterOperations.add(operation);
- }
-
- public List<Operation> getOperationsThatMustRunAfter(Integer id) {
- List<Operation> result = Lists.newArrayList();
- List<Operation> toRemove = Lists.newArrayList();
- for (Operation o : m_afterOperations) {
- for (int n : o.getAfter()) {
- if (n == id) {
- result.add(o);
- toRemove.add(o);
- }
- }
- }
-
- for (Operation o : toRemove) {
- m_afterOperations.remove(o);
- }
- return result;
- }
-}
diff --git a/src/jdk15/org/testng/v6/IRunGroupFactory.java b/src/jdk15/org/testng/v6/IRunGroupFactory.java
deleted file mode 100644
index efbcf36..0000000
--- a/src/jdk15/org/testng/v6/IRunGroupFactory.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package org.testng.v6;
-
-public interface IRunGroupFactory {
-
- RunGroup getRunGroup(int type, String name);
-
- Integer findRunGroup(int type, String name);
-
-}
diff --git a/src/jdk15/org/testng/v6/Lists.java b/src/jdk15/org/testng/v6/Lists.java
deleted file mode 100644
index 85689a7..0000000
--- a/src/jdk15/org/testng/v6/Lists.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package org.testng.v6;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class Lists {
-
- public static <T> List<T> newArrayList() {
- return new ArrayList<T>();
- }
-}
diff --git a/src/jdk15/org/testng/v6/Maps.java b/src/jdk15/org/testng/v6/Maps.java
deleted file mode 100644
index 49423f5..0000000
--- a/src/jdk15/org/testng/v6/Maps.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package org.testng.v6;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class Maps {
-
- public static <K, V> Map<K, V> newHashMap() {
- return new HashMap<K, V>();
- }
-}
diff --git a/src/jdk15/org/testng/v6/Operation.java b/src/jdk15/org/testng/v6/Operation.java
deleted file mode 100644
index f6a601e..0000000
--- a/src/jdk15/org/testng/v6/Operation.java
+++ /dev/null
@@ -1,123 +0,0 @@
-package org.testng.v6;
-
-import org.testng.ITestNGMethod;
-import org.testng.xml.XmlTest;
-
-import java.util.List;
-
-public class Operation {
-
- private ITestNGMethod m_method;
- private Object m_object;
- private Object m_parameters;
- private int m_affinity;
- private List<RunGroup> m_runGroups = Lists.newArrayList();
- private IRunGroupFactory m_runGroupFactory;
- private Integer[] m_after = {};
- private XmlTest m_xmlTest;
-
- public Operation(ITestNGMethod method, IRunGroupFactory runGroupFactory, XmlTest xmlTest) {
- init(method, 0, runGroupFactory, xmlTest);
- }
-
- public Operation(ITestNGMethod method, int threadAffinity, IRunGroupFactory runGroupFactory,
- XmlTest xmlTest)
- {
- init(method, threadAffinity, runGroupFactory, xmlTest);
- }
-
- private void init(ITestNGMethod method, int affinity, IRunGroupFactory runGroupFactory,
- XmlTest xmlTest)
- {
- m_method = method;
- m_affinity = affinity;
- m_runGroupFactory = runGroupFactory;
- m_xmlTest = xmlTest;
-
- m_runGroups.add(m_runGroupFactory.getRunGroup(RunGroup.CLASS,
- method.getTestClass().getRealClass().getName()));
-
- m_runGroups.add(m_runGroupFactory.getRunGroup(RunGroup.XML_TEST, m_xmlTest.getName()));
-
- for (String group : method.getGroups()) {
- m_runGroups.add(m_runGroupFactory.getRunGroup(RunGroup.GROUP, group));
- }
- }
-
- public List<RunGroup> getRunGroups() {
- return m_runGroups;
- }
-
- public ITestNGMethod getMethod() {
- return m_method;
- }
-
- public String toString() {
- String padding;
- if (m_method.isBeforeClassConfiguration() || m_method.isAfterClassConfiguration()) {
- padding = " ";
- }
- else if (m_method.isBeforeGroupsConfiguration() || m_method.isAfterGroupsConfiguration()) {
- padding = " ";
- }
- else if (m_method.isBeforeMethodConfiguration() || m_method.isAfterMethodConfiguration()) {
- padding = " ";
- }
- else if (m_method.isBeforeSuiteConfiguration() || m_method.isAfterSuiteConfiguration()) {
- padding = "";
- }
- else {
- padding = " -- ";
- }
-
-// String p = "";
-// for (int i = 0; i < padding; i++) {
-// p += " ";
-// }
-
- String after = "";
- if (m_after.length > 0) {
- after = "after:";
- for (int i : m_after) {
- after += i + " ";
- }
- }
-
- String method = m_method.getTestClass().getName() + "." + m_method.getMethod().getName();
- String result = padding + "[" + method + " affinity:" + m_affinity
- + " groups:" + m_runGroups
- + after
- + "]";
-
- return result;
- }
-
- public int getAffinity() {
- return m_affinity;
- }
-
- public boolean mustRunAfter(Operation o) {
- List<RunGroup> runGroups = o.getRunGroups();
- for (int after : m_after) {
- for (RunGroup rg : runGroups) {
- if (rg.getId() == after) {
- System.out.println(this + " MUST RUN AFTER " + o);
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- * @return the array of RunGroups we must run after, or an empty array if not applicable.
- */
- public Integer[] getAfter() {
- return m_after;
- }
-
- public void setAfter(Integer[] after) {
- m_after = after;
- }
-
-}
diff --git a/src/jdk15/org/testng/v6/RunGroup.java b/src/jdk15/org/testng/v6/RunGroup.java
deleted file mode 100644
index 40ea392..0000000
--- a/src/jdk15/org/testng/v6/RunGroup.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package org.testng.v6;
-
-/**
- * Encapsulates a group that can have an after operation.
- */
-public class RunGroup {
- public final static int XML_TEST = 1;
- public final static int CLASS = 2;
- public final static int GROUP = 3;
-
- private int m_type;
- private String m_name;
- private int m_id = 0;
-
- public RunGroup(int type, String name, int id) {
- m_type = type;
- m_name = name;
- m_id = id;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == null) return false;
- if (obj == this) return true;
- try {
- RunGroup that = (RunGroup) obj;
- return that.getType() == getType() && that.getName().equals(getName());
- }
- catch(ClassCastException ex) {
- return false;
- }
- }
-
- @Override
- public int hashCode() {
- return m_name.hashCode() ^ m_type;
- }
-
- public int getType() {
- return m_type;
- }
-
- public void setType(int type) {
- m_type = type;
- }
-
- public String getName() {
- return m_name;
- }
-
- public void setName(String name) {
- m_name = name;
- }
-
- public int getId() {
- return m_id;
- }
-
- public void setId(int id) {
- m_id = id;
- }
-
- public String toString() {
- String type = "";
- if (m_type == CLASS) type = "class:";
- else if (m_type == XML_TEST) type = "<test>:";
- else if (m_type == GROUP) type = "group:";
-
-// return "(RunGroup:" + m_id + ")";
- return "(RunGroup:" + m_id + " " + type + "\"" + m_name
- + "\")";
- }
-
-}
diff --git a/src/jdk15/org/testng/v6/Sets.java b/src/jdk15/org/testng/v6/Sets.java
deleted file mode 100644
index 7d14855..0000000
--- a/src/jdk15/org/testng/v6/Sets.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.testng.v6;
-
-import java.util.HashSet;
-import java.util.Set;
-
-public class Sets {
-
- public static <T> Set<T> newHashSet() {
- return new HashSet<T>();
- }
-
-}
diff --git a/src/jdk15/org/testng/v6/SuitePlan.java b/src/jdk15/org/testng/v6/SuitePlan.java
deleted file mode 100644
index a9614f6..0000000
--- a/src/jdk15/org/testng/v6/SuitePlan.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.testng.v6;
-
-import java.util.Map;
-
-public class SuitePlan implements IRunGroupFactory {
- private Map<RunGroup, Integer> m_runGroups = Maps.newHashMap();
- private int m_currentGroupId = 1;
-
- public RunGroup getRunGroup(int type, String name) {
- RunGroup result = new RunGroup(type, name, m_currentGroupId);
- Integer id = m_runGroups.get(result);
- if (id == null) {
- m_runGroups.put(result, m_currentGroupId);
- m_currentGroupId++;
- }
- else {
- result.setId(id);
- }
- return result;
- }
-
- public Integer findRunGroup(int type, String name) {
- return m_runGroups.get(new RunGroup(type, name, 0));
- }
-
-}
diff --git a/src/jdk15/org/testng/v6/TestPlan.java b/src/jdk15/org/testng/v6/TestPlan.java
deleted file mode 100644
index 007012e..0000000
--- a/src/jdk15/org/testng/v6/TestPlan.java
+++ /dev/null
@@ -1,244 +0,0 @@
-package org.testng.v6;
-
-import org.testng.ClassMethodMap;
-import org.testng.ITestClass;
-import org.testng.ITestNGMethod;
-import org.testng.internal.ConfigurationGroupMethods;
-import org.testng.xml.XmlTest;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-public class TestPlan {
- ClassMethodMap m_classMethodMap;
- private Map<ITestClass, Set<Object>> m_beforeClassMethods;
- private Set<ITestClass> m_classesSeen = Sets.newHashSet();
- private Set<String> m_groupsSeen = Sets.newHashSet();
- private List<List<ITestNGMethod>> m_sequentialList;
- private List<ITestNGMethod> m_parallelList;
- private List<Operation> m_operations;
- private ConfigurationGroupMethods m_groupMethods;
- private XmlTest m_xmlTest;
- private IRunGroupFactory m_runGroupFactory;
- private ITestNGMethod[] m_beforeSuiteMethods;
- private ITestNGMethod[] m_afterSuiteMethods;
-
- public TestPlan(
- List<List<ITestNGMethod>> sequentialList,
- List<ITestNGMethod> parallelList, ClassMethodMap cmm,
- ITestNGMethod[] beforeSuiteMethods, ITestNGMethod[] afterSuiteMethods,
- ConfigurationGroupMethods groupMethods, XmlTest xmlTest)
- {
- m_sequentialList = sequentialList;
- m_parallelList = parallelList;
- m_groupMethods = groupMethods;
- m_xmlTest = xmlTest;
- m_beforeSuiteMethods = beforeSuiteMethods;
- m_afterSuiteMethods = afterSuiteMethods;
- m_sequentialList = sequentialList;
- m_parallelList = parallelList;
-
- m_classMethodMap = cmm;
- m_beforeClassMethods = cmm.getInvokedBeforeClassMethods();
- m_operations = Lists.newArrayList();
- }
-
- public void init(IRunGroupFactory runGroupFactory) {
- m_runGroupFactory = runGroupFactory;
- for (ITestNGMethod m : m_beforeSuiteMethods) {
- m_operations.add(createOperation(m, m_runGroupFactory));
- }
-
- int affinity = 1;
- for (List<ITestNGMethod> seq : m_sequentialList) {
- for (ITestNGMethod m : seq) {
- addTestOperation(createOperation(m, affinity, m_runGroupFactory));
- }
- affinity++;
- p(" ");
- }
-
- for (ITestNGMethod m : m_parallelList) {
- addTestOperation(createOperation(m, affinity, m_runGroupFactory));
- }
-
- addAfterClassAndGroupsMethods();
-
- for (ITestNGMethod m : m_afterSuiteMethods) {
- m_operations.add(createOperation(m, m_runGroupFactory));
- }
-
-// System.out.println("LIST OF GROUPS:");
-// for (RunGroup r : m_runGroups.keySet()) {
-// System.out.println(r.getName() + ":" + r.getId());
-// }
-
- for (Operation o : m_operations) {
- System.out.println(o);
- }
- System.out.println("");
- }
-
-
- private void addAfterClassAndGroupsMethods() {
- Set<Operation> afterOperations = Sets.newHashSet();
-
- for (ITestClass cl : m_classesSeen) {
- Integer id = m_runGroupFactory.findRunGroup(RunGroup.CLASS, cl.getName());
- for (ITestNGMethod m : cl.getAfterClassMethods()) {
- Operation o = createOperation(m, 0, m_runGroupFactory);
- o.setAfter(new Integer[] { id });
- afterOperations.add(o);
- }
- }
-
- Map<String, List<ITestNGMethod>> afterGroups = m_groupMethods.getAfterGroupsMethods();
- for (String group : m_groupsSeen) {
- List<ITestNGMethod> afterMethods = afterGroups.get(group);
- Integer id = m_runGroupFactory.findRunGroup(RunGroup.GROUP, group);
- if (afterMethods != null) {
- for (ITestNGMethod m : afterMethods) {
- Operation o = createOperation(m, 0, m_runGroupFactory);
- o.setAfter(new Integer[] { id });
- afterOperations.add(o);
- }
-
- }
- }
-
- addAfterOperations(afterOperations);
- }
-
- private void addAfterOperations(Set<Operation> afterOperations) {
- Set<Operation> toRemove = Sets.newHashSet();
- for (int i = m_operations.size() - 1; i >= 0; --i) {
- Operation o = m_operations.get(i);
- for (Operation afterOperation : afterOperations) {
- if (afterOperation.mustRunAfter(o)) {
- m_operations.add(i + 1, afterOperation);
- toRemove.add(afterOperation);
- }
- }
-
- for (Operation afterOperation : toRemove) {
- afterOperations.remove(afterOperation);
- }
-
- if (afterOperations.size() == 0) break;
- }
-// Operation o = m_operations.get(i);
-// List<RunGroup> runGroups = o.getRunGroups();
-// for (RunGroup rg : runGroups) {
-// List<Operation> operations = afterOperations.getOperationsThatMustRunAfter(rg.getId());
-// for (Operation operation : operations) {
-// m_operations.add(i + 1, operation);
-// }
-// }
-// }
- }
-
-// private void addAfterClassAndGroupsMethods() {
-// Set<ITestClass> classesSeen = Sets.newHashSet();
-// Set<String> groupsSeen = Sets.newHashSet();
-//
-// for (int i = m_operations.size() - 1; i >= 0; i--) {
-// Operation o = m_operations.get(i);
-// ITestNGMethod m = o.getMethod();
-//
-// ITestClass testClass = m.getTestClass();
-// if (! classesSeen.contains(testClass)) {
-// addMethods(testClass.getAfterClassMethods(), o.getAffinity(), i + 1);
-// classesSeen.add(testClass);
-// }
-//
-// String[] groups = m.getGroups();
-// for (String group : groups) {
-// Map<String, List<ITestNGMethod>> after = m_groupMethods.getAfterGroupsMap();
-// if (! groupsSeen.contains(group)) {
-// List<ITestNGMethod> methods = after.get(group);
-// addMethods(methods, o.getAffinity(), i + 1);
-// groupsSeen.add(group);
-// }
-// }
-// }
-// }
-
- /**
- * Add beforeMethod, method, afterMethod
- */
- private void addTestOperation(Operation o) {
- ITestNGMethod method = o.getMethod();
- ITestClass testClass = method.getTestClass();
- if (! m_classesSeen.contains(testClass)) {
- m_classesSeen.add(testClass);
- addMethods(testClass.getBeforeClassMethods(), o.getAffinity(),
- m_operations.size());
- }
-
- String[] groups = method.getGroups();
- for (String group : groups) {
- if (! m_groupsSeen.contains(group)) {
- List<ITestNGMethod> beforeMethods
- = m_groupMethods.getBeforeGroupsMap().get(group);
- if (beforeMethods != null) {
- ITestNGMethod[] beforeGroupMethods
- = beforeMethods.toArray(new ITestNGMethod[beforeMethods.size()]);
- addMethods(beforeGroupMethods,
- o.getAffinity(), m_operations.size());
- m_groupsSeen.add(group);
- }
- }
- }
-
- addMethods(testClass.getBeforeTestMethods(), o.getAffinity(),
- m_operations.size());
- m_operations.add(o);
- addMethods(testClass.getAfterTestMethods(), o.getAffinity(),
- m_operations.size());
- }
-
- private void addMethods(ITestNGMethod[] methods,
- int affinity, int index)
- {
- for (ITestNGMethod m : methods) {
- m_operations.add(index, createOperation(m, affinity, m_runGroupFactory));
- }
- }
-
-// private void addMethods(List<ITestNGMethod> methods,
-// int affinity, int index)
-// {
-// addMethods(methods.toArray(new ITestNGMethod[methods.size()]),
-// affinity, index);
-// }
-
-
-// private void addMethod(List<Operation> operations, ITestNGMethod m, int affinity) {
-// ITestNGMethod[] beforeMethods = m.getTestClass().getBeforeTestMethods();
-// for (ITestNGMethod bm : beforeMethods) {
-// operations.add(createOperation(bm, affinity));
-// }
-//
-// operations.add(createOperation(m, affinity));
-//
-// ITestNGMethod[] afterMethods = m.getTestClass().getAfterTestMethods();
-// for (ITestNGMethod am : afterMethods) {
-// operations.add(createOperation(am, affinity));
-// }
-// }
-
- private void p(String s) {
- System.out.println(s);
- }
-
- private Operation createOperation(ITestNGMethod m, int affinity, IRunGroupFactory factory) {
- Operation result = new Operation(m, factory, m_xmlTest);
- return result;
- }
-
- private Operation createOperation(ITestNGMethod m, IRunGroupFactory factory) {
- return createOperation(m, 0, factory);
- }
-
-}
diff --git a/test/src/test/v6/C.java b/test/src/test/v6/C.java
index ee86fdb..e116b7a 100644
--- a/test/src/test/v6/C.java
+++ b/test/src/test/v6/C.java
@@ -1,6 +1,8 @@
package test.v6;
+import org.testng.annotations.AfterSuite;
import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeSuite;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
@@ -14,4 +16,11 @@
@Test
public void fc1() {}
+
+ @BeforeSuite
+ public void beforeSuite() {}
+
+ @AfterSuite
+ public void afterSuite() {}
+
}