org.jboss.arquillian.config.descriptor.api.ArquillianDescriptor Java Examples

The following examples show how to use org.jboss.arquillian.config.descriptor.api.ArquillianDescriptor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SkipperConfigurator.java    From arquillian-governor with Apache License 2.0 6 votes vote down vote up
public void onGovernorExtensionConfigured(@Observes GovernorExtensionConfigured event, ArquillianDescriptor arquillianDescriptor) throws Exception {
    final SkipperConfiguration skipperConfiguration = new SkipperConfiguration();

    for (final ExtensionDef extension : arquillianDescriptor.getExtensions()) {
        if (extension.getExtensionName().equals(EXTENSION_NAME)) {
            skipperConfiguration.setConfiguration(extension.getExtensionProperties());
            skipperConfiguration.validate();
            break;
        }
    }

    this.skipperReportHolder.set(new SkipperReportHolder());
    this.skipperConfiguration.set(skipperConfiguration);

    logger.log(Level.CONFIG, "Configuration of Arquillian Skipper extension:");
    logger.log(Level.CONFIG, skipperConfiguration.toString());
}
 
Example #2
Source File: RegistryCreator.java    From keycloak with Apache License 2.0 6 votes vote down vote up
public void createRegistry(@Observes ArquillianDescriptor event) {
    ContainerRegistry reg = new Registry(injector.get());
    ServiceLoader serviceLoader = loader.get();

    log.info("arquillian.xml: " + System.getProperty("arquillian.xml"));

    @SuppressWarnings("rawtypes")
    Collection<DeployableContainer> containers = serviceLoader.all(DeployableContainer.class);

    if (containers.isEmpty()) {
        throw new IllegalStateException("There are not any container adapters on the classpath");
    }

    List<ContainerDef> containersDefs = event.getContainers();//arquillian.xml
    List<GroupDef> groupDefs = event.getGroups();//arquillian.xml

    addAppServerContainers(containersDefs, groupDefs);//dynamically loaded containers/groups

    createRegistry(containersDefs, reg, serviceLoader);

    for (GroupDef group : groupDefs) {
        createRegistry(group.getGroupContainers(), reg, serviceLoader);
    }

    registry.set(reg);
}
 
Example #3
Source File: ArquillianSuiteExtension.java    From appengine-tck with Apache License 2.0 6 votes vote down vote up
private Class<?> getDeploymentClass(ArquillianDescriptor descriptor) {
    if (descriptor == null) {
        throw new IllegalArgumentException("Descriptor must be specified");
    }
    ExtensionDef suite = descriptor.extension("suite");
    if (suite == null) {
        throw new IllegalArgumentException("Missing suite extension in arquillian.xml");
    }
    String className = suite.getExtensionProperties().get("deploymentClass");
    if (className == null) {
        throw new IllegalArgumentException("A extension element with property deploymentClass must be specified in arquillian.xml");
    }
    try {
        return Class.forName(className);
    } catch (ClassNotFoundException e) {
        throw new RuntimeException("Could not load defined deploymentClass: " + className, e);
    }
}
 
Example #4
Source File: ReporterConfigurator.java    From arquillian-recorder with Apache License 2.0 6 votes vote down vote up
public void configureExtension(@Observes ArquillianDescriptor descriptor) {

        ReporterConfiguration configuration = new ReporterConfiguration();

        for (ExtensionDef extension : descriptor.getExtensions()) {
            if (extension.getExtensionName().equals(EXTENSION_NAME)) {
                configuration.setConfiguration(extension.getExtensionProperties());
                break;
            }
        }

        configuration.validate();

        this.configuration.set(configuration);

        if (LOGGER.isLoggable(Level.INFO)) {
            LOGGER.info("Configuration of Arquillian Reporting extension:");
            LOGGER.info(this.configuration.get().toString());
        }

        extensionConfigured.fire(new ReportingExtensionConfigured());
    }
 
