[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: VFS Memory Deserialization
kabir.khan@jboss.com
do-not-reply at jboss.com
Tue Aug 12 13:49:00 EDT 2008
The following little test that I wrote to see how this fails works for me
| package org.jboss.test.deployers.vfs.memory;
|
| import java.net.URL;
| import java.rmi.MarshalledObject;
| import java.util.Collections;
| import java.util.List;
|
| import org.jboss.deployers.vfs.plugins.vfs.VirtualFileSerializator;
| import org.jboss.test.BaseTestCase;
| import org.jboss.virtual.MemoryFileFactory;
| import org.jboss.virtual.VFS;
| import org.jboss.virtual.VirtualFile;
|
| /**
| *
| * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
| * @version $Revision: 1.1 $
| */
| public class MemoryTestCase extends BaseTestCase
| {
|
| public MemoryTestCase(String name)
| {
| super(name);
| }
|
| public void testSerialize() throws Exception
| {
| URL url = new URL("vfsmemory://aopdomain/org/acme/test/Test.class");
| MemoryFileFactory.createRoot(new URL("vfsmemory://aopdomain"));
|
| MemoryFileFactory.putFile(url, new byte[] {'a', 'b', 'c'});
| VirtualFile classFile = VFS.getVirtualFile(new URL("vfsmemory://aopdomain"), "org/acme/test/Test.class");
|
| assertNotNull(classFile);
|
| VirtualFileSerializator saved = VirtualFileSerializator.toVirtualFileSerializators(Collections.singletonList(classFile)).get(0);
| MarshalledObject mo = new MarshalledObject(saved);
|
| VirtualFileSerializator loaded = (VirtualFileSerializator)mo.get();
| VirtualFile loadedFile = loaded.getFile();
|
| assertNotNull(loadedFile);
| assertEquals(classFile, loadedFile);
| }
|
| protected void setUp() throws Exception
| {
| VFS.init();
| super.setUp();
| getLog().info("java.protocol.handler.pkgs: " + System.getProperty("java.protocol.handler.pkgs"));
| }
|
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4170131#4170131
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4170131
More information about the jboss-dev-forums
mailing list