Bug 406518 - migrate OT/Equinox to the standard OSGi WeavingHook
- test adjust. and new test for new validation (export aspect package)
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/OTEquinoxBuilderTests.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/OTEquinoxBuilderTests.java
index 7ccd59c..68825e9 100644
--- a/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/OTEquinoxBuilderTests.java
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/src/org/eclipse/objectteams/otdt/test/builder/OTEquinoxBuilderTests.java
@@ -368,6 +368,19 @@
 				});
 	}
 
+	public void testAspectExport () throws CoreException, IOException {
+		IJavaProject aeb= fileManager.setUpJavaProject("AspectExportBase"); 
+		env.addProject(aeb.getProject());
+		IJavaProject aea= fileManager.setUpJavaProject("AspectExportAspect"); 
+		aea.setOption("org.eclipse.objectteams.otdt.compiler.problem.binding_conventions", "error");
+		env.addProject(aea.getProject());
+		fullBuild();
+		expectingNoProblemsFor(aeb.getPath());
+		expectingOnlySpecificProblemsFor(aea.getPath(), 
+				new Problem[] {
+					getMissingAspectExportProblem(aea, "aea")});
+	}
+
 	// ---------------- HELPERS: ---------------------------
 	private Problem getDecapsulationProblem(IJavaProject project, String baseclassName, String teamPath, int start, int end) {
 		return new Problem("", "Decapsulating base class "+baseclassName+" by means of a forced export. Note, that additionally a corresponing declaration is needed in config.ini (OTJLD 2.1.2(c) + OT/Equinox).",
@@ -389,4 +402,10 @@
 						CategorizedProblem.CAT_RESTRICTION, IMarker.SEVERITY_ERROR)
 		);
 	}
