You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2018/05/29 22:09:34 UTC

[isis] branch master updated: ISIS-1950: remove the codegen-javassist-test module and fix tests

This is an automated email from the ASF dual-hosted git repository.

ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git


The following commit(s) were added to refs/heads/master by this push:
     new dcb6577  ISIS-1950: remove the codegen-javassist-test module and fix tests
dcb6577 is described below

commit dcb6577b6324de2f9b306d4610a5bf68de05439c
Author: Andi Huber <ah...@apache.org>
AuthorDate: Wed May 30 00:09:30 2018 +0200

    ISIS-1950: remove the codegen-javassist-test module and fix tests
    
    Task-Url: https://issues.apache.org/jira/browse/ISIS-1950
---
 .../plugins-test/codegen-javassist-test/.gitignore |  1 -
 core/plugins-test/codegen-javassist-test/pom.xml   | 80 ----------------------
 core/pom.xml                                       |  1 -
 core/unittestsupport-test/pom.xml                  |  6 ++
 ...ServiceInstantiatorTestUsingCodegenPlugin.java} |  2 +-
 ...ava => ImposteriserTestUsingCodegenPlugin.java} | 66 +-----------------
 .../proxy/ProxyCreatorTestUsingCodegenPlugin.java} |  2 +-
 7 files changed, 10 insertions(+), 148 deletions(-)

