[jboss-cvs] JBossAS SVN: r67233 - in projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/file: support and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sun Nov 18 11:26:21 EST 2007
Author: alesj
Date: 2007-11-18 11:26:21 -0500 (Sun, 18 Nov 2007)
New Revision: 67233
Added:
projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/file/support/
projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/file/support/BshFileMatcher.java
projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/file/support/TmpFileStructure.java
Modified:
projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/file/test/FileMatcherTestCase.java
Log:
File matcher test.
Added: projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/file/support/BshFileMatcher.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/file/support/BshFileMatcher.java (rev 0)
+++ projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/file/support/BshFileMatcher.java 2007-11-18 16:26:21 UTC (rev 67233)
@@ -0,0 +1,47 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.deployers.vfs.structure.file.support;
+
+import java.net.URI;
+
+import org.jboss.deployers.vfs.plugins.structure.file.FileMatcher;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class BshFileMatcher implements FileMatcher
+{
+ public boolean isDeployable(VirtualFile file)
+ {
+ try
+ {
+ URI uri = file.toURI();
+ String toString = uri.toString();
+ return toString.endsWith(".bsh/");
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+}
Added: projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/file/support/TmpFileStructure.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/file/support/TmpFileStructure.java (rev 0)
+++ projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/file/support/TmpFileStructure.java 2007-11-18 16:26:21 UTC (rev 67233)
@@ -0,0 +1,36 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.deployers.vfs.structure.file.support;
+
+import org.jboss.deployers.vfs.plugins.structure.file.FileStructure;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class TmpFileStructure extends FileStructure
+{
+ public boolean checkFileMatchers(VirtualFile file)
+ {
+ return super.checkFileMatchers(file);
+ }
+}
Modified: projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/file/test/FileMatcherTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/file/test/FileMatcherTestCase.java 2007-11-18 15:26:32 UTC (rev 67232)
+++ projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/file/test/FileMatcherTestCase.java 2007-11-18 16:26:21 UTC (rev 67233)
@@ -21,9 +21,22 @@
*/
package org.jboss.test.deployers.vfs.structure.file.test;
+import java.net.URI;
+
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
import org.jboss.test.BaseTestCase;
+import org.jboss.test.deployers.vfs.structure.file.support.BshFileMatcher;
+import org.jboss.test.deployers.vfs.structure.file.support.TmpFileStructure;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
/**
* FileMatcherTestCase.
@@ -44,6 +57,33 @@
public void testMatcher() throws Throwable
{
- // todo
+ BasicBootstrap bootstrap = new BasicBootstrap();
+ bootstrap.run();
+ Kernel kernel = bootstrap.getKernel();
+ KernelController controller = kernel.getController();
+ try
+ {
+ BeanMetaData fsMD = new AbstractBeanMetaData("fileStructure", TmpFileStructure.class.getName());
+ KernelControllerContext fsCC = controller.install(fsMD);
+ assertEquals(fsCC.getState(), ControllerState.INSTALLED);
+ TmpFileStructure fs = (TmpFileStructure)fsCC.getTarget();
+ assertNotNull(fs);
+
+ VirtualFile file = VFS.getRoot(new URI("vfsmemory://somefile.bsh"));
+ assertFalse(fs.checkFileMatchers(file));
+
+ BeanMetaData fmMD = new AbstractBeanMetaData("bshFileMatcher", BshFileMatcher.class.getName());
+ controller.install(fmMD);
+
+ assertTrue(fs.checkFileMatchers(file));
+
+ controller.uninstall(fmMD.getName());
+
+ assertFalse(fs.checkFileMatchers(file));
+ }
+ finally
+ {
+ controller.shutdown();
+ }
}
}
More information about the jboss-cvs-commits
mailing list