org.hibernate.beanvalidation.tck.util.shrinkwrap
Class ArchiveBuilder<T extends ArchiveBuilder<T,A>,A extends org.jboss.shrinkwrap.api.Archive<A>>

java.lang.Object
  extended by org.hibernate.beanvalidation.tck.util.shrinkwrap.ArchiveBuilder<T,A>
Type Parameters:
T - Self type to enable abstract builder pattern
A - Final shrinkwrap archive
Direct Known Subclasses:
WebArchiveBuilder

public abstract class ArchiveBuilder<T extends ArchiveBuilder<T,A>,A extends org.jboss.shrinkwrap.api.Archive<A>>
extends Object

Abstract ShrinkWrap archive builder for Bean Validation TCK Arquillian test.

This is a base class for builders that try to solve most JBoss Test Harness to Arquillian migration issues. The main goal was to use Bean Validation TCK 1.0 tests with minimum code changes.

Author:
Martin Kouba, Hardy Ferentschik

Nested Class Summary
protected  class ArchiveBuilder.ResourceDescriptor
          Internal resource descriptor.
protected  class ArchiveBuilder.ServiceProviderDescriptor
          Internal service provider descriptor.
 
Field Summary
protected  List<String> classes
           
protected  List<String> packages
           
protected  List<ArchiveBuilder.ResourceDescriptor> resources
           
protected  List<ArchiveBuilder.ServiceProviderDescriptor> serviceProviders
           
 
Constructor Summary
ArchiveBuilder()
           
 
Method Summary
 A build()
           
protected abstract  A buildInternal()
           
 String getName()
           
protected  void processClasses(org.jboss.shrinkwrap.api.container.ClassContainer<?> archive)
           
protected  void processPackages(org.jboss.shrinkwrap.api.container.ClassContainer<?> archive)
           
protected  void processResources(org.jboss.shrinkwrap.api.container.ResourceContainer<?> archive)
           
abstract  T self()
           
 T withClass(Class<?> clazz)
           
 T withClasses(Class<?>... classes)
           
abstract  T withEmptyBeansXml()
           
 T withName(String name)
           
 T withPackage(Package pack)
           
 T withResource(String source)
           
 T withResource(String source, boolean useTestPackageToLocateSource)
           
 T withResource(String source, String target, boolean useTestPackageToLocateSource)
           
 T withServiceProvider(ArchiveBuilder.ServiceProviderDescriptor serviceProvider)
           
 T withTestClass(Class<?> testClazz)
          Add test class to archive and set test class definition for configuration purpose.
 T withTestClassDefinition(Class<?> testClazz)
           
 T withTestClassPackage(Class<?> testClazz)
          Add all classes in the test class package to archive and set test class definition for configuration purpose.
 T withValidationXml(String source)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resources

protected List<ArchiveBuilder.ResourceDescriptor> resources

packages

protected List<String> packages

classes

protected List<String> classes

serviceProviders

protected List<ArchiveBuilder.ServiceProviderDescriptor> serviceProviders
Constructor Detail

ArchiveBuilder

public ArchiveBuilder()
Method Detail

withName

public T withName(String name)

withServiceProvider

public T withServiceProvider(ArchiveBuilder.ServiceProviderDescriptor serviceProvider)

withClass

public T withClass(Class<?> clazz)

withClasses

public T withClasses(Class<?>... classes)

withTestClassPackage

public T withTestClassPackage(Class<?> testClazz)
Add all classes in the test class package to archive and set test class definition for configuration purpose.

Parameters:
testClazz - the test class
Returns:
self

withTestClass

public T withTestClass(Class<?> testClazz)
Add test class to archive and set test class definition for configuration purpose.

Parameters:
testClazz - the test class
Returns:
self

withTestClassDefinition

public T withTestClassDefinition(Class<?> testClazz)

withPackage

public T withPackage(Package pack)

withResource

public T withResource(String source)

withResource

public T withResource(String source,
                      boolean useTestPackageToLocateSource)

withResource

public T withResource(String source,
                      String target,
                      boolean useTestPackageToLocateSource)

withValidationXml

public T withValidationXml(String source)

withEmptyBeansXml

public abstract T withEmptyBeansXml()

self

public abstract T self()
Returns:
self to enable generic builder

build

public A build()
Returns:
shrinkwrap archive

buildInternal

protected abstract A buildInternal()
Returns:
concrete shrinkwrap archive

processPackages

protected void processPackages(org.jboss.shrinkwrap.api.container.ClassContainer<?> archive)

processClasses

protected void processClasses(org.jboss.shrinkwrap.api.container.ClassContainer<?> archive)

processResources

protected void processResources(org.jboss.shrinkwrap.api.container.ResourceContainer<?> archive)

getName

public String getName()
Returns:
name of final archive


Copyright © 2008-2013. All Rights Reserved.