diff --git a/core/plugins-test/codegen-javassist-test/.gitignore b/core/plugins-test/codegen-javassist-test/.gitignore
deleted file mode 100644
index a48e45b..0000000
--- a/core/plugins-test/codegen-javassist-test/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/target-ide
diff --git a/core/plugins-test/codegen-javassist-test/pom.xml b/core/plugins-test/codegen-javassist-test/pom.xml
deleted file mode 100644
index eecc45d..0000000
--- a/core/plugins-test/codegen-javassist-test/pom.xml
+++ /dev/null
@@ -1,80 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor 
-	license agreements. See the NOTICE file distributed with this work for additional 
-	information regarding copyright ownership. The ASF licenses this file to 
-	you under the Apache License, Version 2.0 (the "License"); you may not use 
-	this file except in compliance with the License. You may obtain a copy of 
-	the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
-	by applicable law or agreed to in writing, software distributed under the 
-	License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
-	OF ANY KIND, either express or implied. See the License for the specific 
-	language governing permissions and limitations under the License. -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-	<modelVersion>4.0.0</modelVersion>
-
-	<parent>
-		<groupId>org.apache.isis.core</groupId>
-		<artifactId>isis</artifactId>
-		<version>${revision}</version>
-		<relativePath>../../pom.xml</relativePath>
-	</parent>
-
-	<artifactId>isis-core-plugins-codegen-javassist-test</artifactId>
-
-	<name>Tests for Apache Isis Plugin for Code Generation (Javassist)</name>
-	<description>
-        To break cyclic dependencies some tests needed to be moved to their own module (this).
-    </description>
-
-	<properties>
-		<jar-plugin.automaticModuleName>org.apache.isis.plugins.codegen-javassist-test</jar-plugin.automaticModuleName>
-		<git-plugin.propertiesDir>org/apache/isis/plugins/codegen-javassist-test</git-plugin.propertiesDir>
-	</properties>
-
-	<build>
-		<resources>
-			<resource>
-				<filtering>false</filtering>
-				<directory>src/main/resources</directory>
-			</resource>
-			<resource>
-				<filtering>false</filtering>
-				<directory>src/main/java</directory>
-				<includes>
-					<include>**</include>
-				</includes>
-				<excludes>
-					<exclude>**/*.java</exclude>
-				</excludes>
-			</resource>
-		</resources>
-	</build>
-
-	<dependencies>
-	
-		
-		<!-- TEST -->
-		
-		<dependency>
-			<groupId>org.apache.isis.core</groupId>
-			<artifactId>isis-core-plugins-codegen-javassist</artifactId>
-			<scope>test</scope>
-		</dependency>
-		
-		<dependency>
-			<groupId>org.apache.isis.core</groupId>
-			<artifactId>isis-core-wrapper</artifactId>
-			<scope>test</scope>
-		</dependency>
-
-		<dependency>
-			<groupId>org.apache.isis.core</groupId>
-			<artifactId>isis-core-unittestsupport</artifactId>
-			<scope>test</scope>
-		</dependency>
-
-	</dependencies>
-
-
-</project>
\ No newline at end of file
diff --git a/core/pom.xml b/core/pom.xml
index fb34e65..4926a93 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -2433,7 +2433,6 @@ ${license.additional-notes}
 
 		<!-- to break cyclic dependencies some tests needed to be moved to their own modules -->
 		<module>unittestsupport-test</module>
-        <module>plugins-test/codegen-javassist-test</module>
         
     </modules>
 
diff --git a/core/unittestsupport-test/pom.xml b/core/unittestsupport-test/pom.xml
index 58d6452..f05a9cd 100644
--- a/core/unittestsupport-test/pom.xml
+++ b/core/unittestsupport-test/pom.xml
@@ -47,6 +47,12 @@
             <scope>test</scope>
         </dependency>
         
+        <dependency>
+			<groupId>org.apache.isis.core</groupId>
+			<artifactId>isis-core-wrapper</artifactId>
+			<scope>test</scope>
+		</dependency>
+        
         <!-- core plugins required to run this module's own tests -->
         <dependency>
             <groupId>org.apache.isis.core</groupId>
diff --git a/core/plugins-test/codegen-javassist-test/src/test/java/org/apache/isis/core/runtime/services/ServiceInstantiatorTestUsingJavassist.java b/core/unittestsupport-test/src/test/java/org/apache/isis/core/runtime/services/ServiceInstantiatorTestUsingCodegenPlugin.java
similarity index 99%
rename from core/plugins-test/codegen-javassist-test/src/test/java/org/apache/isis/core/runtime/services/ServiceInstantiatorTestUsingJavassist.java
rename to core/unittestsupport-test/src/test/java/org/apache/isis/core/runtime/services/ServiceInstantiatorTestUsingCodegenPlugin.java
index 0b6a6f3..162ccb1 100644
--- a/core/plugins-test/codegen-javassist-test/src/test/java/org/apache/isis/core/runtime/services/ServiceInstantiatorTestUsingJavassist.java
+++ b/core/unittestsupport-test/src/test/java/org/apache/isis/core/runtime/services/ServiceInstantiatorTestUsingCodegenPlugin.java
@@ -44,7 +44,7 @@ import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertThat;
 
-public class ServiceInstantiatorTestUsingJavassist {
+public class ServiceInstantiatorTestUsingCodegenPlugin {
 
 	@Rule
 	public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(JUnitRuleMockery2.Mode.INTERFACES_AND_CLASSES);
diff --git a/core/unittestsupport-test/src/test/java/org/apache/isis/core/unittestsupport/jmocking/DefaultImposteriserTest.java b/core/unittestsupport-test/src/test/java/org/apache/isis/core/unittestsupport/jmocking/ImposteriserTestUsingCodegenPlugin.java
similarity index 78%
rename from core/unittestsupport-test/src/test/java/org/apache/isis/core/unittestsupport/jmocking/DefaultImposteriserTest.java
rename to core/unittestsupport-test/src/test/java/org/apache/isis/core/unittestsupport/jmocking/ImposteriserTestUsingCodegenPlugin.java
index a4cc0ae..afe0496 100644
--- a/core/unittestsupport-test/src/test/java/org/apache/isis/core/unittestsupport/jmocking/DefaultImposteriserTest.java
+++ b/core/unittestsupport-test/src/test/java/org/apache/isis/core/unittestsupport/jmocking/ImposteriserTestUsingCodegenPlugin.java
@@ -18,7 +18,6 @@
  */
 package org.apache.isis.core.unittestsupport.jmocking;
 
-import static org.apache.isis.commons.internal.functions._Functions.uncheckedFunction;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
@@ -31,15 +30,9 @@ import java.lang.reflect.Method;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLClassLoader;
-import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Date;
-import java.util.concurrent.atomic.AtomicReference;
-import java.util.stream.Stream;
 
-import org.apache.isis.commons.internal.base._Strings;
 import org.apache.isis.commons.internal.context._Context;
-import org.apache.isis.commons.internal.context._Plugin;
 import org.apache.isis.core.plugins.codegen.ProxyFactoryPlugin;
 import org.jmock.api.Imposteriser;
 import org.jmock.api.Invocation;
