@Test
  public void apiWrapperEnhancementTest1() throws Exception {

    ProjectDescriptor project = new ProjectDescriptor();
    project.setClasspath(new ArrayList<PathEntry>());
    project.setProjectFolder(new File("test/resources/excel/"));
    Module module = new Module();
    module.setProject(project);
    module.setRulesRootPath(new PathEntry("test/resources/excel/Rules.xls"));
    module.setClassname("MyTestClass");

    ApiBasedInstantiationStrategy strategy = new ApiBasedInstantiationStrategy(module, false, null);

    RuntimeContextInstantiationStrategyEnhancer enhancer =
        new RuntimeContextInstantiationStrategyEnhancer(strategy);
    Class<?> serviceClass = enhancer.getServiceClass();
    Object instance = enhancer.instantiate();

    IRulesRuntimeContext context = RulesRuntimeContextFactory.buildRulesRuntimeContext();
    context.setCountry(CountriesEnum.US);
    Method method =
        serviceClass.getMethod("hello1", new Class<?>[] {IRulesRuntimeContext.class, int.class});
    Object result = method.invoke(instance, new Object[] {context, 10});

    assertEquals("Good Morning, World!", (String) result);

    context.setCountry(CountriesEnum.RU);
    result = method.invoke(instance, new Object[] {context, 22});

    assertEquals("(RU) Good Night, World!", (String) result);
  }
  private synchronized void initDependencyLoaders() {
    if (projectDescriptors == null && dependencyLoaders == null) {
      dependencyLoaders = new ArrayList<IDependencyLoader>();
      projectDescriptors = new ArrayList<ProjectDescriptor>();
      dependencyNames = new HashSet<String>();
      Collection<Deployment> deployments = ruleServiceLoader.getDeployments();
      for (Deployment deployment : deployments) {
        String deploymentName = deployment.getDeploymentName();
        CommonVersion deploymentVersion = deployment.getCommonVersion();
        if (deploymentDescription.getName().equals(deploymentName)
            && deploymentDescription.getVersion().equals(deploymentVersion)) {
          for (AProject project : deployment.getProjects()) {
            String projectName = project.getName();
            try {
              Collection<Module> modulesOfProject =
                  ruleServiceLoader.resolveModulesForProject(
                      deploymentName, deploymentVersion, projectName);
              ProjectDescriptor projectDescriptor = null;
              Set<String> wildcardPatterns = new HashSet<String>();
              if (!modulesOfProject.isEmpty()) {
                Module firstModule = modulesOfProject.iterator().next();
                projectDescriptor = firstModule.getProject();

                InputStream content = null;
                RulesDeploy rulesDeploy = null;
                try {
                  AProjectArtefact artifact =
                      project.getArtefact(LastVersionProjectsServiceConfigurer.RULES_DEPLOY_XML);
                  if (artifact instanceof AProjectResource) {
                    AProjectResource resource = (AProjectResource) artifact;
                    content = resource.getContent();
                    rulesDeploy = getRulesDeploySerializer().deserialize(content);
                    RulesDeploy.WildcardPattern[] compilationPatterns =
                        rulesDeploy.getLazyModulesForCompilationPatterns();
                    if (compilationPatterns != null) {
                      for (RulesDeploy.WildcardPattern wp : compilationPatterns) {
                        wildcardPatterns.add(wp.getValue());
                      }
                    }
                  }
                } catch (ProjectException e) {
                } finally {
                  if (content != null) {
                    try {
                      content.close();
                    } catch (IOException e) {
                      log.error(e.getMessage(), e);
                    }
                  }
                }

                for (Module m : modulesOfProject) {
                  IDependencyLoader moduleLoader;
                  String moduleName = m.getName();
                  List<Module> module = Arrays.asList(m);
                  if (isLazy()) {
                    boolean compileAfterLazyCompilation =
                        compilationAfterLazyCompilationRequred(wildcardPatterns, moduleName);
                    moduleLoader =
                        new LazyRuleServiceDependencyLoader(
                            deploymentDescription, moduleName, module, compileAfterLazyCompilation);
                  } else {
                    moduleLoader = new RuleServiceDependencyLoader(moduleName, module);
                  }
                  dependencyLoaders.add(moduleLoader);
                  dependencyNames.add(moduleName);
                }
              }
              if (projectDescriptor != null) {
                IDependencyLoader projectLoader;
                if (isLazy()) {
                  projectLoader =
                      new LazyRuleServiceDependencyLoader(
                          deploymentDescription,
                          ProjectExternalDependenciesHelper.buildDependencyNameForProjectName(
                              projectDescriptor.getName()),
                          projectDescriptor.getModules(),
                          false);
                } else {
                  projectLoader =
                      new RuleServiceDependencyLoader(
                          ProjectExternalDependenciesHelper.buildDependencyNameForProjectName(
                              projectDescriptor.getName()),
                          projectDescriptor.getModules());
                }
                projectDescriptors.add(projectDescriptor);
                dependencyLoaders.add(projectLoader);
              }
            } catch (Exception e) {
              log.error(
                  "Build dependency manager loaders for project \"{}\" from deployment \"{}\" was failed!",
                  projectName,
                  deploymentName,
                  e);
            }
          }
        }
      }
    }
  }