aboutsummaryrefslogtreecommitdiffstats
path: root/dcevm/src/main/java/com
diff options
context:
space:
mode:
authorIvan Dubrov <idubrov@guidewire.com>2014-04-25 14:15:01 -0700
committerIvan Dubrov <idubrov@guidewire.com>2014-04-25 14:16:33 -0700
commit597ce0d6ae31ce14a5cb635e907f8428250ab58b (patch)
tree56716c4c34250bed0d32320148ec9ca20e5da884 /dcevm/src/main/java/com
parentaf98d8dd7024b07a21169932f486d15596edf613 (diff)
downloaddcevm-597ce0d6ae31ce14a5cb635e907f8428250ab58b.tar.gz
dcevm-597ce0d6ae31ce14a5cb635e907f8428250ab58b.zip
Adding 'full' tests
* Killing test suites (you can run tests by package) * Introduced categories to run certain tests only on 'light'/'full'
Diffstat (limited to 'dcevm/src/main/java/com')
-rw-r--r--dcevm/src/main/java/com/github/dcevm/FieldRedefinitionPolicy.java37
-rw-r--r--dcevm/src/main/java/com/github/dcevm/MethodRedefinitionPolicy.java38
-rw-r--r--dcevm/src/main/java/com/github/dcevm/RedefinitionPolicy.java36
-rw-r--r--dcevm/src/main/java/com/github/dcevm/TestClassAdapter.java42
4 files changed, 149 insertions, 4 deletions
diff --git a/dcevm/src/main/java/com/github/dcevm/FieldRedefinitionPolicy.java b/dcevm/src/main/java/com/github/dcevm/FieldRedefinitionPolicy.java
new file mode 100644
index 00000000..cf3733c9
--- /dev/null
+++ b/dcevm/src/main/java/com/github/dcevm/FieldRedefinitionPolicy.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+package com.github.dcevm;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ *
+ * @author Thomas Wuerthinger
+ */
+@Retention(RetentionPolicy.CLASS)
+public @interface FieldRedefinitionPolicy {
+
+ RedefinitionPolicy value();
+}
diff --git a/dcevm/src/main/java/com/github/dcevm/MethodRedefinitionPolicy.java b/dcevm/src/main/java/com/github/dcevm/MethodRedefinitionPolicy.java
new file mode 100644
index 00000000..01d17c22
--- /dev/null
+++ b/dcevm/src/main/java/com/github/dcevm/MethodRedefinitionPolicy.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package com.github.dcevm;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ *
+ * @author Thomas Wuerthinger
+ */
+@Retention(RetentionPolicy.CLASS)
+public @interface MethodRedefinitionPolicy {
+ RedefinitionPolicy value();
+
+}
diff --git a/dcevm/src/main/java/com/github/dcevm/RedefinitionPolicy.java b/dcevm/src/main/java/com/github/dcevm/RedefinitionPolicy.java
new file mode 100644
index 00000000..f56ba80a
--- /dev/null
+++ b/dcevm/src/main/java/com/github/dcevm/RedefinitionPolicy.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package com.github.dcevm;
+
+/**
+ *
+ * @author Thomas Wuerthinger
+ */
+public enum RedefinitionPolicy {
+ StaticCheck,
+ DynamicCheck,
+ AccessDeletedMembers,
+ AccessOldMembers
+}
diff --git a/dcevm/src/main/java/com/github/dcevm/TestClassAdapter.java b/dcevm/src/main/java/com/github/dcevm/TestClassAdapter.java
index aadf1b22..dfde5e52 100644
--- a/dcevm/src/main/java/com/github/dcevm/TestClassAdapter.java
+++ b/dcevm/src/main/java/com/github/dcevm/TestClassAdapter.java
@@ -23,9 +23,9 @@
*/
package com.github.dcevm;
-import org.objectweb.asm.ClassVisitor;
-import org.objectweb.asm.MethodVisitor;
+import org.objectweb.asm.*;
import org.objectweb.asm.commons.Remapper;
+import org.objectweb.asm.commons.RemappingAnnotationAdapter;
import org.objectweb.asm.commons.RemappingClassAdapter;
import org.objectweb.asm.commons.RemappingMethodAdapter;
@@ -79,8 +79,7 @@ public class TestClassAdapter extends RemappingClassAdapter {
protected MethodVisitor createRemappingMethodAdapter(
int access,
String newDesc,
- MethodVisitor mv)
- {
+ MethodVisitor mv) {
return new RemappingMethodAdapter(access, newDesc, mv, remapper) {
@Override
public void visitMethodInsn(int opcode, String owner, String name, String desc) {
@@ -97,5 +96,40 @@ public class TestClassAdapter extends RemappingClassAdapter {
int pos = name.indexOf(METHOD_SUFFIX);
return (pos != -1) ? name.substring(0, pos) : name;
}
+
+ @Override
+ public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) {
+ AnnotationVisitor av = super.visitAnnotation(remapper.mapDesc(desc), visible);
+ return av == null ? null : new RemappingAnnotationAdapter(av, remapper) {
+ @Override
+ public void visitEnum(String name, String enumDesc, String value) {
+ if (Type.getType(enumDesc).getClassName().equals(RedefinitionPolicy.class.getName())) {
+ RedefinitionPolicy valueAsEnum = RedefinitionPolicy.valueOf(value);
+ if (Type.getType(desc).getClassName().equals(FieldRedefinitionPolicy.class.getName())) {
+ cv.visitAttribute(new SingleByteAttribute(FieldRedefinitionPolicy.class.getSimpleName(), (byte) valueAsEnum.ordinal()));
+ }
+ if (Type.getType(desc).getClassName().equals(MethodRedefinitionPolicy.class.getName())) {
+ cv.visitAttribute(new SingleByteAttribute(MethodRedefinitionPolicy.class.getSimpleName(), (byte) valueAsEnum.ordinal()));
+ }
+ }
+ super.visitEnum(name, desc, value);
+ }
+ };
+ }
+
+ private static class SingleByteAttribute extends Attribute {
+ private byte value;
+
+ public SingleByteAttribute(String name, byte value) {
+ super(name);
+ this.value = value;
+ }
+
+ @Override
+ protected ByteVector write(ClassWriter writer, byte[] code, int len, int maxStack, int maxLocals) {
+ return new ByteVector().putByte(value);
+ }
+ }
+
}