コード例 #1
0
 ProfileBuilder(File working) {
   this.asakusaHome = new File(working, "asakusa");
   this.lockDir = new File(working, "lock");
   this.trackingId = ExecutionTracker.Id.get("testing");
   this.replacement = new HashMap<String, String>();
   this.replacement.put("home", asakusaHome.getAbsolutePath());
   this.replacement.put("scope", ExecutionLock.Scope.WORLD.getSymbol());
   this.replacement.put("locker", BasicLockProvider.class.getName());
   this.replacement.put("monitor", BasicMonitorProvider.class.getName());
   this.replacement.put("lock", lockDir.getAbsolutePath());
   this.replacement.put("tracker", SerialExecutionTracker.class.getName());
   this.replacement.put("id", "testing");
   this.override = new Properties();
   SerialExecutionTracker.clear();
 }
コード例 #2
0
  @Override
  protected void doConfigure(
      ServiceProfile<?> profile,
      Map<String, String> desiredProperties,
      Map<String, String> desiredEnvironmentVariables)
      throws InterruptedException, IOException {
    Map<String, String> conf = profile.getConfiguration();
    String trackerClassName = conf.get(ExecutionTracker.KEY_CLASS);
    String trackingId = conf.get(ExecutionTracker.KEY_ID);

    assertThat(trackerClassName, is(notNullValue()));
    assertThat(trackingId, is(notNullValue()));

    try {
      Class<?> trackerClass = profile.getContext().getClassLoader().loadClass(trackerClassName);
      this.tracker = trackerClass.asSubclass(ExecutionTracker.class).newInstance();
      this.id = ExecutionTracker.Id.get(trackingId);
    } catch (Exception e) {
      throw new AssertionError(e);
    }
  }