You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by pc...@apache.org on 2006/07/01 00:37:29 UTC
svn commit: r418401 [31/32] - in /incubator/openjpa/trunk: openjpa-lib/
openjpa-lib/src/main/java/org/apache/openjpa/lib/ant/
openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/
openjpa-lib/src/main/java/org/apache/openjpa/lib/jdbc/ openjpa-lib/src/...
Modified: incubator/openjpa/trunk/serp/src/main/java/serp/bytecode/visitor/VisitAcceptor.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/serp/src/main/java/serp/bytecode/visitor/VisitAcceptor.java?rev=418401&r1=418400&r2=418401&view=diff
==============================================================================
--- incubator/openjpa/trunk/serp/src/main/java/serp/bytecode/visitor/VisitAcceptor.java (original)
+++ incubator/openjpa/trunk/serp/src/main/java/serp/bytecode/visitor/VisitAcceptor.java Fri Jun 30 15:37:18 2006
@@ -1,13 +1,10 @@
/*
* Copyright 2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed 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
+ * 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
@@ -15,20 +12,20 @@
*/
package serp.bytecode.visitor;
-
/**
- * <p>Interface denoting an entity that can accept a {@link BCVisitor} and
- * provide its internal state to it. All entities in the bytecode framework
- * implement this interface.</p>
- *
- * @author Abe White
+ * Interface denoting an entity that can accept a {@link BCVisitor} and
+ * provide its internal state to it. All entities in the bytecode framework
+ * implement this interface.
+ *
+ * @author Abe White
*/
public interface VisitAcceptor {
/**
- * Accept a visit from a {@link BCVisitor}, calling the appropriate methods
- * to notify the visitor that it has entered this entity, and
- * to provide it with the proper callbacks for each sub-entity owned
- * by this one.
+ * Accept a visit from a {@link BCVisitor}, calling the appropriate methods
+ * to notify the visitor that it has entered this entity, and
+ * to provide it with the proper callbacks for each sub-entity owned
+ * by this one.
*/
public void acceptVisit(BCVisitor visitor);
}
+
Modified: incubator/openjpa/trunk/serp/src/main/java/serp/util/Numbers.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/serp/src/main/java/serp/util/Numbers.java?rev=418401&r1=418400&r2=418401&view=diff
==============================================================================
--- incubator/openjpa/trunk/serp/src/main/java/serp/util/Numbers.java (original)
+++ incubator/openjpa/trunk/serp/src/main/java/serp/util/Numbers.java Fri Jun 30 15:37:18 2006
@@ -1,13 +1,10 @@
/*
* Copyright 2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed 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
+ * 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
@@ -15,55 +12,44 @@
*/
package serp.util;
-
/**
- * <p>Number utilities.</p>
- *
- * @author Abe White
+ * Number utilities.
+ *
+ * @author Abe White
*/
public class Numbers {
private static final Integer INT_NEGONE = new Integer(-1);
private static final Long LONG_NEGONE = new Long(-1);
private static final Integer[] INTEGERS = new Integer[50];
private static final Long[] LONGS = new Long[50];
-
static {
for (int i = 0; i < INTEGERS.length; i++)
INTEGERS[i] = new Integer(i);
-
for (int i = 0; i < LONGS.length; i++)
LONGS[i] = new Long(i);
}
/**
- * Return the wrapper for the given number, taking advantage of cached
- * common values.
+ * Return the wrapper for the given number, taking advantage of cached
+ * common values.
*/
public static Integer valueOf(int n) {
- if (n == -1) {
+ if (n == -1)
return INT_NEGONE;
- }
-
- if ((n >= 0) && (n < INTEGERS.length)) {
+ if (n >= 0 && n < INTEGERS.length)
return INTEGERS[n];
- }
-
return new Integer(n);
}
/**
- * Return the wrapper for the given number, taking advantage of cached
- * common values.
+ * Return the wrapper for the given number, taking advantage of cached
+ * common values.
*/
public static Long valueOf(long n) {
- if (n == -1) {
+ if (n == -1)
return LONG_NEGONE;
- }
-
- if ((n >= 0) && (n < LONGS.length)) {
+ if (n >= 0 && n < LONGS.length)
return LONGS[(int) n];
- }
-
return new Long(n);
}
}
Modified: incubator/openjpa/trunk/serp/src/main/java/serp/util/Strings.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/serp/src/main/java/serp/util/Strings.java?rev=418401&r1=418400&r2=418401&view=diff
==============================================================================
--- incubator/openjpa/trunk/serp/src/main/java/serp/util/Strings.java (original)
+++ incubator/openjpa/trunk/serp/src/main/java/serp/util/Strings.java Fri Jun 30 15:37:18 2006
@@ -1,13 +1,10 @@
/*
* Copyright 2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed 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
+ * 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
@@ -16,69 +13,57 @@
package serp.util;
import java.math.*;
-
import java.util.*;
-
/**
- * <p>String utiltity methods.</p>
- *
- * @author Abe White
+ * String utiltity methods.
+ *
+ * @author Abe White
*/
public class Strings {
private static final Object[][] _codes = new Object[][] {
- { byte.class, "byte", "B" },
- { char.class, "char", "C" },
- { double.class, "double", "D" },
- { float.class, "float", "F" },
- { int.class, "int", "I" },
- { long.class, "long", "J" },
- { short.class, "short", "S" },
- { boolean.class, "boolean", "Z" },
- { void.class, "void", "V" }
- };
-
- /**
- * Replace all instances of <code>from</code> in <code>str</code>
- * with <code>to</code>.
- *
- * @param str the candidate string to replace
- * @param from the token to replace
- * @param to the new token
- * @return the string with all the replacements made
+ { byte.class, "byte", "B" }, { char.class, "char", "C" },
+ { double.class, "double", "D" }, { float.class, "float", "F" },
+ { int.class, "int", "I" }, { long.class, "long", "J" },
+ { short.class, "short", "S" }, { boolean.class, "boolean", "Z" },
+ { void.class, "void", "V" }
+ };
+
+ /**
+ * Replace all instances of <code>from</code> in <code>str</code>
+ * with <code>to</code>.
+ *
+ * @param str the candidate string to replace
+ * @param from the token to replace
+ * @param to the new token
+ * @return the string with all the replacements made
*/
public static String replace(String str, String from, String to) {
String[] split = split(str, from, Integer.MAX_VALUE);
-
return join(split, to);
}
/**
- * Splits the given string on the given token. Follows the semantics
- * of the Java 1.4 {@link String#split(String,int)} method, but does
- * not treat the given token as a regular expression.
+ * Splits the given string on the given token. Follows the semantics
+ * of the Java 1.4 {@link String#split(String,int)} method, but does
+ * not treat the given token as a regular expression.
*/
public static String[] split(String str, String token, int max) {
- if ((str == null) || (str.length() == 0)) {
+ if (str == null || str.length() == 0)
return new String[0];
- }
-
- if ((token == null) || (token.length() == 0)) {
+ if (token == null || token.length() == 0)
throw new IllegalArgumentException("token: [" + token + "]");
- }
- // split on token
+ // split on token
LinkedList ret = new LinkedList();
int start = 0;
-
for (int split = 0; split != -1;) {
split = str.indexOf(token, start);
-
- if ((split == -1) && (start >= str.length())) {
+ if (split == -1 && start >= str.length())
ret.add("");
- } else if (split == -1) {
+ else if (split == -1)
ret.add(str.substring(start));
- } else {
+ else {
ret.add(str.substring(start, split));
start = split + token.length();
}
@@ -91,70 +76,60 @@
// discard any trailing empty splits
while (ret.getLast().equals(""))
ret.removeLast();
- } else if ((max > 0) && (ret.size() > max)) {
+ } else if (max > 0 && ret.size() > max) {
// move all splits over max into the last split
StringBuffer buf = new StringBuffer(ret.removeLast().toString());
-
while (ret.size() >= max) {
buf.insert(0, token);
buf.insert(0, ret.removeLast());
}
-
ret.add(buf.toString());
}
- return (String[]) ret.toArray(new String[ret.size()]);
+ return(String[]) ret.toArray(new String[ret.size()]);
}
/**
- * Joins the given strings, placing the given token between them.
+ * Joins the given strings, placing the given token between them.
*/
public static String join(Object[] strings, String token) {
- if (strings == null) {
+ if (strings == null)
return null;
- }
StringBuffer buf = new StringBuffer(20 * strings.length);
-
for (int i = 0; i < strings.length; i++) {
- if (i > 0) {
+ if (i > 0)
buf.append(token);
- }
-
- if (strings[i] != null) {
+ if (strings[i] != null)
buf.append(strings[i]);
- }
}
-
return buf.toString();
}
/**
- * Return the class for the given string, correctly handling
- * primitive types. If the given class loader is null, the context
- * loader of the current thread will be used.
- *
- * @throws RuntimeException on load error
+ * Return the class for the given string, correctly handling
+ * primitive types. If the given class loader is null, the context
+ * loader of the current thread will be used.
+ *
+ * @throws RuntimeException on load error
*/
public static Class toClass(String str, ClassLoader loader) {
return toClass(str, false, loader);
}
/**
- * Return the class for the given string, correctly handling
- * primitive types. If the given class loader is null, the context
- * loader of the current thread will be used.
- *
- * @throws RuntimeException on load error
+ * Return the class for the given string, correctly handling
+ * primitive types. If the given class loader is null, the context
+ * loader of the current thread will be used.
+ *
+ * @throws RuntimeException on load error
*/
public static Class toClass(String str, boolean resolve, ClassLoader loader) {
- if (str == null) {
+ if (str == null)
throw new NullPointerException("str == null");
- }
// array handling
int dims = 0;
-
while (str.endsWith("[]")) {
dims++;
str = str.substring(0, str.length() - 2);
@@ -162,14 +137,11 @@
// check against primitive types
boolean primitive = false;
-
if (str.indexOf('.') == -1) {
- for (int i = 0; !primitive && (i < _codes.length); i++) {
+ for (int i = 0; !primitive && i < _codes.length; i++) {
if (_codes[i][1].equals(str)) {
- if (dims == 0) {
- return (Class) _codes[i][0];
- }
-
+ if (dims == 0)
+ return(Class) _codes[i][0];
str = (String) _codes[i][2];
primitive = true;
}
@@ -178,32 +150,21 @@
if (dims > 0) {
int size = str.length() + dims;
-
- if (!primitive) {
+ if (!primitive)
size += 2;
- }
-
StringBuffer buf = new StringBuffer(size);
-
for (int i = 0; i < dims; i++)
buf.append('[');
-
- if (!primitive) {
+ if (!primitive)
buf.append('L');
- }
-
buf.append(str);
-
- if (!primitive) {
+ if (!primitive)
buf.append(';');
- }
-
str = buf.toString();
}
- if (loader == null) {
+ if (loader == null)
loader = Thread.currentThread().getContextClassLoader();
- }
try {
return Class.forName(str, resolve, loader);
@@ -213,205 +174,149 @@
}
/**
- * Return only the class name, without package.
+ * Return only the class name, without package.
*/
public static String getClassName(Class cls) {
- return (cls == null) ? null : getClassName(cls.getName());
+ return(cls == null) ? null : getClassName(cls.getName());
}
/**
- * Return only the class name.
+ * Return only the class name.
*/
public static String getClassName(String fullName) {
- if (fullName == null) {
+ if (fullName == null)
return null;
- }
// special case for arrays
int dims = 0;
-
for (int i = 0; i < fullName.length(); i++) {
if (fullName.charAt(i) != '[') {
dims = i;
-
break;
}
}
-
- if (dims > 0) {
+ if (dims > 0)
fullName = fullName.substring(dims);
- }
// check for primitives
for (int i = 0; i < _codes.length; i++) {
if (_codes[i][2].equals(fullName)) {
fullName = (String) _codes[i][1];
-
break;
}
}
fullName = fullName.substring(fullName.lastIndexOf('.') + 1);
-
for (int i = 0; i < dims; i++)
fullName = fullName + "[]";
-
return fullName;
}
/**
- * Return only the package, or empty string if none.
+ * Return only the package, or empty string if none.
*/
public static String getPackageName(Class cls) {
- return (cls == null) ? null : getPackageName(cls.getName());
+ return(cls == null) ? null : getPackageName(cls.getName());
}
/**
- * Return only the package, or empty string if none.
+ * Return only the package, or empty string if none.
*/
public static String getPackageName(String fullName) {
- if (fullName == null) {
+ if (fullName == null)
return null;
- }
int dotIdx = fullName.lastIndexOf('.');
-
- return (dotIdx == -1) ? "" : fullName.substring(0, dotIdx);
+ return(dotIdx == -1) ? "" : fullName.substring(0, dotIdx);
}
/**
- * Return <code>val</code> as the type specified by
- * <code>type</code>. If <code>type</code> is a primitive, the
- * primitive wrapper type is created and returned, and
- * <code>null</code>s are converted to the Java default for the
- * primitive type.
- *
- * @param val The string value to parse
- * @param type The type to parse. This must be a primitive or a
- * primitive wrapper, or one of {@link BigDecimal},
- * {@link BigInteger}, {@link String}, {@link Date}.
- * @throws IllegalArgumentException if <code>type</code> is not a
- * supported type, or if <code>val</code> cannot be
- * converted into an instance of type <code>type</code>.
+ * Return <code>val</code> as the type specified by
+ * <code>type</code>. If <code>type</code> is a primitive, the
+ * primitive wrapper type is created and returned, and
+ * <code>null</code>s are converted to the Java default for the
+ * primitive type.
+ *
+ * @param val The string value to parse
+ * @param type The type to parse. This must be a primitive or a
+ * primitive wrapper, or one of {@link BigDecimal},
+ * {@link BigInteger}, {@link String}, {@link Date}.
+ * @throws IllegalArgumentException if <code>type</code> is not a
+ * supported type, or if <code>val</code> cannot be
+ * converted into an instance of type <code>type</code>.
*/
public static Object parse(String val, Class type) {
- if (!canParse(type)) {
- throw new IllegalArgumentException("invalid type: " +
- type.getName());
- }
+ if (!canParse(type))
+ throw new IllegalArgumentException("invalid type: "
+ + type.getName());
// deal with null value
if (val == null) {
- if (!type.isPrimitive()) {
+ if (!type.isPrimitive())
return null;
- }
-
- if (type == boolean.class) {
+ if (type == boolean.class)
return Boolean.FALSE;
- }
-
- if (type == byte.class) {
+ if (type == byte.class)
return new Byte((byte) 0);
- }
-
- if (type == char.class) {
+ if (type == char.class)
return new Character((char) 0);
- }
-
- if (type == double.class) {
+ if (type == double.class)
return new Double(0);
- }
-
- if (type == float.class) {
+ if (type == float.class)
return new Float(0);
- }
-
- if (type == int.class) {
+ if (type == int.class)
return Numbers.valueOf(0);
- }
-
- if (type == long.class) {
+ if (type == long.class)
return Numbers.valueOf(0L);
- }
-
- if (type == short.class) {
+ if (type == short.class)
return new Short((short) 0);
- }
-
throw new IllegalStateException("invalid type: " + type);
}
// deal with non-null value
- if ((type == boolean.class) || (type == Boolean.class)) {
+ if (type == boolean.class || type == Boolean.class)
return Boolean.valueOf(val);
- }
-
- if ((type == byte.class) || (type == Byte.class)) {
+ if (type == byte.class || type == Byte.class)
return Byte.valueOf(val);
- }
-
- if ((type == char.class) || (type == Character.class)) {
- if (val.length() == 0) {
+ if (type == char.class || type == Character.class) {
+ if (val.length() == 0)
return new Character((char) 0);
- }
-
- if (val.length() == 1) {
+ if (val.length() == 1)
return new Character(val.charAt(0));
- }
-
- throw new IllegalArgumentException("'" + val + "' is longer than " +
- "one character.");
+ throw new IllegalArgumentException("'" + val + "' is longer than "
+ + "one character.");
}
-
- if ((type == double.class) || (type == Double.class)) {
+ if (type == double.class || type == Double.class)
return Double.valueOf(val);
- }
-
- if ((type == float.class) || (type == Float.class)) {
+ if (type == float.class || type == Float.class)
return Float.valueOf(val);
- }
-
- if ((type == int.class) || (type == Integer.class)) {
+ if (type == int.class || type == Integer.class)
return Integer.valueOf(val);
- }
-
- if ((type == long.class) || (type == Long.class)) {
+ if (type == long.class || type == Long.class)
return Long.valueOf(val);
- }
-
- if ((type == short.class) || (type == Short.class)) {
+ if (type == short.class || type == Short.class)
return Short.valueOf(val);
- }
-
- if (type == String.class) {
+ if (type == String.class)
return val;
- }
-
- if (type == Date.class) {
+ if (type == Date.class)
return new Date(val);
- }
-
- if (type == BigInteger.class) {
+ if (type == BigInteger.class)
return new BigInteger(val);
- }
-
- if (type == BigDecimal.class) {
+ if (type == BigDecimal.class)
return new BigDecimal(val);
- }
-
throw new IllegalArgumentException("Invalid type: " + type);
}
/**
- * Whether the given type is parsable via {@link #parse}.
+ * Whether the given type is parsable via {@link #parse}.
*/
public static boolean canParse(Class type) {
- return type.isPrimitive() || (type == Boolean.class) ||
- (type == Byte.class) || (type == Character.class) ||
- (type == Short.class) || (type == Integer.class) ||
- (type == Long.class) || (type == Float.class) ||
- (type == Double.class) || (type == String.class) ||
- (type == Date.class) || (type == BigInteger.class) ||
- (type == BigDecimal.class);
+ return type.isPrimitive()
+ || type == Boolean.class || type == Byte.class
+ || type == Character.class || type == Short.class
+ || type == Integer.class || type == Long.class
+ || type == Float.class || type == Double.class
+ || type == String.class || type == Date.class
+ || type == BigInteger.class || type == BigDecimal.class;
}
}
Modified: incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/AbstractStateTest.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/AbstractStateTest.java?rev=418401&r1=418400&r2=418401&view=diff
==============================================================================
--- incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/AbstractStateTest.java (original)
+++ incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/AbstractStateTest.java Fri Jun 30 15:37:18 2006
@@ -1,13 +1,10 @@
/*
* Copyright 2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed 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
+ * 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
@@ -16,16 +13,14 @@
package serp.bytecode;
import junit.framework.*;
-
import junit.textui.*;
-
/**
- * <p>Base class for testing the handling of the {@link PrimitiveState} and
- * {@link ArrayState}. Subclasses should set the {@link #_bc} member in
- * their {@link TestCase#setUp} method.</p>
- *
- * @author Abe White
+ * Base class for testing the handling of the {@link PrimitiveState} and
+ * {@link ArrayState}. Subclasses should set the {@link #_bc} member in
+ * their {@link TestCase#setUp} method.
+ *
+ * @author Abe White
*/
public abstract class AbstractStateTest extends TestCase {
protected Project _project = new Project();
@@ -36,26 +31,25 @@
}
/**
- * Test the name and type operations.
+ * Test the name and type operations.
*/
public abstract void testType();
/**
- * Test operations on the superclass.
+ * Test operations on the superclass.
*/
public abstract void testSuperclass();
/**
- * Test operations on the component type.
+ * Test operations on the component type.
*/
public abstract void testComponent();
/**
- * Test the basics -- magic number, etc.
+ * Test the basics -- magic number, etc.
*/
public void testBasics() {
assertEquals(Constants.VALID_MAGIC, _bc.getMagic());
-
try {
_bc.setMagic(1);
fail("Allowed set magic");
@@ -63,7 +57,6 @@
}
assertEquals(Constants.MAJOR_VERSION, _bc.getMajorVersion());
-
try {
_bc.setMajorVersion(1);
fail("Allowed set major version");
@@ -71,7 +64,6 @@
}
assertEquals(Constants.MINOR_VERSION, _bc.getMinorVersion());
-
try {
_bc.setMinorVersion(1);
fail("Allowed set minor version");
@@ -80,7 +72,6 @@
assertEquals(Constants.ACCESS_PUBLIC | Constants.ACCESS_FINAL,
_bc.getAccessFlags());
-
try {
_bc.setAccessFlags(1);
fail("Allowed set access flags");
@@ -95,12 +86,11 @@
}
/**
- * Test operations on interfaces.
+ * Test operations on interfaces.
*/
public void testInterfaces() {
assertEquals(0, _bc.getDeclaredInterfaceNames().length);
assertEquals(0, _bc.getInterfaceNames().length);
-
try {
_bc.declareInterface("foo");
fail("Allowed declare interface");
@@ -116,12 +106,11 @@
}
/**
- * Test operations on fields.
+ * Test operations on fields.
*/
public void testFields() {
assertEquals(0, _bc.getDeclaredFields().length);
assertEquals(0, _bc.getFields().length);
-
try {
_bc.declareField("foo", int.class);
fail("Allowed declare field");
@@ -134,11 +123,10 @@
}
/**
- * Test operations on methods.
+ * Test operations on methods.
*/
public void testMethods() {
assertEquals(0, _bc.getDeclaredMethods().length);
-
try {
_bc.declareMethod("foo", int.class, null);
fail("Allowed declare method");
@@ -157,11 +145,10 @@
}
/**
- * Test operations on attributes.
+ * Test operations on attributes.
*/
public void testAttributes() {
assertNull(_bc.getSourceFile(false));
-
try {
_bc.getSourceFile(true);
fail("Allowed add source file");
@@ -169,7 +156,6 @@
}
assertNull(_bc.getInnerClasses(false));
-
try {
_bc.getInnerClasses(true);
fail("Allowed add inner classes");
@@ -177,7 +163,6 @@
}
assertTrue(!_bc.isDeprecated());
-
try {
_bc.setDeprecated(true);
fail("Allowed set deprecated");
@@ -187,7 +172,6 @@
assertEquals(0, _bc.getAttributes().length);
_bc.clearAttributes();
assertTrue(!_bc.removeAttribute(Constants.ATTR_SYNTHETIC));
-
try {
_bc.addAttribute(Constants.ATTR_SYNTHETIC);
fail("Allowed add attribute");
@@ -196,7 +180,7 @@
}
/**
- * Tests that these types cannot be written.
+ * Tests that these types cannot be written.
*/
public void testWrite() {
try {
Modified: incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestArray.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestArray.java?rev=418401&r1=418400&r2=418401&view=diff
==============================================================================
--- incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestArray.java (original)
+++ incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestArray.java Fri Jun 30 15:37:18 2006
@@ -1,13 +1,10 @@
/*
* Copyright 2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed 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
+ * 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
@@ -16,14 +13,12 @@
package serp.bytecode;
import junit.framework.*;
-
import junit.textui.*;
-
/**
- * <p>Tests the handling of array {@link BCClass}es.</p>
- *
- * @author Abe White
+ * Tests the handling of array {@link BCClass}es.
+ *
+ * @author Abe White
*/
public class TestArray extends AbstractStateTest {
private BCClass _bc2 = null;
@@ -42,7 +37,6 @@
assertEquals("java.lang", _bc.getPackageName());
assertEquals("String[]", _bc.getClassName());
assertEquals(String[].class, _bc.getType());
-
try {
_bc.setName("Foo[]");
fail("Allowed set name");
@@ -60,7 +54,6 @@
public void testSuperclass() {
assertEquals(Object.class.getName(), _bc.getSuperclassName());
-
try {
_bc.setSuperclass("Foo");
fail("Allowed set superclass");
Modified: incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestArrayLoadInstruction.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestArrayLoadInstruction.java?rev=418401&r1=418400&r2=418401&view=diff
==============================================================================
--- incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestArrayLoadInstruction.java (original)
+++ incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestArrayLoadInstruction.java Fri Jun 30 15:37:18 2006
@@ -1,13 +1,10 @@
/*
* Copyright 2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed 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
+ * 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
@@ -16,14 +13,12 @@
package serp.bytecode;
import junit.framework.*;
-
import junit.textui.*;
-
/**
- * <p>Tests the {@link ArrayLoadInstruction} type.</p>
- *
- * @author Abe White
+ * Tests the {@link ArrayLoadInstruction} type.
+ *
+ * @author Abe White
*/
public class TestArrayLoadInstruction extends TestCase {
private Code _code = new Code();
@@ -33,7 +28,7 @@
}
/**
- * Test that the instruction initializes correctly when generated.
+ * Test that the instruction initializes correctly when generated.
*/
public void testIniitalize() {
assertEquals(Constants.NOP, _code.xaload().getOpcode());
@@ -48,7 +43,7 @@
}
/**
- * Test the the instruction returns its type correctly.
+ * Test the the instruction returns its type correctly.
*/
public void testGetType() {
assertNull(_code.xaload().getType());
@@ -63,7 +58,7 @@
}
/**
- * Test that the opcode morphs correctly with type changes.
+ * Test that the opcode morphs correctly with type changes.
*/
public void testOpcodeMorph() {
ArrayLoadInstruction ins = _code.xaload();
@@ -83,7 +78,7 @@
assertEquals(Constants.SALOAD, ins.setType(short.class).getOpcode());
assertEquals(Constants.IALOAD, ins.setType(void.class).getOpcode());
assertEquals(Constants.AALOAD, ins.setType(String.class).getOpcode());
- assertEquals(Constants.IALOAD, ins.setType(boolean.class).getOpcode());
+ assertEquals(Constants.IALOAD, ins.setType(boolean.class). getOpcode());
}
public static Test suite() {
Modified: incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestArrayStoreInstruction.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestArrayStoreInstruction.java?rev=418401&r1=418400&r2=418401&view=diff
==============================================================================
--- incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestArrayStoreInstruction.java (original)
+++ incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestArrayStoreInstruction.java Fri Jun 30 15:37:18 2006
@@ -1,13 +1,10 @@
/*
* Copyright 2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed 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
+ * 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
@@ -16,14 +13,12 @@
package serp.bytecode;
import junit.framework.*;
-
import junit.textui.*;
-
/**
- * <p>Tests the {@link ArrayStoreInstruction} type.</p>
- *
- * @author Abe White
+ * Tests the {@link ArrayStoreInstruction} type.
+ *
+ * @author Abe White
*/
public class TestArrayStoreInstruction extends TestCase {
private Code _code = new Code();
@@ -33,7 +28,7 @@
}
/**
- * Test that the instruction initializes correctly when generated.
+ * Test that the instruction initializes correctly when generated.
*/
public void testIniitalize() {
assertEquals(Constants.NOP, _code.xastore().getOpcode());
@@ -48,7 +43,7 @@
}
/**
- * Test the the instruction returns its type correctly.
+ * Test the the instruction returns its type correctly.
*/
public void testGetType() {
assertNull(_code.xastore().getType());
@@ -63,7 +58,7 @@
}
/**
- * Test that the opcode morphs correctly with type changes.
+ * Test that the opcode morphs correctly with type changes.
*/
public void testOpcodeMorph() {
ArrayStoreInstruction ins = _code.xastore();
@@ -83,7 +78,8 @@
assertEquals(Constants.SASTORE, ins.setType(short.class).getOpcode());
assertEquals(Constants.IASTORE, ins.setType(void.class).getOpcode());
assertEquals(Constants.AASTORE, ins.setType(String.class).getOpcode());
- assertEquals(Constants.IASTORE, ins.setType(boolean.class).getOpcode());
+ assertEquals(Constants.IASTORE, ins.setType(boolean.class).
+ getOpcode());
}
public static Test suite() {
Modified: incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestAttributes.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestAttributes.java?rev=418401&r1=418400&r2=418401&view=diff
==============================================================================
--- incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestAttributes.java (original)
+++ incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestAttributes.java Fri Jun 30 15:37:18 2006
@@ -1,13 +1,10 @@
/*
* Copyright 2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed 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
+ * 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
@@ -16,14 +13,12 @@
package serp.bytecode;
import junit.framework.*;
-
import junit.textui.*;
-
/**
- * <p>Tests the {@link Attributes} type.</p>
- *
- * @author Abe White
+ * Tests the {@link Attributes} type.
+ *
+ * @author Abe White
*/
public class TestAttributes extends TestCase {
private Project _project = new Project();
@@ -35,7 +30,7 @@
}
/**
- * Test getting attributes.
+ * Test getting attributes.
*/
public void testGetAttributes() {
assertEquals(0, _attrs.getAttributes().length);
@@ -49,18 +44,21 @@
assertTrue(attr1 == _attrs.getAttribute(Constants.ATTR_DEPRECATED));
assertTrue(attr2 == _attrs.getAttribute(Constants.ATTR_SYNTHETIC));
assertEquals(0, _attrs.getAttributes(Constants.ATTR_CODE).length);
- assertEquals(1, _attrs.getAttributes(Constants.ATTR_DEPRECATED).length);
- assertEquals(1, _attrs.getAttributes(Constants.ATTR_SYNTHETIC).length);
- assertTrue(attr1 == _attrs.getAttributes(Constants.ATTR_DEPRECATED)[0]);
- assertTrue(attr2 == _attrs.getAttributes(Constants.ATTR_SYNTHETIC)[0]);
+ assertEquals(1, _attrs.getAttributes(Constants.ATTR_DEPRECATED).
+ length);
+ assertEquals(1, _attrs.getAttributes(Constants.ATTR_SYNTHETIC). length);
+ assertTrue(attr1 == _attrs.getAttributes
+ (Constants.ATTR_DEPRECATED)[0]);
+ assertTrue(attr2 == _attrs.getAttributes (Constants.ATTR_SYNTHETIC)[0]);
Attribute attr3 = _attrs.addAttribute(Constants.ATTR_DEPRECATED);
assertEquals(3, _attrs.getAttributes().length);
- assertEquals(2, _attrs.getAttributes(Constants.ATTR_DEPRECATED).length);
+ assertEquals(2, _attrs.getAttributes(Constants.ATTR_DEPRECATED).
+ length);
}
/**
- * Test setting attributes.
+ * Test setting attributes.
*/
public void testSetAttributes() {
Attribute attr1 = _attrs.addAttribute(Constants.ATTR_DEPRECATED);
@@ -68,24 +66,26 @@
_attrs2.setAttributes(_attrs.getAttributes());
assertEquals(2, _attrs2.getAttributes().length);
- assertEquals(Constants.ATTR_DEPRECATED,
- _attrs2.getAttribute(Constants.ATTR_DEPRECATED).getName());
- assertEquals(Constants.ATTR_SYNTHETIC,
- _attrs2.getAttribute(Constants.ATTR_SYNTHETIC).getName());
+ assertEquals(Constants.ATTR_DEPRECATED, _attrs2.getAttribute
+ (Constants.ATTR_DEPRECATED).getName());
+ assertEquals(Constants.ATTR_SYNTHETIC, _attrs2.getAttribute
+ (Constants.ATTR_SYNTHETIC).getName());
assertTrue(attr1 != _attrs2.getAttribute(Constants.ATTR_DEPRECATED));
assertTrue(attr2 != _attrs2.getAttribute(Constants.ATTR_SYNTHETIC));
Attribute attr3 = _attrs.addAttribute(Constants.ATTR_SOURCE);
_attrs2.setAttributes(new Attribute[] { attr3 });
assertEquals(1, _attrs2.getAttributes().length);
- assertEquals(Constants.ATTR_SOURCE, _attrs2.getAttributes()[0].getName());
+ assertEquals(Constants.ATTR_SOURCE, _attrs2.getAttributes()[0].
+ getName());
}
/**
- * Test adding attributs.
+ * Test adding attributs.
*/
public void testAddAttributes() {
- SourceFile attr1 = (SourceFile) _attrs.addAttribute(Constants.ATTR_SOURCE);
+ SourceFile attr1 = (SourceFile) _attrs.addAttribute
+ (Constants.ATTR_SOURCE);
assertEquals(attr1.getName(), Constants.ATTR_SOURCE);
assertTrue(attr1 != _attrs.addAttribute(Constants.ATTR_SOURCE));
assertEquals(2, _attrs.getAttributes(Constants.ATTR_SOURCE).length);
@@ -97,7 +97,7 @@
}
/**
- * Test clearing attributes.
+ * Test clearing attributes.
*/
public void testClear() {
_attrs.clearAttributes();
@@ -118,14 +118,14 @@
}
/**
- * Test removing a class.
+ * Test removing a class.
*/
public void testRemoveAttribute() {
assertTrue(!_attrs.removeAttribute((String) null));
assertTrue(!_attrs.removeAttribute((Attribute) null));
assertTrue(!_attrs.removeAttribute(Constants.ATTR_SYNTHETIC));
- assertTrue(!_attrs.removeAttribute(_attrs2.addAttribute(
- Constants.ATTR_SYNTHETIC)));
+ assertTrue(!_attrs.removeAttribute(_attrs2.addAttribute
+ (Constants.ATTR_SYNTHETIC)));
Attribute attr1 = _attrs.addAttribute(Constants.ATTR_SYNTHETIC);
Attribute attr2 = _attrs.addAttribute(Constants.ATTR_DEPRECATED);
@@ -137,7 +137,8 @@
assertTrue(_attrs.removeAttribute(attr1.getName()));
assertEquals(1, _attrs.getAttributes().length);
- assertTrue(!_attrs.removeAttribute(_attrs2.addAttribute(attr2.getName())));
+ assertTrue(!_attrs.removeAttribute(_attrs2.addAttribute
+ (attr2.getName())));
assertTrue(_attrs.removeAttribute(attr2));
assertEquals(0, _attrs.getAttributes().length);
Modified: incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestBCClass.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestBCClass.java?rev=418401&r1=418400&r2=418401&view=diff
==============================================================================
--- incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestBCClass.java (original)
+++ incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestBCClass.java Fri Jun 30 15:37:18 2006
@@ -1,13 +1,10 @@
/*
* Copyright 2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed 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
+ * 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
@@ -15,19 +12,15 @@
*/
package serp.bytecode;
+import java.io.*;
import junit.framework.*;
-
import junit.textui.*;
-import java.io.*;
-
-
/**
- * <p>Tests the {@link BCClass} type.</p>
- *
+ * Tests the {@link BCClass} type.
* UNFINISHED
- *
- * @author Abe White
+ *
+ * @author Abe White
*/
public class TestBCClass extends TestCase {
private Project _project = new Project();
@@ -38,7 +31,7 @@
}
/**
- * Test accessing the class project.
+ * Test accessing the class project.
*/
public void testProject() {
assertTrue(_project == _bc.getProject());
@@ -48,20 +41,18 @@
}
/**
- * Test read/write.
+ * Test read/write.
*/
- public void testReadWrite() throws IOException {
+ public void testReadWrite () throws IOException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
InputStream in = Integer.class.getResourceAsStream("Integer.class");
int ch;
-
while ((ch = in.read()) != -1)
out.write(ch);
byte[] origBytes = out.toByteArray();
byte[] bytes = _bc.toByteArray();
assertEquals(origBytes.length, bytes.length);
-
for (int i = 0; i < origBytes.length; i++)
assertEquals(origBytes[i], bytes[i]);
@@ -69,13 +60,12 @@
BCClass bc2 = new Project().loadClass(_bc);
bytes = bc2.toByteArray();
assertEquals(origBytes.length, bytes.length);
-
for (int i = 0; i < origBytes.length; i++)
assertEquals(origBytes[i], bytes[i]);
}
/**
- * Test basics -- magic number, major version, minor version.
+ * Test basics -- magic number, major version, minor version.
*/
public void testBasics() {
assertEquals(Constants.VALID_MAGIC, _bc.getMagic());
@@ -97,27 +87,27 @@
}
/**
- * Test access flags.
+ * Test access flags.
*/
public void testAccessFlags() {
- assertEquals(Constants.ACCESS_PUBLIC | Constants.ACCESS_SUPER |
- Constants.ACCESS_FINAL, _bc.getAccessFlags());
+ assertEquals(Constants.ACCESS_PUBLIC | Constants.ACCESS_SUPER
+ | Constants.ACCESS_FINAL, _bc.getAccessFlags());
assertTrue(_bc.isPublic());
assertTrue(!_bc.isPackage());
assertTrue(_bc.isFinal());
assertTrue(!_bc.isInterface());
assertTrue(!_bc.isAbstract());
- _bc.setAccessFlags(Constants.ACCESS_ABSTRACT |
- Constants.ACCESS_INTERFACE);
+ _bc.setAccessFlags(Constants.ACCESS_ABSTRACT
+ | Constants.ACCESS_INTERFACE);
assertTrue(!_bc.isPublic());
assertTrue(_bc.isPackage());
assertTrue(!_bc.isFinal());
assertTrue(_bc.isInterface());
assertTrue(_bc.isAbstract());
- _bc.setAccessFlags(Constants.ACCESS_PUBLIC | Constants.ACCESS_SUPER |
- Constants.ACCESS_FINAL);
+ _bc.setAccessFlags(Constants.ACCESS_PUBLIC
+ | Constants.ACCESS_SUPER | Constants.ACCESS_FINAL);
_bc.makePackage();
assertTrue(!_bc.isPublic());
@@ -144,7 +134,7 @@
}
/**
- * Test class type operations.
+ * Test class type operations.
*/
public void testType() {
assertEquals(Integer.class.getName(), _bc.getName());
@@ -157,14 +147,14 @@
}
/**
- * Test superclass operations.
+ * Test superclass operations.
*/
public void testSuperclass() {
assertEquals(Number.class.getName(), _bc.getSuperclassName());
assertEquals(Number.class, _bc.getSuperclassType());
assertEquals(Number.class.getName(), _bc.getSuperclassBC().getName());
- assertEquals(null,
- _bc.getSuperclassBC().getSuperclassBC().getSuperclassBC());
+ assertEquals(null, _bc.getSuperclassBC().getSuperclassBC().
+ getSuperclassBC());
_bc.setSuperclass(String.class);
assertEquals(String.class.getName(), _bc.getSuperclassName());
@@ -180,7 +170,7 @@
}
/**
- * Test operations on interfaces.
+ * Test operations on interfaces.
*/
public void testInterfaces() {
Object[] interfaces = _bc.getInterfaceNames();
@@ -253,8 +243,8 @@
assertEquals(1, interfaces.length);
assertEquals(Comparable.class, ((BCClass) interfaces[0]).getType());
- assertTrue(_bc.removeDeclaredInterface(_project.loadClass(
- Comparable.class)));
+ assertTrue(_bc.removeDeclaredInterface
+ (_project.loadClass(Comparable.class)));
interfaces = _bc.getDeclaredInterfaceNames();
assertEquals(0, interfaces.length);
}
Modified: incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestCode.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestCode.java?rev=418401&r1=418400&r2=418401&view=diff
==============================================================================
--- incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestCode.java (original)
+++ incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestCode.java Fri Jun 30 15:37:18 2006
@@ -1,13 +1,10 @@
/*
* Copyright 2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed 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
+ * 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
@@ -16,14 +13,12 @@
package serp.bytecode;
import junit.framework.*;
-
import junit.textui.*;
-
/**
- * <p>Tests the {@link Code} class.</p>
- *
- * @author Eric Lindauer
+ * Tests the {@link Code} class.
+ *
+ * @author Eric Lindauer
*/
public class TestCode extends TestCase {
public TestCode(String test) {
@@ -31,8 +26,8 @@
}
/**
- * Test that removing Instructions from a Code block
- * removes the correct Instructions.
+ * Test that removing Instructions from a Code block
+ * removes the correct Instructions.
*/
public void testRemove() {
Code code = new Code();
@@ -78,17 +73,15 @@
}
/**
- * Test that instruction indexes work correctly.
+ * Test that instruction indexes work correctly.
*/
public void testIndexes() {
Code code = new Code();
assertEquals(0, code.nextIndex());
assertEquals(-1, code.previousIndex());
-
Instruction first = code.nop();
assertEquals(1, code.nextIndex());
assertEquals(0, code.previousIndex());
-
Instruction second = code.nop();
assertEquals(2, code.nextIndex());
assertEquals(1, code.previousIndex());
@@ -98,7 +91,6 @@
code.next();
assertEquals(2, code.nextIndex());
assertEquals(1, code.previousIndex());
-
Instruction third = code.nop();
assertEquals(3, code.nextIndex());
assertEquals(2, code.previousIndex());
Modified: incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestConstantInstruction.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestConstantInstruction.java?rev=418401&r1=418400&r2=418401&view=diff
==============================================================================
--- incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestConstantInstruction.java (original)
+++ incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestConstantInstruction.java Fri Jun 30 15:37:18 2006
@@ -1,13 +1,10 @@
/*
* Copyright 2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed 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
+ * 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
@@ -16,14 +13,12 @@
package serp.bytecode;
import junit.framework.*;
-
import junit.textui.*;
-
/**
- * <p>Tests the {@link ConstantInstruction} type.</p>
- *
- * @author Abe White
+ * Tests the {@link ConstantInstruction} type.
+ *
+ * @author Abe White
*/
public class TestConstantInstruction extends TestCase {
private ConstantInstruction _const = new Code().constant();
@@ -33,7 +28,7 @@
}
/**
- * Test that the type instruction returns its type correctly.
+ * Test that the type instruction returns its type correctly.
*/
public void testGetType() {
assertNull(_const.getType());
@@ -56,7 +51,7 @@
}
/**
- * Test that the value is stored correctly.
+ * Test that the value is stored correctly.
*/
public void testGetValue() {
assertNull(_const.getValue());
@@ -81,7 +76,7 @@
}
/**
- * Test the the opcode is morphed correctly when the value is set.
+ * Test the the opcode is morphed correctly when the value is set.
*/
public void testOpcodeMorph() {
assertEquals(Constants.NOP, _const.getOpcode());
@@ -109,10 +104,12 @@
assertEquals(Constants.LDC, _const.setValue("foo").getOpcode());
assertEquals(Constants.ICONST1, _const.setValue(true).getOpcode());
assertEquals(Constants.BIPUSH, _const.setValue('a').getOpcode());
- assertEquals(Constants.ICONST0, _const.setValue((short) 0).getOpcode());
- assertEquals(Constants.ACONSTNULL,
- _const.setValue((Object) null).getOpcode());
- assertEquals(Constants.LDCW, _const.setValue(String.class).getOpcode());
+ assertEquals(Constants.ICONST0, _const.setValue((short) 0).
+ getOpcode());
+ assertEquals(Constants.ACONSTNULL, _const.setValue((Object) null).
+ getOpcode());
+ assertEquals(Constants.LDCW, _const.setValue(String.class).
+ getOpcode());
}
public static Test suite() {
Modified: incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestConvertInstruction.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestConvertInstruction.java?rev=418401&r1=418400&r2=418401&view=diff
==============================================================================
--- incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestConvertInstruction.java (original)
+++ incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestConvertInstruction.java Fri Jun 30 15:37:18 2006
@@ -1,13 +1,10 @@
/*
* Copyright 2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed 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
+ * 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
@@ -16,14 +13,12 @@
package serp.bytecode;
import junit.framework.*;
-
import junit.textui.*;
-
/**
- * <p>Tests the {@link ConvertInstruction} type.</p>
- *
- * @author Abe White
+ * Tests the {@link ConvertInstruction} type.
+ *
+ * @author Abe White
*/
public class TestConvertInstruction extends TestCase {
private Code _code = new Code();
@@ -33,7 +28,7 @@
}
/**
- * Test that the opcode is morphed correctly when the types are set.
+ * Test that the opcode is morphed correctly when the types are set.
*/
public void testOpcodeMorph() {
ConvertInstruction ins = _code.convert();
Modified: incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestLoadInstruction.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestLoadInstruction.java?rev=418401&r1=418400&r2=418401&view=diff
==============================================================================
--- incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestLoadInstruction.java (original)
+++ incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestLoadInstruction.java Fri Jun 30 15:37:18 2006
@@ -1,13 +1,10 @@
/*
* Copyright 2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed 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
+ * 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
@@ -16,14 +13,12 @@
package serp.bytecode;
import junit.framework.*;
-
import junit.textui.*;
-
/**
- * <p>Tests the {@link LoadInstruction} type.</p>
- *
- * @author Abe White
+ * Tests the {@link LoadInstruction} type.
+ *
+ * @author Abe White
*/
public class TestLoadInstruction extends TestCase {
private Code _code = new Code();
@@ -33,7 +28,7 @@
}
/**
- * Test that the instruction intitializes correctly when generated.
+ * Test that the instruction intitializes correctly when generated.
*/
public void testInitialize() {
assertEquals(Constants.NOP, _code.xload().getOpcode());
@@ -51,7 +46,7 @@
}
/**
- * Test that the instruction returns its type correctly.
+ * Test that the instruction returns its type correctly.
*/
public void testGetType() {
LoadInstruction ins = _code.xload();
@@ -95,8 +90,8 @@
}
/**
- * Test that the opcode is morphed correctly when the type and local
- * of the instruction are changed.
+ * Test that the opcode is morphed correctly when the type and local
+ * of the instruction are changed.
*/
public void testOpcodeMorph() {
LoadInstruction ins = _code.xload();
Modified: incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestMathInstruction.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestMathInstruction.java?rev=418401&r1=418400&r2=418401&view=diff
==============================================================================
--- incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestMathInstruction.java (original)
+++ incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestMathInstruction.java Fri Jun 30 15:37:18 2006
@@ -1,13 +1,10 @@
/*
* Copyright 2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed 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
+ * 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
@@ -16,14 +13,12 @@
package serp.bytecode;
import junit.framework.*;
-
import junit.textui.*;
-
/**
- * <p>Tests the {@link MathInstruction} type.</p>
- *
- * @author Abe White
+ * Tests the {@link MathInstruction} type.
+ *
+ * @author Abe White
*/
public class TestMathInstruction extends TestCase {
private Code _code = new Code();
@@ -33,7 +28,7 @@
}
/**
- * Test that the instruction intitializes correctly when generated.
+ * Test that the instruction intitializes correctly when generated.
*/
public void testInitialize() {
assertEquals(Constants.NOP, _code.math().getOpcode());
@@ -88,7 +83,7 @@
}
/**
- * Test that the instruction returns its type correctly.
+ * Test that the instruction returns its type correctly.
*/
public void testGetType() {
MathInstruction ins = _code.math();
@@ -253,8 +248,8 @@
}
/**
- * Test that the opcode is morphed correctly when the type and operation
- * of the instruction are changed.
+ * Test that the opcode is morphed correctly when the type and operation
+ * of the instruction are changed.
*/
public void testOpcodeMorph() {
MathInstruction math = _code.math();
Modified: incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestNameCache.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestNameCache.java?rev=418401&r1=418400&r2=418401&view=diff
==============================================================================
--- incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestNameCache.java (original)
+++ incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestNameCache.java Fri Jun 30 15:37:18 2006
@@ -1,13 +1,10 @@
/*
* Copyright 2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed 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
+ * 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
@@ -16,14 +13,12 @@
package serp.bytecode;
import junit.framework.*;
-
import junit.textui.*;
-
/**
- * Tests the {@link NameCache} utility type.
- *
- * @author Abe White
+ * Tests the {@link NameCache} utility type.
+ *
+ * @author Abe White
*/
public class TestNameCache extends TestCase {
private NameCache _cache = null;
@@ -37,7 +32,7 @@
}
/**
- * Tests that class names are correctly converted to internal form.
+ * Tests that class names are correctly converted to internal form.
*/
public void testInternalForm() {
assertEquals("I", _cache.getInternalForm("int", true));
@@ -54,37 +49,39 @@
assertEquals("Z", _cache.getInternalForm("boolean", true));
assertEquals("V", _cache.getInternalForm("void", true));
- assertEquals("Ljava/lang/Object;",
- _cache.getInternalForm(Object.class.getName(), true));
- assertEquals("java/lang/Object",
- _cache.getInternalForm(Object.class.getName(), false));
- assertEquals("Ljava/lang/Object;",
- _cache.getInternalForm("Ljava/lang/Object;", true));
- assertEquals("java/lang/Object",
- _cache.getInternalForm("Ljava/lang/Object;", false));
+ assertEquals("Ljava/lang/Object;", _cache.getInternalForm
+ (Object.class.getName(), true));
+ assertEquals("java/lang/Object", _cache.getInternalForm
+ (Object.class.getName(), false));
+ assertEquals("Ljava/lang/Object;", _cache.getInternalForm
+ ("Ljava/lang/Object;", true));
+ assertEquals("java/lang/Object", _cache.getInternalForm
+ ("Ljava/lang/Object;", false));
}
/**
- * Tests that array class names are correctly converted to internal form.
+ * Tests that array class names are correctly converted to internal form.
*/
public void testArrayInternalForm() {
- assertEquals("[B", _cache.getInternalForm(byte[].class.getName(), false));
- assertEquals("[B", _cache.getInternalForm(byte[].class.getName(), true));
+ assertEquals("[B", _cache.getInternalForm
+ (byte[].class.getName(), false));
+ assertEquals("[B", _cache.getInternalForm
+ (byte[].class.getName(), true));
assertEquals("[B", _cache.getInternalForm("byte[]", false));
assertEquals("[B", _cache.getInternalForm("byte[]", true));
- assertEquals("[[Ljava/lang/Object;",
- _cache.getInternalForm(Object[][].class.getName(), false));
- assertEquals("[[Ljava/lang/Object;",
- _cache.getInternalForm(Object[][].class.getName(), true));
- assertEquals("[[Ljava/lang/Object;",
- _cache.getInternalForm("java.lang.Object[][]", false));
- assertEquals("[[Ljava/lang/Object;",
- _cache.getInternalForm("java.lang.Object[][]", true));
+ assertEquals("[[Ljava/lang/Object;", _cache.getInternalForm
+ (Object[][].class.getName(), false));
+ assertEquals("[[Ljava/lang/Object;", _cache.getInternalForm
+ (Object[][].class.getName(), true));
+ assertEquals("[[Ljava/lang/Object;", _cache.getInternalForm
+ ("java.lang.Object[][]", false));
+ assertEquals("[[Ljava/lang/Object;", _cache.getInternalForm
+ ("java.lang.Object[][]", true));
}
/**
- * Tests that class names are correctly converted to external form.
+ * Tests that class names are correctly converted to external form.
*/
public void testExternalForm() {
assertEquals("byte", _cache.getExternalForm("B", true));
@@ -120,70 +117,69 @@
assertEquals("[S", _cache.getExternalForm("short[]", false));
assertEquals("[Z", _cache.getExternalForm("boolean[]", false));
- assertEquals("java.lang.Object",
- _cache.getExternalForm("java.lang.Object", true));
- assertEquals("java.lang.Object",
- _cache.getExternalForm("java/lang/Object", true));
- assertEquals("java.lang.Object",
- _cache.getExternalForm("java/lang/Object", false));
- assertEquals("java.lang.Object",
- _cache.getExternalForm("Ljava/lang/Object;", false));
+ assertEquals("java.lang.Object", _cache.getExternalForm
+ ("java.lang.Object", true));
+ assertEquals("java.lang.Object", _cache.getExternalForm
+ ("java/lang/Object", true));
+ assertEquals("java.lang.Object", _cache.getExternalForm
+ ("java/lang/Object", false));
+ assertEquals("java.lang.Object", _cache.getExternalForm
+ ("Ljava/lang/Object;", false));
}
/**
- * Tests that array class names are correctly converted to external form.
+ * Tests that array class names are correctly converted to external form.
*/
public void testArrayExternalForm() {
assertEquals("byte[]", _cache.getExternalForm("byte[]", true));
- assertEquals("byte[]",
- _cache.getExternalForm(byte[].class.getName(), true));
+ assertEquals("byte[]", _cache.getExternalForm
+ (byte[].class.getName(), true));
assertEquals("[B", _cache.getExternalForm("byte[]", false));
- assertEquals("[B", _cache.getExternalForm(byte[].class.getName(), false));
+ assertEquals("[B", _cache.getExternalForm
+ (byte[].class.getName(), false));
- assertEquals("java.lang.Object[][]",
- _cache.getExternalForm("java.lang.Object[][]", true));
- assertEquals("java.lang.Object[][]",
- _cache.getExternalForm(Object[][].class.getName(), true));
- assertEquals("[[Ljava.lang.Object;",
- _cache.getExternalForm("java.lang.Object[][]", false));
- assertEquals("[[Ljava.lang.Object;",
- _cache.getExternalForm(Object[][].class.getName(), false));
+ assertEquals("java.lang.Object[][]", _cache.getExternalForm
+ ("java.lang.Object[][]", true));
+ assertEquals("java.lang.Object[][]", _cache.getExternalForm
+ (Object[][].class.getName(), true));
+ assertEquals("[[Ljava.lang.Object;", _cache.getExternalForm
+ ("java.lang.Object[][]", false));
+ assertEquals("[[Ljava.lang.Object;", _cache.getExternalForm
+ (Object[][].class.getName(), false));
}
/**
- * Tests that method descriptors are correctly formed.
+ * Tests that method descriptors are correctly formed.
*/
public void testDescriptors() {
assertEquals("()V", _cache.getDescriptor("V", new String[0]));
assertEquals("()V", _cache.getDescriptor("void", null));
- assertEquals("()Ljava/lang/Object;",
- _cache.getDescriptor("java.lang.Object", null));
- assertEquals("(Z)V",
- _cache.getDescriptor("void", new String[] { "boolean" }));
- assertEquals("([ZLjava/lang/Object;I)[I",
- _cache.getDescriptor("int[]",
- new String[] { "[Z", "Ljava/lang/Object;", "int" }));
+ assertEquals("()Ljava/lang/Object;", _cache.getDescriptor
+ ("java.lang.Object", null));
+ assertEquals("(Z)V", _cache.getDescriptor
+ ("void", new String[] { "boolean" }));
+ assertEquals("([ZLjava/lang/Object;I)[I", _cache.getDescriptor
+ ("int[]", new String[] { "[Z", "Ljava/lang/Object;", "int" }));
}
/**
- * Test that return types are extracted from method descriptors.
+ * Test that return types are extracted from method descriptors.
*/
public void testDescriptorReturnName() {
assertEquals("", _cache.getDescriptorReturnName("foo"));
assertEquals("V", _cache.getDescriptorReturnName("()V"));
- assertEquals("[Ljava/lang/Object;",
- _cache.getDescriptorReturnName(
- "(IZLjava/lang/String;)[Ljava/lang/Object;"));
+ assertEquals("[Ljava/lang/Object;", _cache.getDescriptorReturnName
+ ("(IZLjava/lang/String;)[Ljava/lang/Object;"));
}
/**
- * Test that param types are extracted from method descriptors.
+ * Test that param types are extracted from method descriptors.
*/
public void testDescriptorParamNames() {
assertEquals(0, _cache.getDescriptorParamNames("foo").length);
- String[] params = _cache.getDescriptorParamNames(
- "([ZLjava/lang/Object;I)[I");
+ String[] params = _cache.getDescriptorParamNames
+ ("([ZLjava/lang/Object;I)[I");
assertEquals(3, params.length);
assertEquals("[Z", params[0]);
assertEquals("Ljava/lang/Object;", params[1]);
@@ -191,7 +187,7 @@
}
/**
- * Test {@link NameCache#getComponentTypeName}.
+ * Test {@link NameCache#getComponentTypeName}.
*/
public void testComponentTypes() {
assertNull(_cache.getComponentName(null));
Modified: incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestPrimitive.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestPrimitive.java?rev=418401&r1=418400&r2=418401&view=diff
==============================================================================
--- incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestPrimitive.java (original)
+++ incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestPrimitive.java Fri Jun 30 15:37:18 2006
@@ -1,13 +1,10 @@
/*
* Copyright 2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed 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
+ * 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
@@ -16,14 +13,12 @@
package serp.bytecode;
import junit.framework.*;
-
import junit.textui.*;
-
/**
- * <p>Tests the handling of primitive {@link BCClass}es.</p>
- *
- * @author Abe White
+ * Tests the handling of primitive {@link BCClass}es.
+ *
+ * @author Abe White
*/
public class TestPrimitive extends AbstractStateTest {
public TestPrimitive(String test) {
@@ -39,7 +34,6 @@
assertNull(_bc.getPackageName());
assertEquals("int", _bc.getClassName());
assertEquals(int.class, _bc.getType());
-
try {
_bc.setName("long");
fail("Allowed set name");
@@ -52,7 +46,6 @@
public void testSuperclass() {
assertNull(_bc.getSuperclassName());
-
try {
_bc.setSuperclass("long");
fail("Allowed set superclass");
Modified: incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestProject.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestProject.java?rev=418401&r1=418400&r2=418401&view=diff
==============================================================================
--- incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestProject.java (original)
+++ incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestProject.java Fri Jun 30 15:37:18 2006
@@ -1,13 +1,10 @@
/*
* Copyright 2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed 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
+ * 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
@@ -15,17 +12,14 @@
*/
package serp.bytecode;
+import java.io.*;
import junit.framework.*;
-
import junit.textui.*;
-import java.io.*;
-
-
/**
- * <p>Tests the {@link Project} type.</p>
- *
- * @author Abe White
+ * Tests the {@link Project} type.
+ *
+ * @author Abe White
*/
public class TestProject extends TestCase {
private Project _project = new Project();
@@ -35,7 +29,7 @@
}
/**
- * Test the project name.
+ * Test the project name.
*/
public void testName() {
assertNull(_project.getName());
@@ -44,19 +38,15 @@
}
/**
- * Test loading classes by name.
+ * Test loading classes by name.
*/
public void testLoadByName() {
- BCClass bc;
- BCClass bc2;
- String[] names;
- String[] names2;
+ BCClass bc, bc2;
+ String[] names, names2;
// test primitive types
- names = new String[] {
- "boolean", "byte", "char", "double", "float", "int", "long",
- "short", "void"
- };
+ names = new String[] { "boolean", "byte", "char", "double", "float",
+ "int", "long", "short", "void" };
names2 = new String[] { "Z", "B", "C", "D", "F", "I", "J", "S", "V" };
for (int i = 0; i < names.length; i++) {
@@ -68,11 +58,9 @@
}
// test primitive array types
- names = new String[] {
- "boolean[]", "byte[]", "char[]", "double[]", "float[]", "int[]",
- "long[]", "short[]"
- };
- names2 = new String[] { "[Z", "[B", "[C", "[D", "[F", "[I", "[J", "[S" };
+ names = new String[] { "boolean[]", "byte[]", "char[]", "double[]",
+ "float[]", "int[]", "long[]", "short[]" };
+ names2 = new String[] { "[Z", "[B", "[C", "[D", "[F", "[I", "[J", "[S"};
for (int i = 0; i < names.length; i++) {
bc = _project.loadClass(names[i]);
@@ -115,19 +103,17 @@
}
/**
- * Test loading classes by type.
+ * Test loading classes by type.
*/
public void testLoadByType() {
- BCClass bc;
- BCClass bc2;
+ BCClass bc, bc2;
Class[] types;
String[] names;
// test primitive types
- types = new Class[] {
- boolean.class, byte.class, char.class, double.class, float.class,
- int.class, long.class, short.class, void.class
- };
+ types = new Class[] { boolean.class, byte.class, char.class,
+ double.class, float.class, int.class, long.class, short.class,
+ void.class };
names = new String[] { "Z", "B", "C", "D", "F", "I", "J", "S", "V" };
for (int i = 0; i < names.length; i++) {
@@ -139,11 +125,10 @@
}
// test primitive array types
- types = new Class[] {
- boolean[].class, byte[].class, char[].class, double[].class,
- float[].class, int[].class, long[].class, short[].class,
- };
- names = new String[] { "[Z", "[B", "[C", "[D", "[F", "[I", "[J", "[S" };
+ types = new Class[] { boolean[].class, byte[].class, char[].class,
+ double[].class, float[].class, int[].class, long[].class,
+ short[].class, };
+ names = new String[] { "[Z", "[B", "[C", "[D", "[F", "[I", "[J", "[S"};
for (int i = 0; i < names.length; i++) {
bc = _project.loadClass(types[i]);
@@ -171,11 +156,11 @@
}
/**
- * Test loading classes by file.
+ * Test loading classes by file.
*/
public void testLoadByFile() {
- File file = new File(getClass().getResource("TestProject.class")
- .getFile());
+ File file = new File(getClass().getResource
+ ("TestProject.class").getFile());
BCClass bc = _project.loadClass(file);
BCClass bc2 = _project.loadClass(file);
@@ -187,7 +172,7 @@
}
/**
- * Test loading classes by stream.
+ * Test loading classes by stream.
*/
public void testLoadByStream() {
InputStream in = getClass().getResourceAsStream("TestProject.class");
@@ -203,7 +188,7 @@
}
/**
- * Test retrieving all loaded classes.
+ * Test retrieving all loaded classes.
*/
public void testGetClasses() {
BCClass[] bcs = _project.getClasses();
@@ -218,21 +203,18 @@
assertEquals(3, bcs.length);
int matches;
-
for (int i = 0; i < added.length; i++) {
matches = 0;
-
for (int j = 0; j < bcs.length; j++)
- if (added[i] == bcs[j]) {
+ if (added[i] == bcs[j])
matches++;
- }
assertEquals(1, matches);
}
}
/**
- * Test renaming classes within the project.
+ * Test renaming classes within the project.
*/
public void testRename() {
BCClass str = _project.loadClass(String.class);
@@ -248,7 +230,6 @@
fail("Set to existing name");
} catch (IllegalStateException ise) {
}
-
assertEquals("java.lang.String2", str.getName());
try {
@@ -256,7 +237,6 @@
fail("Set to existing name");
} catch (IllegalStateException ise) {
}
-
assertEquals("serp.Foo2", foo.getName());
str.setName("serp.Foo");
@@ -270,7 +250,7 @@
}
/**
- * Test clearing classes.
+ * Test clearing classes.
*/
public void testClear() {
_project.clear();
@@ -294,7 +274,7 @@
}
/**
- * Test removing a class.
+ * Test removing a class.
*/
public void testRemove() {
assertTrue(!_project.removeClass((String) null));
Modified: incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestStoreInstruction.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestStoreInstruction.java?rev=418401&r1=418400&r2=418401&view=diff
==============================================================================
--- incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestStoreInstruction.java (original)
+++ incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/TestStoreInstruction.java Fri Jun 30 15:37:18 2006
@@ -1,13 +1,10 @@
/*
* Copyright 2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed 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
+ * 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
@@ -16,14 +13,12 @@
package serp.bytecode;
import junit.framework.*;
-
import junit.textui.*;
-
/**
- * <p>Tests the {@link StoreInstruction} type.</p>
- *
- * @author Abe White
+ * Tests the {@link StoreInstruction} type.
+ *
+ * @author Abe White
*/
public class TestStoreInstruction extends TestCase {
private Code _code = new Code();
@@ -33,7 +28,7 @@
}
/**
- * Test that the instruction intitializes correctly when generated.
+ * Test that the instruction intitializes correctly when generated.
*/
public void testInitialize() {
assertEquals(Constants.NOP, _code.xstore().getOpcode());
@@ -51,7 +46,7 @@
}
/**
- * Test that the instruction returns its type correctly.
+ * Test that the instruction returns its type correctly.
*/
public void testGetType() {
StoreInstruction ins = _code.xstore();
@@ -95,8 +90,8 @@
}
/**
- * Test that the opcode is morphed correctly when the type and local
- * of the instruction are changed.
+ * Test that the opcode is morphed correctly when the type and local
+ * of the instruction are changed.
*/
public void testOpcodeMorph() {
StoreInstruction ins = _code.xstore();