aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/AndOrNotTestCase.java5
-rw-r--r--org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/ConstantPoolSimulator.java35
-rw-r--r--org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/DeclareErrorOrWarningTestCase.java5
-rw-r--r--org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/ModifiersPatternTestCase.java9
-rw-r--r--org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/NamePatternTestCase.java5
-rw-r--r--org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/SignaturePatternMatchSpeedTestCase.java5
-rw-r--r--org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/SignaturePatternTestCase.java6
-rw-r--r--org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/TypePatternListTestCase.java5
-rw-r--r--org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/TypePatternTestCase.java5
-rw-r--r--org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/WithinTestCase.java6
10 files changed, 66 insertions, 20 deletions
diff --git a/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/AndOrNotTestCase.java b/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/AndOrNotTestCase.java
index 44d8d2b04..909db8e6a 100644
--- a/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/AndOrNotTestCase.java
+++ b/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/AndOrNotTestCase.java
@@ -81,12 +81,13 @@ public class AndOrNotTestCase extends PatternsTestCase {
private void checkSerialization(String string) throws IOException {
Pointcut p = makePointcut(string);
ByteArrayOutputStream bo = new ByteArrayOutputStream();
- CompressingDataOutputStream out = new CompressingDataOutputStream(bo);
+ ConstantPoolSimulator cps = new ConstantPoolSimulator();
+ CompressingDataOutputStream out = new CompressingDataOutputStream(bo, cps);
p.write(out);
out.close();
ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
- VersionedDataInputStream in = new VersionedDataInputStream(bi);
+ VersionedDataInputStream in = new VersionedDataInputStream(bi, cps);
Pointcut newP = Pointcut.read(in, null);
assertEquals("write/read", p, newP);
diff --git a/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/ConstantPoolSimulator.java b/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/ConstantPoolSimulator.java
new file mode 100644
index 000000000..57f971665
--- /dev/null
+++ b/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/ConstantPoolSimulator.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andy Clement (SpringSource) - initial implementation
+ *******************************************************************************/
+package org.aspectj.weaver.patterns;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.aspectj.weaver.ConstantPoolReader;
+import org.aspectj.weaver.ConstantPoolWriter;
+
+public class ConstantPoolSimulator implements ConstantPoolWriter, ConstantPoolReader {
+ List<String> list = new ArrayList<String>();
+
+ public int writeUtf8(String string) {
+ int i = list.indexOf(string);
+ if (i != -1) {
+ return i;
+ }
+ list.add(string);
+ return list.indexOf(string);
+ }
+
+ public String readUtf8(int constantPoolIndex) {
+ return list.get(constantPoolIndex);
+ }
+
+} \ No newline at end of file
diff --git a/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/DeclareErrorOrWarningTestCase.java b/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/DeclareErrorOrWarningTestCase.java
index 444db0c75..ab5f6e6f2 100644
--- a/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/DeclareErrorOrWarningTestCase.java
+++ b/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/DeclareErrorOrWarningTestCase.java
@@ -50,12 +50,13 @@ public class DeclareErrorOrWarningTestCase extends TestCase {
private void checkSerialization(Declare declare) throws IOException {
ByteArrayOutputStream bo = new ByteArrayOutputStream();
- CompressingDataOutputStream out = new CompressingDataOutputStream(bo);
+ ConstantPoolSimulator cps = new ConstantPoolSimulator();
+ CompressingDataOutputStream out = new CompressingDataOutputStream(bo, cps);
declare.write(out);
out.close();
ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
- VersionedDataInputStream in = new VersionedDataInputStream(bi);
+ VersionedDataInputStream in = new VersionedDataInputStream(bi, cps);
Declare newDeclare = Declare.read(in, null);
assertEquals("write/read", declare, newDeclare);
diff --git a/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/ModifiersPatternTestCase.java b/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/ModifiersPatternTestCase.java
index a82626336..fa561149e 100644
--- a/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/ModifiersPatternTestCase.java
+++ b/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/ModifiersPatternTestCase.java
@@ -16,8 +16,12 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.List;
import org.aspectj.weaver.CompressingDataOutputStream;
+import org.aspectj.weaver.ConstantPoolReader;
+import org.aspectj.weaver.ConstantPoolWriter;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.World;
import org.aspectj.weaver.reflect.ReflectionWorld;
@@ -91,12 +95,13 @@ public class ModifiersPatternTestCase extends PatternsTestCase {
private void checkSerialization(String string) throws IOException {
ModifiersPattern p = makeModifiersPattern(string);
ByteArrayOutputStream bo = new ByteArrayOutputStream();
- CompressingDataOutputStream out = new CompressingDataOutputStream(bo);
+ ConstantPoolSimulator cps = new ConstantPoolSimulator();
+ CompressingDataOutputStream out = new CompressingDataOutputStream(bo, cps);
p.write(out);
out.close();
ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
- VersionedDataInputStream in = new VersionedDataInputStream(bi);
+ VersionedDataInputStream in = new VersionedDataInputStream(bi, cps);
ModifiersPattern newP = ModifiersPattern.read(in);
assertEquals("write/read", p, newP);
diff --git a/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/NamePatternTestCase.java b/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/NamePatternTestCase.java
index 41685973c..e1876cc3b 100644
--- a/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/NamePatternTestCase.java
+++ b/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/NamePatternTestCase.java
@@ -90,12 +90,13 @@ public class NamePatternTestCase extends TestCase {
private void checkSerialization(NamePattern p) throws IOException {
ByteArrayOutputStream bo = new ByteArrayOutputStream();
- CompressingDataOutputStream out = new CompressingDataOutputStream(bo);
+ ConstantPoolSimulator cps = new ConstantPoolSimulator();
+ CompressingDataOutputStream out = new CompressingDataOutputStream(bo, cps);
p.write(out);
out.close();
ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
- VersionedDataInputStream in = new VersionedDataInputStream(bi);
+ VersionedDataInputStream in = new VersionedDataInputStream(bi, cps);
NamePattern newP = NamePattern.read(in);
assertEquals("write/read", p, newP);
diff --git a/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/SignaturePatternMatchSpeedTestCase.java b/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/SignaturePatternMatchSpeedTestCase.java
index 67cf5be98..52f82bfd7 100644
--- a/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/SignaturePatternMatchSpeedTestCase.java
+++ b/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/SignaturePatternMatchSpeedTestCase.java
@@ -152,12 +152,13 @@ public class SignaturePatternMatchSpeedTestCase extends PatternsTestCase {
private void checkSerialization(SignaturePattern p) throws IOException {
ByteArrayOutputStream bo = new ByteArrayOutputStream();
- CompressingDataOutputStream out = new CompressingDataOutputStream(bo);
+ ConstantPoolSimulator cps = new ConstantPoolSimulator();
+ CompressingDataOutputStream out = new CompressingDataOutputStream(bo, cps);
p.write(out);
out.close();
ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
- VersionedDataInputStream in = new VersionedDataInputStream(bi);
+ VersionedDataInputStream in = new VersionedDataInputStream(bi, cps);
SignaturePattern newP = SignaturePattern.read(in, null);
assertEquals("write/read", p, newP);
diff --git a/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/SignaturePatternTestCase.java b/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/SignaturePatternTestCase.java
index 629e26719..6c6f1f985 100644
--- a/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/SignaturePatternTestCase.java
+++ b/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/SignaturePatternTestCase.java
@@ -16,7 +16,6 @@ package org.aspectj.weaver.patterns;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
-
import org.aspectj.weaver.CompressingDataOutputStream;
import org.aspectj.weaver.Member;
import org.aspectj.weaver.TestUtils;
@@ -171,12 +170,13 @@ public class SignaturePatternTestCase extends PatternsTestCase {
private void checkSerialization(SignaturePattern p) throws IOException {
ByteArrayOutputStream bo = new ByteArrayOutputStream();
- CompressingDataOutputStream out = new CompressingDataOutputStream(bo);
+ ConstantPoolSimulator cps = new ConstantPoolSimulator();
+ CompressingDataOutputStream out = new CompressingDataOutputStream(bo, cps);
p.write(out);
out.close();
ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
- VersionedDataInputStream in = new VersionedDataInputStream(bi);
+ VersionedDataInputStream in = new VersionedDataInputStream(bi, cps);
SignaturePattern newP = SignaturePattern.read(in, null);
assertEquals("write/read", p, newP);
diff --git a/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/TypePatternListTestCase.java b/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/TypePatternListTestCase.java
index 15460d4cf..a141e2b0c 100644
--- a/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/TypePatternListTestCase.java
+++ b/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/TypePatternListTestCase.java
@@ -156,12 +156,13 @@ public class TypePatternListTestCase extends PatternsTestCase {
private void checkSerialization(String string) throws IOException {
TypePatternList p = makeArgumentsPattern(string);
ByteArrayOutputStream bo = new ByteArrayOutputStream();
- CompressingDataOutputStream out = new CompressingDataOutputStream(bo);
+ ConstantPoolSimulator cps = new ConstantPoolSimulator();
+ CompressingDataOutputStream out = new CompressingDataOutputStream(bo, cps);
p.write(out);
out.close();
ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
- VersionedDataInputStream in = new VersionedDataInputStream(bi);
+ VersionedDataInputStream in = new VersionedDataInputStream(bi, cps);
TypePatternList newP = TypePatternList.read(in, null);
assertEquals("write/read", p, newP);
diff --git a/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/TypePatternTestCase.java b/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/TypePatternTestCase.java
index 416ccc11c..4654fbd40 100644
--- a/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/TypePatternTestCase.java
+++ b/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/TypePatternTestCase.java
@@ -248,12 +248,13 @@ public class TypePatternTestCase extends PatternsTestCase {
private void checkSerialization(String string) throws IOException {
TypePattern p = makeTypePattern(string);
ByteArrayOutputStream bo = new ByteArrayOutputStream();
- CompressingDataOutputStream out = new CompressingDataOutputStream(bo);
+ ConstantPoolSimulator cps = new ConstantPoolSimulator();
+ CompressingDataOutputStream out = new CompressingDataOutputStream(bo, cps);
p.write(out);
out.close();
ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
- VersionedDataInputStream in = new VersionedDataInputStream(bi);
+ VersionedDataInputStream in = new VersionedDataInputStream(bi, cps);
TypePattern newP = TypePattern.read(in, null);
assertEquals("write/read", p, newP);
diff --git a/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/WithinTestCase.java b/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/WithinTestCase.java
index 2665b6e96..b8138b067 100644
--- a/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/WithinTestCase.java
+++ b/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/WithinTestCase.java
@@ -15,7 +15,6 @@ package org.aspectj.weaver.patterns;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
-
import org.aspectj.util.FuzzyBoolean;
import org.aspectj.weaver.CompressingDataOutputStream;
import org.aspectj.weaver.IntMap;
@@ -107,12 +106,13 @@ public class WithinTestCase extends PatternsTestCase {
private void checkSerialization(Pointcut p) throws IOException {
ByteArrayOutputStream bo = new ByteArrayOutputStream();
- CompressingDataOutputStream out = new CompressingDataOutputStream(bo);
+ ConstantPoolSimulator cps = new ConstantPoolSimulator();
+ CompressingDataOutputStream out = new CompressingDataOutputStream(bo, cps);
p.write(out);
out.close();
ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
- VersionedDataInputStream in = new VersionedDataInputStream(bi);
+ VersionedDataInputStream in = new VersionedDataInputStream(bi, cps);
Pointcut newP = Pointcut.read(in, null);
assertEquals("write/read", p, newP);