Esempio n. 1
0
  @Test
  public void shouldIgnoreMotherFormsWithoutXmlns() {
    Map<String, String> motherFormValuesWithoutXmlns =
        motherFormValues(
            "94d5374f-290e-409f-bc57-86c2e4bcc43f", "89fda0284e008d2e0c980fb13fa0e5bb");
    motherFormValuesWithoutXmlns.remove("xmlns");

    try {
      careService.processAndSaveForms(
          motherFormValuesWithoutXmlns, new ArrayList<Map<String, String>>());
    } catch (Exception e) {
      fail("The exception should not have been thrown: " + e.getMessage());
    }
  }
  @AfterClass
  public static void removeProcessDefinitions() {
    LOG.debug("cleanup...");

    final ApplicationContext appCtx = Registry.getGlobalApplicationContext();

    assertTrue(
        "Application context of type "
            + appCtx.getClass()
            + " is not a subclass of "
            + ConfigurableApplicationContext.class,
        appCtx instanceof ConfigurableApplicationContext);

    final ConfigurableApplicationContext applicationContext =
        (ConfigurableApplicationContext) appCtx;
    final ConfigurableListableBeanFactory beanFactory = applicationContext.getBeanFactory();
    assertTrue(
        "Bean Factory of type "
            + beanFactory.getClass()
            + " is not of type "
            + BeanDefinitionRegistry.class,
        beanFactory instanceof BeanDefinitionRegistry);
    final XmlBeanDefinitionReader xmlReader =
        new XmlBeanDefinitionReader((BeanDefinitionRegistry) beanFactory);
    xmlReader.loadBeanDefinitions(
        new ClassPathResource(
            "/merchandisefulfilmentprocess/test/merchandisefulfilmentprocess-spring-testcleanup.xml"));

    // cleanup command factory
    final Map<String, CommandFactory> commandFactoryList =
        applicationContext.getBeansOfType(CommandFactory.class);
    commandFactoryList.remove("mockupCommandFactory");
    final DefaultCommandFactoryRegistryImpl commandFactoryReg =
        appCtx.getBean(DefaultCommandFactoryRegistryImpl.class);
    commandFactoryReg.setCommandFactoryList(commandFactoryList.values());

    //		if (definitonFactory != null)
    //		{
    // TODO this test seems to let processes run after method completion - therefore we cannot
    // remove definitions !!!
    //			definitonFactory.remove("testPlaceorder");
    //			definitonFactory.remove("testConsignmentFulfilmentSubprocess");
    //		}
    processService.setTaskService(appCtx.getBean(DefaultTaskService.class));
    definitonFactory = null;
    processService = null;
  }