/*
* JBoss, Home of Professional Open Source
* Copyright (c) 2010, 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.ejb3.vfs.impl.vfs3;
import org.jboss.ejb3.vfs.impl.vfs3.UnifiedVirtualFileFactoryImpl;
import org.jboss.ejb3.vfs.impl.vfs3.VirtualFileWrapper;
import org.jboss.ejb3.vfs.spi.UnifiedVirtualFileFactory;
import org.jboss.ejb3.vfs.spi.VirtualFile;
import org.jboss.metadata.serviceref.VirtualFileAdaptor;
import org.jboss.test.BaseTestCase;
import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
/**
* TestCase to verify the functionality of the {@link UnifiedVirtualFileFactoryImpl}.
*
* @author John Bailey
*/
public class UnifiedVirtualFileFactoryImplUnitTest extends BaseTestCase
{
public UnifiedVirtualFileFactoryImplUnitTest(String name)
{
super(name);
}
/**
* Test to verify the {@link UnifiedVirtualFileFactory} correctly finds the
* VFS3 impl service reference.
*/
public void testGetInstance() throws Exception
{
final UnifiedVirtualFileFactory factory = UnifiedVirtualFileFactory.getInstance();
assertTrue(factory instanceof UnifiedVirtualFileFactoryImpl);
}
/**
* Test to verify the {@link UnifiedVirtualFileFactory} correctly builds {@link UnifiedVirtualFile}
* instances from a {@link VirtualFile} instance;
*/
public void testCreate() throws Exception
{
final VirtualFile virtualFile = new VirtualFileWrapper(null);
final UnifiedVirtualFile unifiedVirtualFile = UnifiedVirtualFileFactory.getInstance().create(virtualFile);
assertNotNull(unifiedVirtualFile);
assertTrue(unifiedVirtualFile instanceof VirtualFileAdaptor);
}
}