simplified Expression api by not forcing serialization requirement

This commit is contained in:
Keith Donald
2008-07-03 22:29:12 +00:00
parent 29cb51240e
commit d6608b8cc9
15 changed files with 116 additions and 247 deletions

View File

@@ -1,10 +1,5 @@
package org.springframework.binding.expression.el;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -231,26 +226,4 @@ public class ELExpressionParserTests extends TestCase {
};
}
}
public void testSerializeExpression() throws IOException, ClassNotFoundException {
String exp = "value";
Expression e = parser.parseExpression(exp, null);
ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
ObjectOutputStream oos = new ObjectOutputStream(baos);
byte[] bytes = null;
try {
oos.writeObject(e);
oos.flush();
bytes = baos.toByteArray();
} finally {
oos.close();
}
ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bytes));
try {
Expression e2 = (Expression) ois.readObject();
assertEquals(e, e2);
} finally {
ois.close();
}
}
}

View File

@@ -15,12 +15,6 @@
*/
package org.springframework.binding.expression.ognl;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import junit.framework.TestCase;
import org.springframework.binding.expression.Expression;
@@ -167,26 +161,4 @@ public class OgnlExpressionParserTests extends TestCase {
assertEquals(boolean.class, e.getValueType(bean));
}
public void testSerializeExpression() throws IOException, ClassNotFoundException {
String exp = "flag";
Expression e = parser.parseExpression(exp, null);
ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
ObjectOutputStream oos = new ObjectOutputStream(baos);
byte[] bytes = null;
try {
oos.writeObject(e);
oos.flush();
bytes = baos.toByteArray();
} finally {
oos.close();
}
ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bytes));
try {
Expression e2 = (Expression) ois.readObject();
assertEquals(e, e2);
} finally {
ois.close();
}
}
}