public void setUp() throws Exception {
   mockInitializer = mock(Initializer.class);
   mockPropertyManager = mock(PropertyManager.class);
   mockNotificationDispatcher = mock(NotificationDispatcher.class);
   mockTransactionRegistryManager = mock(TransactionRegistryManager.class);
   mockTransactionParticipantManager = mock(TransactionParticipantManager.class);
   mockTransactionSynchronizationRegistry = mock(TransactionSynchronizationRegistry.class);
   BeanContext.set(getModule() + ".initializer", mockInitializer);
   BeanContext.set(getModule() + ".propertyManager", mockPropertyManager);
   BeanContext.set(getDomain() + ".notificationDispatcher", mockNotificationDispatcher);
   BeanContext.set(getDomain() + ".jaxbSessionCache", new JAXBSessionCache(getDomain()));
   if (getMockServiceContext() != null)
     FieldUtil.setFieldValue(
         getMockServiceContext(), "transactionRegistryManager", mockTransactionRegistryManager);
   when(mockPropertyManager.get("aries.port.rmi")).thenReturn("1098");
   MBeanServer mbeanServer = MBeanServerFactory.createMBeanServer();
   MBeanUtil.setMBeanServer(mbeanServer);
   setGlobalTransactionActive(false);
   super.setUp();
 }
Beispiel #2
0
  // TODO rename runtime location to tempFileLocation
  public void initializePropertyManager() throws Exception {
    // Establish working location
    if (workingLocation == null) workingLocation = DEFAULT_WORKING_LOCATION;
    workingLocation = FileUtil.normalizePath(workingLocation);
    log.info("Application working Location: " + workingLocation);

    // Establish application home
    Assert.notNull(applicationHome, "Application home location must be specified");
    applicationHome = FileUtil.normalizePath(applicationHome);
    log.info("Application home location: " + applicationHome);

    // Establish runtime location
    // if (runtimeLocation == null)
    runtimeLocation = applicationHome;
    runtimeLocation = FileUtil.normalizePath(runtimeLocation);
    log.info("Application runtime location: " + runtimeLocation);

    // Establish cache location
    // if (cacheLocation == null)
    cacheLocation = applicationHome + "/cache";
    cacheLocation = FileUtil.normalizePath(cacheLocation);
    log.info("Application cache location: " + cacheLocation);

    // Establish property location
    propertyLocation = establishGlobalPropertyLocation(applicationHome);
    log.info("Application runtime property Location: " + propertyLocation);
    propertyLocation = FileUtil.normalizePath(propertyLocation);

    //		File sourceLocation = new File(runtimeLocation + "/model");
    //		Set<String> subFolders = ImportUtil.getImportedFileFolders(sourceLocation);
    //		Iterator<String> iterator = subFolders.iterator();
    //		while (iterator.hasNext()) {
    //			String subFolder = iterator.next();
    //			PropertyInitializer propertyInitializer = new PropertyInitializer();
    //			propertyInitializer.setRuntimeLocation(runtimeLocation);
    //			propertyInitializer.setWorkingLocation(workingLocation);
    //			propertyInitializer.setPropertyLocation(propertyLocation);
    //			if (!subFolder.startsWith("/model"))
    //				subFolder = "/model" + subFolder;
    //			propertyInitializer.setSubFolder(subFolder);
    //			propertyInitializer.initialize();
    //
    //		}

    // TODO establish source and target property locations per module
    PropertyInitializer propertyInitializer = new PropertyInitializer();
    propertyInitializer.setRuntimeLocation(runtimeLocation);
    propertyInitializer.setWorkingLocation(workingLocation);
    propertyInitializer.setPropertyLocation(propertyLocation);
    propertyInitializer.initialize();

    String propertyManagerKey = getModuleName() + ".propertyManager";
    PropertyManager propertyManager = BeanContext.get(propertyManagerKey);
    if (propertyManager == null) propertyManager = new PropertyManager();
    // BeanContext.set("org.aries.propertyManager", propertyManager);
    BeanContext.set(propertyManagerKey, propertyManager);
    propertyManager.setPropertyLocation(propertyLocation);
    propertyManager.initialize();

    Object object1 = propertyManager.get("bookshop2.shipper.transport");
    Object object2 = propertyManager.get("bookshop2.supplier.transport");
    System.out.println();

    //		ServletContext servletContext = RuntimeContext.getInstance().getServletContext();
    //		if (servletContext != null) {
    //			propertyInitializer.initialize(servletContext);
    //		} else {
    //			propertyInitializer.initialize();
    //		}
  }
Beispiel #3
0
 @Create
 public void start() throws Exception {
   PropertyManager.getInstance().initialize();
   display.setModule("main");
   reset();
 }
Beispiel #4
0
 public boolean isTesting() {
   boolean value = PropertyManager.getInstance().getBoolean("aries.testing");
   return value;
 }