Switch to AspectJ plugin 'io.freefair.aspectj'
This commit updates the AspectJ configuration in:
* oev.nano.deployer.api
* oev.nano.deployer.hot
* Update oev.nano.deployer
* oev.repository
* oev.kernel.osgi
* oev.kernel.deployer
* oev.kernel.dmfragment
* oev.kernel.model
* oev.kernel.deployer.dm
* oev.kernel.userregionfactory
* oev.web.core
* oev.web.dm
* oev.web.tomcat.support
* oev.apps.repository.core
* oev.shell.command
Also reactivates HotDeployerTests and ExceptionCleanerTests.
diff --git a/apps/org.eclipse.virgo.apps.repository.core/build.gradle b/apps/org.eclipse.virgo.apps.repository.core/build.gradle
index 46932a1..5947f76 100644
--- a/apps/org.eclipse.virgo.apps.repository.core/build.gradle
+++ b/apps/org.eclipse.virgo.apps.repository.core/build.gradle
@@ -1,6 +1,6 @@
dependencies {
- aspectpath project(':medic:org.eclipse.virgo.medic')
- aspectpath project(':util:org.eclipse.virgo.util.jmx')
+ aspect project(':medic:org.eclipse.virgo.medic')
+ aspect project(':util:org.eclipse.virgo.util.jmx')
compile group: "org.eclipse.virgo.mirrored", name: "org.eclipse.osgi", version: equinoxVersion, configuration: "compile", ext: "jar"
@@ -8,9 +8,7 @@
implementation project(':util:org.eclipse.virgo.util.math')
implementation project(':util:org.eclipse.virgo.util.io')
- implementation project(':util:org.eclipse.virgo.util.jmx')
implementation project(':util:org.eclipse.virgo.util.osgi.manifest')
- implementation project(':medic:org.eclipse.virgo.medic')
implementation project(':repository:org.eclipse.virgo.repository')
implementation project(':kernel:org.eclipse.virgo.kernel.services')
diff --git a/build.gradle b/build.gradle
index 3328af8..3530c63 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,4 +1,3 @@
-import aspectj.AspectJPlugin
import virgobuild.Config
import virgobuild.VirgoToolsPlugin
@@ -13,6 +12,7 @@
plugins {
id "io.spring.dependency-management" version "1.0.7.RELEASE" apply false
+ id "io.freefair.aspectj" version "4.1.6" apply false
id "biz.aQute.bnd.builder" version "4.2.0" apply false
id "com.github.spotbugs" version "1.7.1" apply false
}
@@ -59,8 +59,6 @@
project(':util:org.eclipse.virgo.util.parser.launcher'),
project(':util:org.eclipse.virgo.util.parser.manifest'),
- project(':test:org.eclipse.virgo.test.launcher'),
-
project(':medic:org.eclipse.virgo.medic'),
project(':medic:org.eclipse.virgo.medic.core'),
project(':medic:org.eclipse.virgo.medic.logbackclassicfragment'),
@@ -85,9 +83,6 @@
project(':kernel:org.eclipse.virgo.kernel.artifact'),
project(':kernel:org.eclipse.virgo.kernel.deployer'),
- // a test bundle running inside an OSGi container
- project(':kernel:org.eclipse.virgo.kernel.deployer.test'),
-
// FIXME Equinox migration - rename to deployer.blueprint
project(':kernel:org.eclipse.virgo.kernel.deployer.dm'),
project(':kernel:org.eclipse.virgo.kernel.osgi'),
@@ -123,6 +118,7 @@
project(':web:org.eclipse.virgo.web.enterprise.security.openejb.classloading.hook'),
project(':web:org.eclipse.virgo.web.enterprise.security.valve'),
project(':web:org.eclipse.virgo.web.enterprise.services.accessor'),
+
project(':web:org.eclipse.virgo.web.servlet.adapter'),
project(':web:org.eclipse.virgo.web.spring.integration'),
project(':web:org.eclipse.virgo.web.war.deployer'),
@@ -138,22 +134,27 @@
// test-apps
project(':web:test-apps:osgi-webapp'),
- project(':web:test-apps:spring-capability-tests'), ]
+ project(':web:test-apps:spring-capability-tests'),
+ ]
+ // these projects contain aspects
aspectjProjects = [
- // these projects contain aspects
project(':util:org.eclipse.virgo.util.jmx'),
- project(':nano:org.eclipse.virgo.nano.core'),
-
project(':test:org.eclipse.virgo.test.stubs'),
+
project(':medic:org.eclipse.virgo.medic'),
- // these projects are woven
+ project(':nano:org.eclipse.virgo.nano.core'),
+ ]
+
+ // these projects are woven (contain MBeans, etc...)
+ wovenProjects = [
project(':nano:org.eclipse.virgo.nano.deployer.api'),
project(':nano:org.eclipse.virgo.nano.deployer.hot'),
+ project(':nano:org.eclipse.virgo.nano.deployer'),
- project(':repository:org.eclipse.virgo.repository'), // seems currently no pointcut matches :(
+ project(':repository:org.eclipse.virgo.repository'),
project(':kernel:org.eclipse.virgo.kernel.dmfragment'),
@@ -476,7 +477,11 @@
// }
//}
-configure(javaProjects + osgiProjects + packagingProjects + project(":org.eclipse.virgo.site") + project("3rd-party")) {
+configure(
+ javaProjects + osgiProjects + packagingProjects
+ + project(":org.eclipse.virgo.site")
+ + project("3rd-party")
+) {
apply plugin: "io.spring.dependency-management"
repositories {
@@ -674,50 +679,35 @@
}
configure(aspectjProjects) {
- configurations {
- ajtools {
- transitive = false
- description = "AspectJ tools runtime"
- }
+ apply plugin: "io.freefair.aspectj"
+
+ dependencies {
+ compile 'org.aspectj:aspectjrt'
}
- apply plugin: AspectJPlugin
+ sourceSets.main.aspectj.srcDir "src/main/java"
+ sourceSets.main.java.srcDirs = files()
- configurations.compile.dependencies.each { Dependency dep ->
- println dep.class
- if (dep.hasProperty("dependencyProject")) {
- println "Has property dependencyProject" + dep.class
- println "dependent project: ${dep}"
- iajcClasspath += ":" + dep.dependencyProject.buildDir + "/bundles/release/classes.jar"
- } else {
- println "other dependency: ${dep}"
- }
+ sourceSets.test.aspectj.srcDir "src/test/java"
+ sourceSets.test.java.srcDirs = files()
+
+ compileAspectj.ajcOptions.outxmlfile = "META-INF/aop.xml"
+
+ aspectj {
+ version = aspectjVersion
}
+}
- configurations {
- ajtools {
- transitive = false
- description = "AspectJ tools runtime"
- }
-
- aspectpath {
- transitive = false
- description = "Aspects are applied to types present in the project"
- }
-
- testAspectpath {
- transitive = false
- description = "Aspects are applied to tests present in the project"
- }
- }
+configure(wovenProjects) {
+ apply plugin: "io.freefair.aspectj.post-compile-weaving"
dependencies {
implementation 'org.aspectj:aspectjrt'
-
- ajtools 'org.aspectj:aspectjtools'
}
+}
- // Add nature and buildCommand
+// Add nature and buildCommand
+configure(aspectjProjects + wovenProjects) {
eclipse.project {
natures 'org.eclipse.ajdt.ui.ajnature'
buildCommand 'org.eclipse.ajdt.core.ajbuilder'
diff --git a/buildSrc/src/main/groovy/aspectj/AspectJPlugin.groovy b/buildSrc/src/main/groovy/aspectj/AspectJPlugin.groovy
deleted file mode 100644
index 2ba0695..0000000
--- a/buildSrc/src/main/groovy/aspectj/AspectJPlugin.groovy
+++ /dev/null
@@ -1,126 +0,0 @@
-package aspectj
-
-import org.gradle.api.Project
-import org.gradle.api.Plugin
-import org.gradle.api.tasks.TaskAction
-import org.gradle.api.logging.LogLevel
-import org.gradle.api.file.*
-import org.gradle.api.tasks.SourceSet
-import org.gradle.api.DefaultTask
-import org.gradle.api.GradleException
-
-import org.gradle.api.plugins.JavaPlugin
-import org.gradle.api.tasks.compile.JavaCompile
-import org.gradle.plugins.ide.eclipse.GenerateEclipseProject
-import org.gradle.plugins.ide.eclipse.GenerateEclipseClasspath
-import org.gradle.plugins.ide.eclipse.EclipsePlugin
-import org.gradle.plugins.ide.eclipse.model.BuildCommand
-import org.gradle.plugins.ide.eclipse.model.ProjectDependency
-
-/**
- * @see "https://github.com/spring-projects/spring-security/blob/master/buildSrc/src/main/groovy/aspectj/AspectJPlugin.groovy"
- * @author Luke Taylor
- */
-class AspectJPlugin implements Plugin<Project> {
-
- void apply(Project project) {
- project.plugins.apply(JavaPlugin)
-
- if (project.configurations.findByName('ajtools') == null) {
- project.configurations.create('ajtools')
- project.dependencies {
- ajtools "org.aspectj:aspectjtools"
- optional "org.aspectj:aspectjrt"
- }
- }
-
- if (project.configurations.findByName('aspectpath') == null) {
- project.configurations.create('aspectpath')
- }
-
- project.afterEvaluate {
- setupAspectJ(project)
- }
- }
-
- void setupAspectJ(Project project) {
- project.tasks.withType(JavaCompile) { javaCompileTask ->
- def javaCompileTaskName = javaCompileTask.name
- def ajCompileTask = project.tasks.create(name: javaCompileTaskName + 'Aspect', description: 'Compiles AspectJ Source', type: Ajc) {
- inputs.files(javaCompileTask.inputs.files)
- inputs.properties(javaCompileTask.inputs.properties.findAll {it.value != null})
-
- sourceRoots.addAll(project.sourceSets.main.java.srcDirs)
- if(javaCompileTaskName.contains("Test")) {
- sourceRoots.addAll(project.sourceSets.test.java.srcDirs)
- }
- compileClasspath = javaCompileTask.classpath
- destinationDir = javaCompileTask.destinationDir
- aspectPath = project.configurations.aspectpath
- }
-
- javaCompileTask.setActions Arrays.asList()
- javaCompileTask.dependsOn ajCompileTask
-
- }
-
- project.tasks.withType(GenerateEclipseProject) {
- project.eclipse.project.file.whenMerged { p ->
- p.natures.add(0, 'org.eclipse.ajdt.ui.ajnature')
- p.buildCommands = [new BuildCommand('org.eclipse.ajdt.core.ajbuilder')]
- }
- }
-
- project.tasks.withType(GenerateEclipseClasspath) {
- project.eclipse.classpath.file.whenMerged { classpath ->
- def entries = classpath.entries.findAll { it instanceof ProjectDependency}.findAll { entry ->
- def projectPath = entry.path.replaceAll('/','')
- project.rootProject.allprojects.find{ p->
- if(p.plugins.findPlugin(EclipsePlugin)) {
- return p.eclipse.project.name == projectPath && p.plugins.findPlugin(AspectJPlugin)
- }
- false
- }
- }
- entries.each { entry->
- entry.entryAttributes.put('org.eclipse.ajdt.aspectpath','org.eclipse.ajdt.aspectpath')
- }
- }
- }
- }
-}
-
-class Ajc extends DefaultTask {
- Set<File> sourceRoots = []
- FileCollection compileClasspath
- File destinationDir
- FileCollection aspectPath
-
- Ajc() {
- logging.captureStandardOutput(LogLevel.INFO)
- }
-
- @TaskAction
- def compile() {
- logger.info("="*30)
- logger.info("="*30)
- logger.info("Running ajc ...")
- logger.info("classpath: ${compileClasspath?.files}")
- logger.info("srcDirs ${sourceRoots}")
- ant.taskdef(resource: "org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties", classpath: project.configurations.ajtools.asPath)
- if(sourceRoots.empty) {
- return
- }
- ant.iajc(classpath: compileClasspath.asPath, fork: 'true', destDir: destinationDir.absolutePath,
- source: project.convention.plugins.java.sourceCompatibility,
- target: project.convention.plugins.java.targetCompatibility,
- aspectPath: aspectPath.asPath, sourceRootCopyFilter: '**/*.java', showWeaveInfo: 'true') {
- sourceroots {
- sourceRoots.each {
- logger.info(" sourceRoot $it")
- pathelement(location: it.absolutePath)
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/kernel/org.eclipse.virgo.kernel.deployer.dm/build.gradle b/kernel/org.eclipse.virgo.kernel.deployer.dm/build.gradle
index 18eaa8b..8d672a8 100644
--- a/kernel/org.eclipse.virgo.kernel.deployer.dm/build.gradle
+++ b/kernel/org.eclipse.virgo.kernel.deployer.dm/build.gradle
@@ -12,10 +12,6 @@
compile project(':kernel:org.eclipse.virgo.kernel.agent.dm')
compile project(':kernel:org.eclipse.virgo.kernel.deployer')
- compile project(':medic:org.eclipse.virgo.medic')
+ aspect project(':medic:org.eclipse.virgo.medic')
compile project(':nano:org.eclipse.virgo.nano.core')
-
- if (System.properties['weaving.enabled'] == 'true') {
- aspectpath project(':medic:org.eclipse.virgo.medic')
- }
}
diff --git a/kernel/org.eclipse.virgo.kernel.deployer/build.gradle b/kernel/org.eclipse.virgo.kernel.deployer/build.gradle
index 22bf143..a982ae9 100644
--- a/kernel/org.eclipse.virgo.kernel.deployer/build.gradle
+++ b/kernel/org.eclipse.virgo.kernel.deployer/build.gradle
@@ -27,9 +27,7 @@
compile project(':util:org.eclipse.virgo.util.osgi')
compile project(':util:org.eclipse.virgo.util.osgi.manifest')
- if (System.properties['weaving.enabled'] == 'true') {
- aspectpath project(':medic:org.eclipse.virgo.medic')
- aspectpath project(':nano:org.eclipse.virgo.nano.core')
- aspectpath project(':util:org.eclipse.virgo.util.jmx')
- }
+ aspect project(':medic:org.eclipse.virgo.medic')
+ aspect project(':nano:org.eclipse.virgo.nano.core')
+ aspect project(':util:org.eclipse.virgo.util.jmx')
}
diff --git a/kernel/org.eclipse.virgo.kernel.dmfragment/build.gradle b/kernel/org.eclipse.virgo.kernel.dmfragment/build.gradle
index e4025f1..0fe0000 100644
--- a/kernel/org.eclipse.virgo.kernel.dmfragment/build.gradle
+++ b/kernel/org.eclipse.virgo.kernel.dmfragment/build.gradle
@@ -8,10 +8,6 @@
compile project(':kernel:org.eclipse.virgo.kernel.agent.dm')
compile project(':kernel:org.eclipse.virgo.kernel.osgi')
compile project(':kernel:org.eclipse.virgo.kernel.deployer')
- compile project(':medic:org.eclipse.virgo.medic')
+ aspect project(':medic:org.eclipse.virgo.medic')
compile project(':nano:org.eclipse.virgo.nano.core')
-
- if (System.properties['weaving.enabled'] == 'true') {
- aspectpath project(':medic:org.eclipse.virgo.medic')
- }
}
diff --git a/kernel/org.eclipse.virgo.kernel.model/build.gradle b/kernel/org.eclipse.virgo.kernel.model/build.gradle
index 1c87c54..e3f3c94 100644
--- a/kernel/org.eclipse.virgo.kernel.model/build.gradle
+++ b/kernel/org.eclipse.virgo.kernel.model/build.gradle
@@ -11,14 +11,8 @@
compile project(':kernel:org.eclipse.virgo.kernel.osgi')
compile project(':kernel:org.eclipse.virgo.kernel.deployer')
- compile project(':medic:org.eclipse.virgo.medic')
- compile project(':nano:org.eclipse.virgo.nano.core')
+ aspect project(':medic:org.eclipse.virgo.medic')
+ aspect project(':nano:org.eclipse.virgo.nano.core')
compile project(':nano:org.eclipse.virgo.nano.deployer.api')
- compile project(':util:org.eclipse.virgo.util.jmx')
-
- aspectpath project(':nano:org.eclipse.virgo.nano.core')
- if (System.properties['weaving.enabled'] == 'true') {
- aspectpath project(':medic:org.eclipse.virgo.medic')
- aspectpath project(':util:org.eclipse.virgo.util.jmx')
- }
+ aspect project(':util:org.eclipse.virgo.util.jmx')
}
diff --git a/kernel/org.eclipse.virgo.kernel.osgi/build.gradle b/kernel/org.eclipse.virgo.kernel.osgi/build.gradle
index 174ec07..b33d65f 100644
--- a/kernel/org.eclipse.virgo.kernel.osgi/build.gradle
+++ b/kernel/org.eclipse.virgo.kernel.osgi/build.gradle
@@ -9,5 +9,5 @@
compile project(':nano:org.eclipse.virgo.nano.core')
compile project(':kernel:org.eclipse.virgo.kernel.artifact')
- aspectpath project(':nano:org.eclipse.virgo.nano.core')
+ aspect project(':nano:org.eclipse.virgo.nano.core')
}
diff --git a/kernel/org.eclipse.virgo.shell.command/build.gradle b/kernel/org.eclipse.virgo.shell.command/build.gradle
index 84824d4..54f148c 100644
--- a/kernel/org.eclipse.virgo.shell.command/build.gradle
+++ b/kernel/org.eclipse.virgo.shell.command/build.gradle
@@ -15,15 +15,11 @@
compile project(':kernel:org.eclipse.virgo.kernel.deployer')
compile project(':kernel:org.eclipse.virgo.kernel.model')
compile project(':kernel:org.eclipse.virgo.kernel.osgi')
- compile project(':medic:org.eclipse.virgo.medic')
+ aspect project(':medic:org.eclipse.virgo.medic')
compile project(':nano:org.eclipse.virgo.nano.deployer.api')
compile project(':repository:org.eclipse.virgo.repository')
compile project(':util:org.eclipse.virgo.util.common')
compile project(':util:org.eclipse.virgo.util.io')
compile project(':util:org.eclipse.virgo.util.osgi')
compile project(':util:org.eclipse.virgo.util.osgi.manifest')
-
- if (System.properties['weaving.enabled'] == 'true') {
- aspectpath project(':medic:org.eclipse.virgo.medic')
- }
}
diff --git a/nano/org.eclipse.virgo.nano.deployer.api/build.gradle b/nano/org.eclipse.virgo.nano.deployer.api/build.gradle
index c6192b8..0039c5d 100644
--- a/nano/org.eclipse.virgo.nano.deployer.api/build.gradle
+++ b/nano/org.eclipse.virgo.nano.deployer.api/build.gradle
@@ -4,4 +4,6 @@
implementation project(':util:org.eclipse.virgo.util.io')
implementation project(':medic:org.eclipse.virgo.medic')
implementation project(':nano:org.eclipse.virgo.nano.core')
+
+ aspect project(':nano:org.eclipse.virgo.nano.core')
}
diff --git a/nano/org.eclipse.virgo.nano.deployer.hot/build.gradle b/nano/org.eclipse.virgo.nano.deployer.hot/build.gradle
index 1534533..5cc82b2 100644
--- a/nano/org.eclipse.virgo.nano.deployer.hot/build.gradle
+++ b/nano/org.eclipse.virgo.nano.deployer.hot/build.gradle
@@ -3,7 +3,7 @@
implementation project(':util:org.eclipse.virgo.util.io')
implementation project(':medic:org.eclipse.virgo.medic')
- implementation project(':nano:org.eclipse.virgo.nano.core')
+ aspect project(':nano:org.eclipse.virgo.nano.core')
implementation project(':nano:org.eclipse.virgo.nano.deployer.api')
testImplementation project(':medic:org.eclipse.virgo.medic.test')
diff --git a/nano/org.eclipse.virgo.nano.deployer/build.gradle b/nano/org.eclipse.virgo.nano.deployer/build.gradle
index fd97950..8186c07 100644
--- a/nano/org.eclipse.virgo.nano.deployer/build.gradle
+++ b/nano/org.eclipse.virgo.nano.deployer/build.gradle
@@ -9,7 +9,7 @@
implementation project(':util:org.eclipse.virgo.util.osgi.manifest')
implementation project(':util:org.eclipse.virgo.util.parser.manifest')
implementation project(':medic:org.eclipse.virgo.medic')
- implementation project(':nano:org.eclipse.virgo.nano.core')
+ aspect project(':nano:org.eclipse.virgo.nano.core')
implementation project(':nano:org.eclipse.virgo.nano.deployer.api')
implementation project(':nano:org.eclipse.virgo.nano.deployer.hot')
diff --git a/nano/org.eclipse.virgo.nano.deployer/src/test/java/org/eclipse/virgo/nano/deployer/hot/integrationtest/HotDeployerTests.java b/nano/org.eclipse.virgo.nano.deployer/src/test/java/org/eclipse/virgo/nano/deployer/hot/integrationtest/HotDeployerTests.java
index 59fc464..58490bd 100644
--- a/nano/org.eclipse.virgo.nano.deployer/src/test/java/org/eclipse/virgo/nano/deployer/hot/integrationtest/HotDeployerTests.java
+++ b/nano/org.eclipse.virgo.nano.deployer/src/test/java/org/eclipse/virgo/nano/deployer/hot/integrationtest/HotDeployerTests.java
@@ -33,9 +33,6 @@
import org.junit.Ignore;
import org.junit.Test;
-/**
- */
-@Ignore
public class HotDeployerTests {
private static final PathReference PICKUP_DIR = new PathReference("build/pickup");
diff --git a/repository/org.eclipse.virgo.repository/build.gradle b/repository/org.eclipse.virgo.repository/build.gradle
index 4cd2bda..7706afb 100644
--- a/repository/org.eclipse.virgo.repository/build.gradle
+++ b/repository/org.eclipse.virgo.repository/build.gradle
@@ -3,7 +3,7 @@
dependencies {
compile group: "org.eclipse.virgo.mirrored", name: "org.eclipse.osgi", version: equinoxVersion, configuration: "compile", ext: "jar"
- implementation "org.apache.httpcomponents:httpclient:${httpclientVersion}"
+ implementation 'org.apache.httpcomponents:httpclient'
implementation project(':util:org.eclipse.virgo.util.common')
implementation project(':util:org.eclipse.virgo.util.io')
@@ -11,7 +11,7 @@
implementation project(':util:org.eclipse.virgo.util.math')
implementation project(':util:org.eclipse.virgo.util.osgi')
implementation project(':util:org.eclipse.virgo.util.osgi.manifest')
- implementation project(':medic:org.eclipse.virgo.medic')
+ aspect project(':medic:org.eclipse.virgo.medic')
testImplementation project(':medic:org.eclipse.virgo.medic.test')
testImplementation project(':test:org.eclipse.virgo.test.stubs')
diff --git a/settings.gradle b/settings.gradle
index 064edfe..a9dbc92 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -9,7 +9,7 @@
include ':util:org.eclipse.virgo.util.common'
include ':util:org.eclipse.virgo.util.env'
include ':util:org.eclipse.virgo.util.io'
-include ':util:org.eclipse.virgo.util.jmx'
+include ':util:org.eclipse.virgo.util.jmx' // contains AspectJ code
include ':util:org.eclipse.virgo.util.math'
include ':util:org.eclipse.virgo.util.osgi'
include ':util:org.eclipse.virgo.util.osgi.manifest'
@@ -72,7 +72,6 @@
include ':web:org.eclipse.virgo.web.core'
include ':web:org.eclipse.virgo.web.dm'
-include ':web:org.eclipse.virgo.web.enterprise.openejb.jpa.integration'
include ':web:org.eclipse.virgo.web.servlet.adapter'
include ':web:org.eclipse.virgo.web.spring.integration'
include ':web:org.eclipse.virgo.web.tomcat.support'
@@ -88,6 +87,7 @@
include ':web:org.eclipse.virgo.web.enterprise.openejb.fragment.jotm'
include ':web:org.eclipse.virgo.web.enterprise.openejb.fragment.jpa'
include ':web:org.eclipse.virgo.web.enterprise.openejb.initialiser'
+include ':web:org.eclipse.virgo.web.enterprise.openejb.jpa.integration'
include ':web:org.eclipse.virgo.web.enterprise.services.accessor'
include ':web:org.eclipse.virgo.web.enterprise.security'
include ':web:org.eclipse.virgo.web.enterprise.security.valve'
diff --git a/util/org.eclipse.virgo.util.jmx/src/main/java/org/eclipse/virgo/util/jmx/internal/EmptyClass.java b/util/org.eclipse.virgo.util.jmx/src/main/java/org/eclipse/virgo/util/jmx/internal/EmptyClass.java
deleted file mode 100644
index 1bb0a6d..0000000
--- a/util/org.eclipse.virgo.util.jmx/src/main/java/org/eclipse/virgo/util/jmx/internal/EmptyClass.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.eclipse.virgo.util.jmx.internal;
-
-public class EmptyClass {
-
-}
diff --git a/util/org.eclipse.virgo.util.jmx/src/test/java/org/eclipse/virgo/util/jmx/ExceptionCleanerMXBean.java b/util/org.eclipse.virgo.util.jmx/src/test/java/org/eclipse/virgo/util/jmx/ExceptionCleanerMXBean.java
index 5454d74..73ea33e 100644
--- a/util/org.eclipse.virgo.util.jmx/src/test/java/org/eclipse/virgo/util/jmx/ExceptionCleanerMXBean.java
+++ b/util/org.eclipse.virgo.util.jmx/src/test/java/org/eclipse/virgo/util/jmx/ExceptionCleanerMXBean.java
@@ -1,17 +1,21 @@
package org.eclipse.virgo.util.jmx;
-//FIXME Bug 463462 - Move back to test source folder when we know how to weave test classes
+import javax.management.MXBean;
+
+@MXBean
public class ExceptionCleanerMXBean implements JmxExceptionCleanerExtensionTestInterface {
private StackTraceElement[] steArray = null;
- public void unCaughtMethod() throws Exception {
+ @Override
+ public void unCaughtMethod() {
RuntimeException rte = new RuntimeException("unCaughtMethod", new Exception("test exception"));
this.steArray = rte.getStackTrace();
throw rte;
}
- public void caughtMethod() throws Exception {
+ @Override
+ public void caughtMethod() {
RuntimeException rte = new RuntimeException("caughtMethod", new Exception("test exception"));
this.steArray = rte.getStackTrace();
throw rte;
@@ -21,6 +25,7 @@
return this.steArray;
}
+ @Override
public void anotherCaughtMethod() {
RuntimeException rte = new RuntimeException("anotherCaughtMethod", new Exception("test exception"));
this.steArray = rte.getStackTrace();
diff --git a/util/org.eclipse.virgo.util.jmx/src/test/java/org/eclipse/virgo/util/jmx/ExceptionCleanerNoMXBean.java b/util/org.eclipse.virgo.util.jmx/src/test/java/org/eclipse/virgo/util/jmx/ExceptionCleanerNoMXBean.java
new file mode 100644
index 0000000..4360c65
--- /dev/null
+++ b/util/org.eclipse.virgo.util.jmx/src/test/java/org/eclipse/virgo/util/jmx/ExceptionCleanerNoMXBean.java
@@ -0,0 +1,32 @@
+package org.eclipse.virgo.util.jmx;
+
+public class ExceptionCleanerNoMXBean implements JmxExceptionCleanerExtensionTestInterface {
+
+ private StackTraceElement[] steArray = null;
+
+ @Override
+ public void unCaughtMethod() {
+ RuntimeException rte = new RuntimeException("unCaughtMethod", new Exception("test exception"));
+ this.steArray = rte.getStackTrace();
+ throw rte;
+ }
+
+ @Override
+ public void caughtMethod() {
+ RuntimeException rte = new RuntimeException("caughtMethod", new Exception("test exception"));
+ this.steArray = rte.getStackTrace();
+ throw rte;
+ }
+
+ public StackTraceElement[] getStackTrace() {
+ return this.steArray;
+ }
+
+ @Override
+ public void anotherCaughtMethod() {
+ RuntimeException rte = new RuntimeException("anotherCaughtMethod", new Exception("test exception"));
+ this.steArray = rte.getStackTrace();
+ throw rte;
+ }
+
+}
diff --git a/util/org.eclipse.virgo.util.jmx/src/test/java/org/eclipse/virgo/util/jmx/ExceptionCleanerTests.java b/util/org.eclipse.virgo.util.jmx/src/test/java/org/eclipse/virgo/util/jmx/ExceptionCleanerTests.java
index f44e8f7..7b31a19 100644
--- a/util/org.eclipse.virgo.util.jmx/src/test/java/org/eclipse/virgo/util/jmx/ExceptionCleanerTests.java
+++ b/util/org.eclipse.virgo.util.jmx/src/test/java/org/eclipse/virgo/util/jmx/ExceptionCleanerTests.java
@@ -11,61 +11,64 @@
package org.eclipse.virgo.util.jmx;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
/**
* Test the Jmx {@link ExceptionCleaner} aspect which prevents undeclared exceptions leaking from {@link javax.management.MXBean @MXBean} method calls.
- *
*/
public class ExceptionCleanerTests {
-// @Test
-// public void testCaughtMethod() throws Exception {
-// ExceptionCleanerMXBean testBean = new ExceptionCleanerMXBean();
-//
-// try {
-// testBean.caughtMethod();
-// assertTrue("Exception not thrown!", false);
-// } catch (Exception e) {
-// assertEquals("Does not throw a RuntimeException", RuntimeException.class, e.getClass());
-// assertNotNull("Cause is null", e.getCause());
-// assertEquals("Cause is not a RuntimeException", RuntimeException.class, e.getCause().getClass());
-// assertEquals("java.lang.Exception: test exception", e.getCause().getMessage());
-// assertEquals("Message not correctly generated.", "java.lang.RuntimeException: caughtMethod", e.getMessage());
-// assertArrayEquals("Stack trace not passed through.", e.getStackTrace(), testBean.getStackTrace());
-// }
-// }
-//
-// @Test
-// public void testAnotherCaughtMethod() throws Exception {
-// ExceptionCleanerMXBean testBean = new ExceptionCleanerMXBean();
-//
-// try {
-// testBean.anotherCaughtMethod();
-// assertTrue("Exception not thrown!", false);
-// } catch (Exception e) {
-// assertSame("Does not throw a RuntimeException", RuntimeException.class, e.getClass());
-// assertNotNull("Cause is null", e.getCause());
-// assertEquals("Cause is not a RuntimeException", RuntimeException.class, e.getCause().getClass());
-// assertEquals("java.lang.Exception: test exception", e.getCause().getMessage());
-// assertEquals("Message not correctly generated.", "java.lang.RuntimeException: anotherCaughtMethod", e.getMessage());
-// assertArrayEquals("Stack trace not passed through.", e.getStackTrace(), testBean.getStackTrace());
-// }
-// }
-//
-// @Test
-// public void testUncaughtMethod() throws Exception {
-// ExceptionCleanerMXBean testBean = new ExceptionCleanerMXBean();
-//
-// try {
-// testBean.unCaughtMethod();
-// assertTrue("Exception not thrown!", false);
-// } catch (Exception e) {
-// assertSame("Does not throw a RuntimeException", e.getClass(), RuntimeException.class);
-// assertNotNull("Cause is null.", e.getCause());
-// assertSame("Cause not correct type.", e.getCause().getClass(), Exception.class);
-// assertEquals("Message not correct.", "unCaughtMethod", e.getMessage());
-// assertArrayEquals("Stack trace not passed through.", e.getStackTrace(), testBean.getStackTrace());
-// }
-// }
+ @Test
+ public void testCaughtMethod() {
+ ExceptionCleanerMXBean testBean = new ExceptionCleanerMXBean();
+
+ try {
+ testBean.caughtMethod();
+ fail("Exception not thrown!");
+ } catch (Exception e) {
+ assertEquals("Does not throw a RuntimeException", RuntimeException.class, e.getClass());
+ assertNotNull("Cause is null", e.getCause());
+ assertEquals("Cause is not a RuntimeException", RuntimeException.class, e.getCause().getClass());
+ assertEquals("java.lang.Exception: test exception", e.getCause().getMessage());
+ assertEquals("Message not correctly generated.", "java.lang.RuntimeException: caughtMethod", e.getMessage());
+ assertArrayEquals("Stack trace not passed through.", e.getStackTrace(), testBean.getStackTrace());
+ }
+ }
+
+ @Test
+ public void testAnotherCaughtMethod() {
+ ExceptionCleanerMXBean testBean = new ExceptionCleanerMXBean();
+
+ try {
+ testBean.anotherCaughtMethod();
+ fail("Exception not thrown!");
+ } catch (Exception e) {
+ assertSame("Does not throw a RuntimeException", RuntimeException.class, e.getClass());
+ assertNotNull("Cause is null", e.getCause());
+ assertEquals("Cause is not a RuntimeException", RuntimeException.class, e.getCause().getClass());
+ assertEquals("java.lang.Exception: test exception", e.getCause().getMessage());
+ assertEquals("Message not correctly generated.", "java.lang.RuntimeException: anotherCaughtMethod", e.getMessage());
+ assertArrayEquals("Stack trace not passed through.", e.getStackTrace(), testBean.getStackTrace());
+ }
+ }
+
+ @Test
+ // Note: None type annotations (from interfaces) aren't inherited
+ public void testUncaughtMethod() {
+ ExceptionCleanerNoMXBean testBean = new ExceptionCleanerNoMXBean();
+
+ try {
+ testBean.unCaughtMethod();
+ fail("Exception not thrown!");
+ } catch (Exception e) {
+ assertSame("Does not throw a RuntimeException", e.getClass(), RuntimeException.class);
+ assertNotNull("Cause is null.", e.getCause());
+ assertSame("Cause not correct type.", e.getCause().getClass(), Exception.class);
+ assertEquals("Message not correct.", "unCaughtMethod", e.getMessage());
+ assertArrayEquals("Stack trace not passed through.", e.getStackTrace(), testBean.getStackTrace());
+ }
+ }
}
diff --git a/util/org.eclipse.virgo.util.jmx/src/test/java/org/eclipse/virgo/util/jmx/JmxExceptionCleanerExtensionTestInterface.java b/util/org.eclipse.virgo.util.jmx/src/test/java/org/eclipse/virgo/util/jmx/JmxExceptionCleanerExtensionTestInterface.java
index 20249ec..ce74540 100644
--- a/util/org.eclipse.virgo.util.jmx/src/test/java/org/eclipse/virgo/util/jmx/JmxExceptionCleanerExtensionTestInterface.java
+++ b/util/org.eclipse.virgo.util.jmx/src/test/java/org/eclipse/virgo/util/jmx/JmxExceptionCleanerExtensionTestInterface.java
@@ -13,15 +13,11 @@
import javax.management.MXBean;
-import org.eclipse.virgo.util.jmx.ExceptionCleaner;
-
/**
* This is an interface that extends a @{@link MXBean} annotated interface for testing the {@link ExceptionCleaner} aspect.
* <p />
- *
*/
-//FIXME Bug 463462 - Move back to test source folder when we know how to weave test classes
public interface JmxExceptionCleanerExtensionTestInterface extends JmxExceptionCleanerTestInterface {
- public void unCaughtMethod() throws Exception;
+ void unCaughtMethod() throws Exception;
}
diff --git a/util/org.eclipse.virgo.util.jmx/src/test/java/org/eclipse/virgo/util/jmx/JmxExceptionCleanerTestInterface.java b/util/org.eclipse.virgo.util.jmx/src/test/java/org/eclipse/virgo/util/jmx/JmxExceptionCleanerTestInterface.java
index 3135ec2..59fb23c 100644
--- a/util/org.eclipse.virgo.util.jmx/src/test/java/org/eclipse/virgo/util/jmx/JmxExceptionCleanerTestInterface.java
+++ b/util/org.eclipse.virgo.util.jmx/src/test/java/org/eclipse/virgo/util/jmx/JmxExceptionCleanerTestInterface.java
@@ -13,19 +13,16 @@
import javax.management.MXBean;
-import org.eclipse.virgo.util.jmx.ExceptionCleaner;
-
/**
* This is an annotated @{@link MXBean} interface for testing the {@link ExceptionCleaner} aspect.
* <p />
*
*/
@MXBean
-//FIXME Bug 463462 - Move back to test source folder when we know how to weave test classes
public interface JmxExceptionCleanerTestInterface {
- public void caughtMethod() throws Exception;
+ void caughtMethod() throws Exception;
- public void anotherCaughtMethod();
+ void anotherCaughtMethod();
}
diff --git a/web/org.eclipse.virgo.web.core/build.gradle b/web/org.eclipse.virgo.web.core/build.gradle
index fafb774..356a556 100644
--- a/web/org.eclipse.virgo.web.core/build.gradle
+++ b/web/org.eclipse.virgo.web.core/build.gradle
@@ -1,6 +1,6 @@
dependencies {
- aspectpath project(':medic:org.eclipse.virgo.medic')
- aspectpath project(':nano:org.eclipse.virgo.nano.core')
+ aspect project(':medic:org.eclipse.virgo.medic')
+ aspect project(':nano:org.eclipse.virgo.nano.core')
implementation 'javax.servlet:javax.servlet-api'
diff --git a/web/org.eclipse.virgo.web.dm/build.gradle b/web/org.eclipse.virgo.web.dm/build.gradle
index e4fbcf5..fc5c32b 100644
--- a/web/org.eclipse.virgo.web.dm/build.gradle
+++ b/web/org.eclipse.virgo.web.dm/build.gradle
@@ -1,6 +1,6 @@
dependencies {
- aspectpath project(':medic:org.eclipse.virgo.medic')
- aspectpath project(':nano:org.eclipse.virgo.nano.core')
+ aspect project(':medic:org.eclipse.virgo.medic')
+ aspect project(':nano:org.eclipse.virgo.nano.core')
compile group: "org.eclipse.virgo.mirrored", name: "org.eclipse.osgi", version: equinoxVersion, configuration: "compile", ext: "jar"
implementation 'javax.servlet:javax.servlet-api'
@@ -15,8 +15,5 @@
implementation 'org.springframework:spring-core'
implementation 'org.springframework:spring-web'
- implementation project(':medic:org.eclipse.virgo.medic')
- implementation project(':nano:org.eclipse.virgo.nano.core')
-
testImplementation 'org.springframework:spring-test'
}
diff --git a/web/org.eclipse.virgo.web.tomcat.support/build.gradle b/web/org.eclipse.virgo.web.tomcat.support/build.gradle
index 27d6fea..e90d218 100644
--- a/web/org.eclipse.virgo.web.tomcat.support/build.gradle
+++ b/web/org.eclipse.virgo.web.tomcat.support/build.gradle
@@ -1,6 +1,6 @@
dependencies {
- aspectpath project(':medic:org.eclipse.virgo.medic')
- aspectpath project(':nano:org.eclipse.virgo.nano.core')
+ aspect project(':medic:org.eclipse.virgo.medic')
+ aspect project(':nano:org.eclipse.virgo.nano.core')
compile group: "org.eclipse.virgo.mirrored", name: "org.eclipse.osgi", version: equinoxVersion, configuration: "compile", ext: "jar"
@@ -11,8 +11,6 @@
implementation group: "org.eclipse.gemini", name: "org.eclipse.gemini.web.tomcat", version: geminiWebVersion, configuration: "compile", ext: "jar"
implementation project(':kernel:org.eclipse.virgo.kernel.osgi')
- implementation project(':medic:org.eclipse.virgo.medic')
- implementation project(':nano:org.eclipse.virgo.nano.core')
implementation project(':util:org.eclipse.virgo.util.io')
implementation project(':util:org.eclipse.virgo.util.math')
implementation project(':web:org.eclipse.virgo.web.core')