+	private Problem getMissingAspectExportProblem(IJavaProject project, String packageName) {
+		return new Problem("", "Package "+packageName+" containing one or more bound teams must be exported.",
+				project.getPath().append(new Path("META-INF/MANIFEST.MF")), 
+				-1, -1,
+				-1, IMarker.SEVERITY_ERROR);
+	}
 }
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportAspect/.classpath b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportAspect/.classpath
new file mode 100644
index 0000000..9b7e6c5
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportAspect/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+	<classpathentry kind="con" path="OTRE"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportAspect/.project b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportAspect/.project
new file mode 100644
index 0000000..9f1f3c0
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportAspect/.project
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>AspectExportAspect</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.objectteams.otdt.builder.OTJBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.eclipse.objectteams.otdt.OTJavaNature</nature>
+	</natures>
+</projectDescription>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportAspect/.settings/org.eclipse.jdt.core.prefs b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportAspect/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..509e627
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportAspect/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,3 @@
+#Sat Nov 10 00:41:15 CET 2007
+eclipse.preferences.version=1
+org.eclipse.objectteams.otdt.compiler.problem.binding_conventions=error
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportAspect/META-INF/MANIFEST.MF b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportAspect/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..00c4eff
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportAspect/META-INF/MANIFEST.MF
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: AspectExportAspect Plug-in
+Bundle-SymbolicName: AspectExportAspect; singleton:=true
+Bundle-Version: 1.0.0
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.objectteams.otequinox,
+ AspectExportBase
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportAspect/build.properties b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportAspect/build.properties
new file mode 100644
index 0000000..2b0d95b
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportAspect/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+               META-INF/,\
+               .
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportAspect/plugin.xml b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportAspect/plugin.xml
new file mode 100644
index 0000000..b1fc5f3
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportAspect/plugin.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+   <extension
+         point="org.eclipse.ui.actionSets">
+      <actionSet
+            label="Sample Action Set"
+            visible="true"
+            id="Trac18a.actionSet">
+         <menu
+               label="Sample &amp;Menu"
+               id="sampleMenu">
+            <separator
+                  name="sampleGroup">
+            </separator>
+         </menu>
+         <action
+               label="&amp;Sample Action"
+               class="aea.actions.SampleAction"
+               tooltip="Hello, Eclipse world"
+               menubarPath="sampleMenu/sampleGroup"
+               toolbarPath="sampleGroup"
+               id="aea.actions.SampleAction">
+         </action>
+      </actionSet>
+   </extension>
+   <extension
+         point="org.eclipse.objectteams.otequinox.aspectBindings">
+      <aspectBinding
+            icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/calloutbinding_obj.gif">
+         <basePlugin
+               icon="platform:/plugin/org.eclipse.pde.ui/icons/obj16/plugin_obj.gif"
+               id="AspectExportBase">
+         </basePlugin>
+         <team
+               activation="ALL_THREADS"
+               class="aea.Team18"
+               icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif">
+         </team>
+      </aspectBinding>
+   </extension>
+
+</plugin>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportAspect/src/aea/Team18.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportAspect/src/aea/Team18.java
new file mode 100644
index 0000000..961dae3
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportAspect/src/aea/Team18.java
@@ -0,0 +1,16 @@
+/**
+ * 
+ */
+package aea;
+
+import base aeb.api.PublicBase;
+
+/**
+ * @author stephan
+ *
+ */
+public team class Team18 {
+	protected class RoleOfPublic playedBy PublicBase {
+		
+	}
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportAspect/src/aea/actions/SampleAction.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportAspect/src/aea/actions/SampleAction.java
new file mode 100644
index 0000000..200fdcf
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportAspect/src/aea/actions/SampleAction.java
@@ -0,0 +1,64 @@
+package aea.actions;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.jface.dialogs.MessageDialog;
+
+/**
+ * Our sample action implements workbench action delegate.
+ * The action proxy will be created by the workbench and
+ * shown in the UI. When the user tries to use the action,
+ * this delegate will be created and execution will be 
+ * delegated to it.
+ * @see IWorkbenchWindowActionDelegate
+ */
+public class SampleAction implements IWorkbenchWindowActionDelegate {
+	private IWorkbenchWindow window;
+	/**
+	 * The constructor.
+	 */
+	public SampleAction() {
+	}
+
+	/**
+	 * The action has been activated. The argument of the
+	 * method represents the 'real' action sitting
+	 * in the workbench UI.
+	 * @see IWorkbenchWindowActionDelegate#run
+	 */
+	public void run(IAction action) {
+		MessageDialog.openInformation(
+			window.getShell(),
+			"Trac18a Plug-in",
+			"Hello, Aspect world");
+	}
+
+	/**
+	 * Selection in the workbench has been changed. We 
+	 * can change the state of the 'real' action here
+	 * if we want, but this can only happen after 
+	 * the delegate has been created.
+	 * @see IWorkbenchWindowActionDelegate#selectionChanged
+	 */
+	public void selectionChanged(IAction action, ISelection selection) {
+	}
+
+	/**
+	 * We can use this method to dispose of any system
+	 * resources we previously allocated.
+	 * @see IWorkbenchWindowActionDelegate#dispose
+	 */
+	public void dispose() {
+	}
+
+	/**
+	 * We will cache window object in order to
+	 * be able to provide parent shell for the message dialog.
+	 * @see IWorkbenchWindowActionDelegate#init
+	 */
+	public void init(IWorkbenchWindow window) {
+		this.window = window;
+	}
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportBase/.classpath b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportBase/.classpath
new file mode 100644
index 0000000..304e861
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportBase/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportBase/.project b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportBase/.project
new file mode 100644
index 0000000..864c268
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportBase/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>AspectBindingExport</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportBase/META-INF/MANIFEST.MF b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportBase/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..39e732c
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportBase/META-INF/MANIFEST.MF
@@ -0,0 +1,9 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: AspectExportBase Plug-in
+Bundle-SymbolicName: AspectExportBase; singleton:=true
+Bundle-Version: 1.0.0
+Require-Bundle: org.eclipse.ui
+Export-Package: aeb.api
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportBase/build.properties b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportBase/build.properties
new file mode 100644
index 0000000..2b0d95b
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportBase/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+               META-INF/,\
+               .
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportBase/plugin.xml b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportBase/plugin.xml
new file mode 100644
index 0000000..c6697a6
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportBase/plugin.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+   <extension
+         point="org.eclipse.ui.actionSets">
+      <actionSet
+            label="Sample Action Set"
+            visible="true"
+            id="Trac18b.actionSet">
+         <menu
+               label="Sample &amp;Menu"
+               id="sampleMenu">
+            <separator
+                  name="sampleGroup">
+            </separator>
+         </menu>
+         <action
+               label="&amp;Sample Action"
+               class="aeb"
+               tooltip="Hello, Eclipse world"
+               menubarPath="sampleMenu/sampleGroup"
+               toolbarPath="sampleGroup"
+               id="aeb.actions.SampleAction">
+         </action>
+      </actionSet>
+   </extension>
+
+</plugin>
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportBase/src/aeb/actions/SampleAction.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportBase/src/aeb/actions/SampleAction.java
new file mode 100644
index 0000000..f44c5b6
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportBase/src/aeb/actions/SampleAction.java
@@ -0,0 +1,64 @@
+package aeb.actions;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.jface.dialogs.MessageDialog;
+
+/**
+ * Our sample action implements workbench action delegate.
+ * The action proxy will be created by the workbench and
+ * shown in the UI. When the user tries to use the action,
+ * this delegate will be created and execution will be 
+ * delegated to it.
+ * @see IWorkbenchWindowActionDelegate
+ */
+public class SampleAction implements IWorkbenchWindowActionDelegate {
+	private IWorkbenchWindow window;
+	/**
+	 * The constructor.
+	 */
+	public SampleAction() {
+	}
+
+	/**
+	 * The action has been activated. The argument of the
+	 * method represents the 'real' action sitting
+	 * in the workbench UI.
+	 * @see IWorkbenchWindowActionDelegate#run
+	 */
+	public void run(IAction action) {
+		MessageDialog.openInformation(
+			window.getShell(),
+			"Trac18b Plug-in",
+			"Hello, Eclipse world");
+	}
+
+	/**
+	 * Selection in the workbench has been changed. We 
+	 * can change the state of the 'real' action here
+	 * if we want, but this can only happen after 
+	 * the delegate has been created.
+	 * @see IWorkbenchWindowActionDelegate#selectionChanged
+	 */
+	public void selectionChanged(IAction action, ISelection selection) {
+	}
+
+	/**
+	 * We can use this method to dispose of any system
+	 * resources we previously allocated.
+	 * @see IWorkbenchWindowActionDelegate#dispose
+	 */
+	public void dispose() {
+	}
+
+	/**
+	 * We will cache window object in order to
+	 * be able to provide parent shell for the message dialog.
+	 * @see IWorkbenchWindowActionDelegate#init
+	 */
+	public void init(IWorkbenchWindow window) {
+		this.window = window;
+	}
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportBase/src/aeb/api/PublicBase.java b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportBase/src/aeb/api/PublicBase.java
new file mode 100644
index 0000000..85f278e
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/AspectExportBase/src/aeb/api/PublicBase.java
@@ -0,0 +1,5 @@
+package aeb.api;
+
+public class PublicBase {
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213a/META-INF/MANIFEST.MF b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213a/META-INF/MANIFEST.MF
index ac78220..02d517f 100644
--- a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213a/META-INF/MANIFEST.MF
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac213a/META-INF/MANIFEST.MF
@@ -10,3 +10,4 @@
  Trac213b2;bundle-version="1.0.0"
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: trac213a
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304ot/META-INF/MANIFEST.MF b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304ot/META-INF/MANIFEST.MF
index deb3ef3..93a32d2 100644
--- a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304ot/META-INF/MANIFEST.MF
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/Trac304ot/META-INF/MANIFEST.MF
@@ -10,3 +10,4 @@
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: J2SE-1.5
 Import-Package: trac304b
+Export-Package: trac304ot;ot-aspect-host=Trac304ot
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/UnresolvedBasePlugin/META-INF/MANIFEST.MF b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/UnresolvedBasePlugin/META-INF/MANIFEST.MF
index fcd8fbf..bbd6824 100644
--- a/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/UnresolvedBasePlugin/META-INF/MANIFEST.MF
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/workspace/UnresolvedBasePlugin/META-INF/MANIFEST.MF
@@ -7,3 +7,4 @@
  org.eclipse.objectteams.runtime
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: pack