private void validateConfiguration ( ArquillianDescriptor desc ) { Object defaultConfig = null ; // verify only one container is marked as default for ( ContainerDef container : desc . getContainers ( ) ) { if ( container . isDefault ( ) ) { if ( defaultConfig != null ) { throw new IllegalStateException ( "Multiple Containers defined as default, only one is allowed:\n" + defaultConfig + ":" + container ) ; } defaultConfig = container ; } } boolean containerMarkedAsDefault = defaultConfig != null ; // verify only one container or group is marked as default for ( GroupDef group : desc . getGroups ( ) ) { if ( group . isGroupDefault ( ) ) { if ( defaultConfig != null ) { if ( containerMarkedAsDefault ) { throw new IllegalStateException ( "Multiple Containers/Groups defined as default, only one is allowed:\n" + defaultConfig + ":" + group ) ; } throw new IllegalStateException ( "Multiple Groups defined as default, only one is allowed:\n" + defaultConfig + ":" + group ) ; } defaultConfig = group ; } ContainerDef defaultInGroup = null ; // verify only one container in group is marked as default for ( ContainerDef container : group . getGroupContainers ( ) ) { if ( container . isDefault ( ) ) { if ( defaultInGroup != null ) { throw new IllegalStateException ( "Multiple Containers within Group defined as default, only one is allowed:\n" + group ) ; } defaultInGroup = container ; } } } }
Validate that the Configuration given is sane