@@ -50,7 +43,7 @@ import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
-public class DefaultImposteriserTest {
+public class ImposteriserTestUsingCodegenPlugin {
 
     private Imposteriser imposteriser = Imposterisers.getDefault();
 
@@ -63,28 +56,10 @@ public class DefaultImposteriserTest {
         invokable = new Invokable() {
             @Override
             public Object invoke(Invocation invocation) throws Throwable {
-                DefaultImposteriserTest.this.invocation = invocation;
+                ImposteriserTestUsingCodegenPlugin.this.invocation = invocation;
                 return "result";
             }
         };
-
-        // -- loading codegen plugin by name (because not configured as a maven dependency) 
-//        {
-//        	String pluginFullyQualifiedClassName = "org.apache.isis.core.plugins.codegen.ProxyFactoryPluginUsingJavassist";
-//        	// we are guessing where to find the pluginTarget
-//        	File pluginTarget = getCoreTargetFolder("/core/plugins/codegen-javassist/");
-//        	
-//    		_Plugin.load(ProxyFactoryPlugin.class, pluginTarget, pluginFullyQualifiedClassName);
-//        }
-        
-        {
-        	// we are guessing where to find the pluginTarget
-    		_Plugin.load(ProxyFactoryPlugin.class,
-    				getCoreTargetFolder("/core/plugins/codegen-bytebuddy/"), 
-    				"org.apache.isis.core.plugins.codegen.ProxyFactoryPluginUsingByteBuddy");
-        }
-        
-
     }
 
     @After
@@ -350,42 +325,5 @@ public class DefaultImposteriserTest {
         Object imposter = imposteriser.imposterise(failIfInvokedAction, Object.class);
         invokeMethod(imposter, Object.class.getDeclaredMethod("finalize"));
     }
-    
-    // -- HELPER
-    
-	/**
-	 * TODO will break with java 9+
-	 * @param relativeLocation 
-	 * @return file-system path, where the frameworks core classes reside (after a build).
-	 */
-	private static File getCoreTargetFolder(String relativeLocation) {
-		
-		//if run with surefire, URL look like ...
-		//file:/home/hobrom/isis/isis-master/core/unittestsupport/target/surefire/surefirebooter7883344605325794375.jar
-		
-		final AtomicReference<String> binaries = new AtomicReference<>("target");
-		
-		return Stream.of(((URLClassLoader )_Plugin.class.getClassLoader()).getURLs())
-//		.peek(u->System.out.println("searching unittestsupport: "+u.toString()))
-		.filter(url->url.toString().contains("/core/unittestsupport/"))
-		.map(uncheckedFunction(URL::toURI, RuntimeException::new))
-		.map(Paths::get)
-		.map(Path::toFile)
-		.map(uncheckedFunction(File::getCanonicalPath, RuntimeException::new))
-		.map(s->s.replace('\\', '/'))
-		.peek(s->{
-			_Strings.splitThenStream(s.substring(s.indexOf("/core/unittestsupport/")), "/")
-			.skip(3)
-			.findFirst()
-			.ifPresent(t->binaries.set(t));	
-//			System.out.println("binaries ("+s+"): "+binaries.get());
-		})
-		.map(s->s.substring(0, s.indexOf("/core/unittestsupport/")))
-		.map(s->new File(s, relativeLocation + "/" + binaries.get() + "/classes"))
-		.findFirst()
-		.orElseThrow(()->new RuntimeException("Failed to find file-system path, where the frameworks core classes reside."))
-		;
-	}
-    
 
 }
\ No newline at end of file
diff --git a/core/plugins-test/codegen-javassist-test/src/test/java/org/apache/isis/core/wrapper/proxy/ProxyCreatorTestUsingJavassist.java b/core/unittestsupport-test/src/test/java/org/apache/isis/core/wrapper/proxy/ProxyCreatorTestUsingCodegenPlugin.java
similarity index 98%
rename from core/plugins-test/codegen-javassist-test/src/test/java/org/apache/isis/core/wrapper/proxy/ProxyCreatorTestUsingJavassist.java
rename to core/unittestsupport-test/src/test/java/org/apache/isis/core/wrapper/proxy/ProxyCreatorTestUsingCodegenPlugin.java
index d5fdba4..91e3dfb 100644
--- a/core/plugins-test/codegen-javassist-test/src/test/java/org/apache/isis/core/wrapper/proxy/ProxyCreatorTestUsingJavassist.java
+++ b/core/unittestsupport-test/src/test/java/org/apache/isis/core/wrapper/proxy/ProxyCreatorTestUsingCodegenPlugin.java
@@ -28,7 +28,7 @@ import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
-public class ProxyCreatorTestUsingJavassist {
+public class ProxyCreatorTestUsingCodegenPlugin {
 	
 	private ProxyCreator proxyCreator;
 

-- 
To stop receiving notification emails like this one, please contact
ahuber@apache.org.