@Before
  public void setUp() throws Exception {
    // Bootstrap WELD container
    StartMain startMain = new StartMain(new String[0]);
    beanManager = startMain.go().getBeanManager();

    // Instantiate Paths used in tests for Path conversion
    final Bean pathsBean = (Bean) beanManager.getBeans(Paths.class).iterator().next();
    final CreationalContext cc = beanManager.createCreationalContext(pathsBean);
    paths = (Paths) beanManager.getReference(pathsBean, Paths.class, cc);

    // Ensure URLs use the default:// scheme
    fs.forceAsDefault();
  }
  @Before
  public void setUp() throws Exception {
    // Bootstrap WELD container
    StartMain startMain = new StartMain(new String[0]);
    beanManager = startMain.go().getBeanManager();

    // Instantiate Paths used in tests for Path conversion
    final Bean pathsBean = (Bean) beanManager.getBeans(Paths.class).iterator().next();
    final CreationalContext cc1 = beanManager.createCreationalContext(pathsBean);
    paths = (Paths) beanManager.getReference(pathsBean, Paths.class, cc1);

    // Instantiate ConfigurationService
    final Bean configurationServiceBean =
        (Bean) beanManager.getBeans(ConfigurationService.class).iterator().next();
    final CreationalContext cc2 = beanManager.createCreationalContext(configurationServiceBean);
    configurationService =
        (ConfigurationService)
            beanManager.getReference(configurationServiceBean, ConfigurationService.class, cc2);

    // Instantiate ConfigurationFactory
    final Bean configurationFactoryBean =
        (Bean) beanManager.getBeans(ConfigurationFactory.class).iterator().next();
    final CreationalContext cc3 = beanManager.createCreationalContext(configurationFactoryBean);
    configurationFactory =
        (ConfigurationFactory)
            beanManager.getReference(configurationFactoryBean, ConfigurationFactory.class, cc3);

    // Instantiate BuildResultsObserver
    final Bean buildResultsObserverBean =
        (Bean) beanManager.getBeans(BuildResultsObserver.class).iterator().next();
    final CreationalContext cc4 = beanManager.createCreationalContext(buildResultsObserverBean);
    buildResultsObserver =
        (BuildResultsObserver)
            beanManager.getReference(buildResultsObserverBean, BuildResultsObserver.class, cc4);

    // Instantiate BuildService
    final Bean buildServiceBean = (Bean) beanManager.getBeans(BuildService.class).iterator().next();
    final CreationalContext cc5 = beanManager.createCreationalContext(buildServiceBean);
    buildService =
        (BuildService) beanManager.getReference(buildServiceBean, BuildService.class, cc5);

    // Instantiate ProjectService
    final Bean projectServiceBean =
        (Bean) beanManager.getBeans(KieProjectService.class).iterator().next();
    final CreationalContext cc6 = beanManager.createCreationalContext(projectServiceBean);
    projectService =
        (KieProjectService)
            beanManager.getReference(projectServiceBean, KieProjectService.class, cc6);

    // Define mandatory properties
    List<ConfigGroup> globalConfigGroups = configurationService.getConfiguration(ConfigType.GLOBAL);
    boolean globalSettingsDefined = false;
    for (ConfigGroup globalConfigGroup : globalConfigGroups) {
      if (GLOBAL_SETTINGS.equals(globalConfigGroup.getName())) {
        globalSettingsDefined = true;
        break;
      }
    }
    if (!globalSettingsDefined) {
      configurationService.addConfiguration(getGlobalConfiguration());
    }
  }
示例#3
0
 /** Transfers control to ApplicationMain */
 public void init(String[] args) {
   super.main(args);
 }