Example #5
Source File: GovernorConfigurator.java    From arquillian-governor with Apache License 2.0 6 votes vote down vote up
public void onArquillianDescriptor(@Observes ArquillianDescriptor arquillianDescriptor) throws GovernorConfigurationException {

        final GovernorConfiguration governorConfiguration = new GovernorConfiguration();

        for (final ExtensionDef extension : arquillianDescriptor.getExtensions()) {
            if (extension.getExtensionName().equals(EXTENSION_NAME)) {
                governorConfiguration.setConfiguration(extension.getExtensionProperties());
                governorConfiguration.validate();
                break;
            }
        }

        this.governorConfiguration.set(governorConfiguration);

        logger.log(Level.CONFIG, "Configuration of Arquillian Governor extension:");
        logger.log(Level.CONFIG, governorConfiguration.toString());

        governorExtensionConfiguredEvent.fire(new GovernorExtensionConfigured());
    }
 
Example #6
Source File: IgnoreObserver.java    From arquillian-governor with Apache License 2.0 6 votes vote down vote up
private Set<String> readMethodsFromConfiguration() {
    final Set<String> set = new HashSet<String>();
    final ArquillianDescriptor descriptor = desciptorInst.get();
    for (final ExtensionDef def : descriptor.getExtensions()) {
        if (def.getExtensionName().equalsIgnoreCase(EXTENSION_NAME)) {
            final Map<String, String> properties = def.getExtensionProperties();

            final String exp = properties.get(EXTENSION_PROPERTY_METHODS);
            if (exp != null) {
                set.addAll(Arrays.asList(exp.split(",")));
            }

            for (final Map.Entry<String, String> entry : properties.entrySet()) {
                if (entry.getKey().startsWith(EXTENSION_PROPERTY_METHODS + "_")) {
                    set.add(entry.getValue());
                }
            }
        }
    }
    return set;
}
 
Example #7
Source File: GitHubGovernorConfigurator.java    From arquillian-governor with Apache License 2.0 6 votes vote down vote up
public void onGovernorExtensionConfigured(@Observes GovernorExtensionConfigured event, ArquillianDescriptor arquillianDescriptor) throws Exception {
    final GitHubGovernorConfiguration gitHubGovernorConfiguration = new GitHubGovernorConfiguration();

    for (final ExtensionDef extension : arquillianDescriptor.getExtensions()) {
        if (extension.getExtensionName().equals(EXTENSION_NAME)) {
            gitHubGovernorConfiguration.setConfiguration(extension.getExtensionProperties());
            gitHubGovernorConfiguration.validate();
            break;
        }
    }

    this.gitHubGovernorConfiguration.set(gitHubGovernorConfiguration);

    final GitHubGovernorClient gitHubGovernorClient = new GitHubGovernorClientFactory().build(this.gitHubGovernorConfiguration.get());

    this.gitHubGovernorClient.set(gitHubGovernorClient);
    this.gitHubClient.set(gitHubGovernorClient.getGitHubClient());

    logger.log(Level.CONFIG, "Configuration of Arquillian GitHub extension:");
    logger.log(Level.CONFIG, gitHubGovernorConfiguration.toString());
}
 
Example #8
Source File: JiraGovernorConfigurator.java    From arquillian-governor with Apache License 2.0 6 votes vote down vote up
public void onGovernorExtensionConfigured(@Observes GovernorExtensionConfigured event, ArquillianDescriptor arquillianDescriptor) throws Exception {
    final JiraGovernorConfiguration jiraGovernorConfiguration = new JiraGovernorConfiguration();

    for (final ExtensionDef extension : arquillianDescriptor.getExtensions()) {
        if (extension.getExtensionName().equals(EXTENSION_NAME)) {
            jiraGovernorConfiguration.setConfiguration(extension.getExtensionProperties());
            jiraGovernorConfiguration.validate();
            break;
        }
    }

    this.jiraGovernorConfiguration.set(jiraGovernorConfiguration);

    final JiraGovernorClient jiraGovernorClient = new JiraGovernorClientFactory().build(this.jiraGovernorConfiguration.get());

    this.jiraGovernorClient.set(jiraGovernorClient);

    logger.log(Level.CONFIG, "Configuration of Arquillian JIRA extension:");
    logger.log(Level.CONFIG, jiraGovernorConfiguration.toString());
}
 
