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

The following examples show how to use org.jboss.arquillian.config.descriptor.api.ExtensionDef. 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: 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 #2
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 #3
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 #4
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 #5
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 #6
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 #7
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 #8
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 #9
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 #10
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 #11
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 #12
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;
}