org.jboss.osgi.testing
Class OSGiTestHelper

java.lang.Object
  extended by org.jboss.osgi.testing.OSGiTestHelper
Direct Known Subclasses:
OSGiRuntimeHelper

public class OSGiTestHelper
extends Object

An OSGi Test Helper

Since:
25-Sep-2008
Author:
Thomas.Diesler@jboss.org

Field Summary
static String SYSPROP_TEST_ARCHIVE_DIRECTORY
           
static String SYSPROP_TEST_RESOURCES_DIRECTORY
           
 
Constructor Summary
OSGiTestHelper()
           
 
Method Summary
 org.jboss.shrinkwrap.api.spec.JavaArchive assembleArchive(String name, String[] resources, Class<?>... packages)
           
 org.jboss.shrinkwrap.api.spec.JavaArchive assembleArchive(String name, String resource, Class<?>... packages)
           
 void assertBundleState(int expState, int wasState)
           
 Class<?> assertLoadClass(org.osgi.framework.Bundle bundle, String className)
           
 void assertLoadClass(org.osgi.framework.Bundle bundle, String className, org.osgi.framework.Bundle exporter)
           
 void assertLoadClassFail(org.osgi.framework.Bundle bundle, String className)
           
 String getFrameworkName()
           
 InitialContext getInitialContext()
           
 File getResourceFile(String resource)
          Try to discover the File for the test resource
 URL getResourceURL(String resource)
          Try to discover the URL for the test resource
 String getServerHost()
           
 String getTargetContainer()
           
 File getTestArchiveFile(String archive)
          Try to discover the File for the deployment archive
 String getTestArchivePath(String archive)
          Try to discover the absolute path for the deployment archive
 URL getTestArchiveURL(String archive)
          Try to discover the URL for the deployment archive
static InputStream toInputStream(org.jboss.shrinkwrap.api.Archive<?> archive)
           
static org.jboss.osgi.vfs.VirtualFile toVirtualFile(org.jboss.shrinkwrap.api.Archive<?> archive)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SYSPROP_TEST_RESOURCES_DIRECTORY

public static final String SYSPROP_TEST_RESOURCES_DIRECTORY
See Also:
Constant Field Values

SYSPROP_TEST_ARCHIVE_DIRECTORY

public static final String SYSPROP_TEST_ARCHIVE_DIRECTORY
See Also:
Constant Field Values
Constructor Detail

OSGiTestHelper

public OSGiTestHelper()
Method Detail

getResourceURL

public URL getResourceURL(String resource)
Try to discover the URL for the test resource


getResourceFile

public File getResourceFile(String resource)
Try to discover the File for the test resource


getTestArchiveURL

public URL getTestArchiveURL(String archive)
Try to discover the URL for the deployment archive


getTestArchivePath

public String getTestArchivePath(String archive)
Try to discover the absolute path for the deployment archive


getTestArchiveFile

public File getTestArchiveFile(String archive)
Try to discover the File for the deployment archive


getInitialContext

public InitialContext getInitialContext()
                                 throws NamingException
Throws:
NamingException

getServerHost

public String getServerHost()

getTargetContainer

public String getTargetContainer()

getFrameworkName

public String getFrameworkName()

assembleArchive

public org.jboss.shrinkwrap.api.spec.JavaArchive assembleArchive(String name,
                                                                 String resource,
                                                                 Class<?>... packages)
                                                          throws Exception
Throws:
Exception

assembleArchive

public org.jboss.shrinkwrap.api.spec.JavaArchive assembleArchive(String name,
                                                                 String[] resources,
                                                                 Class<?>... packages)
                                                          throws IOException
Throws:
IOException

toVirtualFile

public static org.jboss.osgi.vfs.VirtualFile toVirtualFile(org.jboss.shrinkwrap.api.Archive<?> archive)
                                                    throws IOException,
                                                           MalformedURLException
Throws:
IOException
MalformedURLException

toInputStream

public static InputStream toInputStream(org.jboss.shrinkwrap.api.Archive<?> archive)
                                 throws IOException
Throws:
IOException

assertBundleState

public void assertBundleState(int expState,
                              int wasState)

assertLoadClass

public Class<?> assertLoadClass(org.osgi.framework.Bundle bundle,
                                String className)

assertLoadClassFail

public void assertLoadClassFail(org.osgi.framework.Bundle bundle,
                                String className)

assertLoadClass

public void assertLoadClass(org.osgi.framework.Bundle bundle,
                            String className,
                            org.osgi.framework.Bundle exporter)


Copyright © 2010. All Rights Reserved.