Example #9
Source File: RedmineGovernorConfigurator.java    From arquillian-governor with Apache License 2.0 6 votes vote down vote up
public void onGovernorExtensionConfigured(@Observes GovernorExtensionConfigured event, ArquillianDescriptor arquillianDescriptor) throws Exception {
    final RedmineGovernorConfiguration redmineGovernorConfiguration = new RedmineGovernorConfiguration();

    for (final ExtensionDef extension : arquillianDescriptor.getExtensions()) {
        if (extension.getExtensionName().equals(EXTENSION_NAME)) {
            redmineGovernorConfiguration.setConfiguration(extension.getExtensionProperties());
            break;
        }
    }
    redmineGovernorConfiguration.validate();

    this.redmineGovernorConfiguration.set(redmineGovernorConfiguration);

    final RedmineGovernorClient redmineGovernorClient = new RedmineGovernorClientFactory().build(this.redmineGovernorConfiguration.get());

    this.redmineGovernorClient.set(redmineGovernorClient);
    this.redmineManager.set(redmineGovernorClient.getRedmineManager());

    logger.log(Level.CONFIG, "Configuration of Arquillian Redmine extension:");
    logger.log(Level.CONFIG, this.redmineGovernorConfiguration.get().toString());
}
 
Example #10
Source File: IgnoreObserver.java    From arquillian-governor with Apache License 2.0 5 votes vote down vote up
private String readExpressionFromConfiguration() {
    final ArquillianDescriptor descriptor = desciptorInst.get();
    for (final ExtensionDef def : descriptor.getExtensions()) {
        if (def.getExtensionName().equalsIgnoreCase(EXTENSION_NAME)) {
            final String exp = def.getExtensionProperties().get(EXTENSION_PROPERTY_EXP);
            if (exp != null) {
                return exp;
            }
        }
    }
    return null;
}
 
Example #11
Source File: ReporterLifecycleObserver.java    From arquillian-recorder with Apache License 2.0 5 votes vote down vote up
private void report(org.jboss.arquillian.core.spi.event.Event event, ArquillianDescriptor descriptor) {
    if (shouldReport(event, configuration.get().getReportAfterEvery())) {
        List<ExtensionReport> extensionReports = reporter.get().getReport().getExtensionReports();
        if (extensionReports.isEmpty()) {
            extensionReports.addAll(getExtensionReports(descriptor));
        }

        reporter.get().getLastTestClassReport().setStop(new Date(System.currentTimeMillis()));
        reporter.get().getLastTestSuiteReport().setStop(new Date(System.currentTimeMillis()));

        exportReportEvent.fire(new ExportReport(reporter.get().getReport()));
    }
}
 
Example #12
Source File: ReporterLifecycleObserver.java    From arquillian-recorder with Apache License 2.0 5 votes vote down vote up
private Collection<? extends ExtensionReport> getExtensionReports(ArquillianDescriptor descriptor) {
    List<ExtensionReport> extensionReports = new ArrayList<ExtensionReport>();

    for (ExtensionDef extensionDef : descriptor.getExtensions()) {
        ExtensionReport extensionReport = new ExtensionReport();
        extensionReport.setQualifier(extensionDef.getExtensionName());
        extensionReport.setConfiguration(extensionDef.getExtensionProperties());
        extensionReports.add(extensionReport);
    }
    return extensionReports;
}
 
Example #13
Source File: DesktopVideoRecorderConfigurator.java    From arquillian-recorder with Apache License 2.0 5 votes vote down vote up
public void afterVideoExtensionConfigured(@Observes VideoExtensionConfigured event, ArquillianDescriptor descriptor) {
    VideoConfiguration configuration = new DesktopVideoConfiguration(reporterConfiguration.get());

    for (ExtensionDef extension : descriptor.getExtensions()) {
        if (extension.getExtensionName().equals(EXTENSION_NAME)) {
            configuration.setConfiguration(extension.getExtensionProperties());
            break;
        }
    }

    configuration.validate();
    this.configuration.set(configuration);

    if (LOGGER.isLoggable(Level.INFO)) {
        LOGGER.info("Configuration of Arquillian Desktop Video Recorder:");
        LOGGER.info(this.configuration.get().toString());
    }

    // there will be 2 strategies in this list at least - SkippingVideoStrategy and DefaultVideoStrategy
    // if this extension is not on the class path, SkippingVideoStrategy was already produced hence
    // the extension will work in a "dummy" mode where nothing will be ever recorded. If this is on the class path,
    // we have recorder implementation hence we will use at least DefaultVideoStrategy if no other strategy is used

    List<VideoStrategy> strategies = new ArrayList<VideoStrategy>(serviceLoader.get().all(VideoStrategy.class));

    strategy.set(resolveVideoStrategy(strategies));

    strategy.get().setConfiguration(this.configuration.get());

    setup();
}
 
Example #14
Source File: DeploymentClassFinder.java    From arquillian-suite-extension with Apache License 2.0 5 votes vote down vote up
/**
 * Finds class to be used as global deployment.
 *
 * @param descriptor ArquillianDescriptor
 * @return class to be used as global deployment.
 */
static Class<?> getDeploymentClass(ArquillianDescriptor descriptor) {
    Class<?> deploymentClass = getDeploymentClassFromConfig(descriptor);
    if (deploymentClass == null) {
        deploymentClass = getDeploymentClassFromAnnotation();
    }
    if (deploymentClass == null) {
        log.warning("arquillian-suite-deployment: Cannot find configuration in arquillian.xml, nor class annotated with @ArquillianSuiteDeployment, will try standard way..");
    }
    return deploymentClass;
}
 
Example #15
Source File: DeploymentClassFinder.java    From arquillian-suite-extension with Apache License 2.0 5 votes vote down vote up
/**
 * Finds class with should produce global deployment PER project.
 *
 * @param descriptor ArquillianDescriptor
 * @return class defined in arquillian.xml as deploymentClass
 */
private static Class<?> getDeploymentClassFromConfig(ArquillianDescriptor descriptor) {
    String deploymentClassName = getDeploymentClassNameFromXml(descriptor);

    if (StringUtils.isNotEmpty(deploymentClassName)) {
        try {
            log.log(Level.INFO, "arquillian-suite-deployment: Using deployment class {0} from configuration.", deploymentClassName);
            return Class.forName(deploymentClassName);

        } catch (ClassNotFoundException e) {
            throw new IllegalStateException("Cannot load class " + deploymentClassName + " from configuration.");
        }
    }
    return null;
}
 
Example #16
Source File: ArquillianSuiteExtension.java    From appengine-tck with Apache License 2.0 5 votes vote down vote up
public void startup(@Observes(precedence = -100) ManagerStarted event, ArquillianDescriptor descriptor) {
    deploymentClass = getDeploymentClass(descriptor);

    executeInClassScope(new Callable<Void>() {
        public Void call() throws Exception {
            generateDeploymentEvent.fire(new GenerateDeployment(new TestClass(deploymentClass)));
            suiteDeploymentScenario = classDeploymentScenario.get();
            return null;
        }
    });
}
 
Example #17
Source File: DeploymentClassFinder.java    From arquillian-suite-extension with Apache License 2.0 3 votes vote down vote up
/**
 * Returns name of class witch should be used as global deployment.
 * Extension name used: suite
 * Key: deploymentClass
 *
 * @param descriptor ArquillianDescriptor
 * @return full class name from arquillian.xml
 */
private static String getDeploymentClassNameFromXml(ArquillianDescriptor descriptor) {
    ExtensionDef extension = descriptor.extension("suite");
    if (extension != null) {
        return extension.getExtensionProperties().get("deploymentClass");
    }
    return null;
}
 
Example #18
Source File: SuiteDeployer.java    From arquillian-suite-extension with Apache License 2.0 2 votes vote down vote up
/**
 * Callback for getting notified with configuration data. Here we use the optionally configured deployment class.
 *
 * @param descriptor The arquillian configuration data.
 */
public static void configure(@Observes ArquillianDescriptor descriptor) {
    deploymentClass = getDeploymentClass(descriptor);
}