コード例 #1
0
 /**
  * Converts a profile with options.
  *
  * @throws Exception if failed
  */
 @Test
 public void convert_options() throws Exception {
   ProcessProfile profile =
       profile(
           KEY_RETRY_COUNT,
           "10",
           KEY_RETRY_INTERVAL,
           "1000",
           KEY_COMPONENT,
           DummyProcess.class.getName(),
           PREFIX_COMPONENT + "hello1",
           "world1",
           PREFIX_COMPONENT + "hello2",
           "world2",
           PREFIX_COMPONENT + "hello3",
           "world3");
   RetryableProcessProfile result = RetryableProcessProfile.convert(profile);
   assertThat(result.getRetryCount(), is(10));
   assertThat(result.getRetryInterval(), is(1000L));
   assertThat(result.getComponent(), instanceOf(DummyProcess.class));
   ProcessProfile inner = ((DummyProcess) result.getComponent()).inner;
   assertThat(inner.getName(), is(not(profile.getName())));
   assertThat(
       inner.getConfiguration(),
       is(
           map(
               "hello1", "world1",
               "hello2", "world2",
               "hello3", "world3")));
 }
コード例 #2
0
 /**
  * Converts simple profile.
  *
  * @throws Exception if failed
  */
 @Test
 public void convert_simple() throws Exception {
   ProcessProfile profile =
       profile(KEY_RETRY_COUNT, "1", KEY_COMPONENT, DummyProcess.class.getName());
   RetryableProcessProfile result = RetryableProcessProfile.convert(profile);
   assertThat(result.getRetryCount(), is(1));
   assertThat(result.getRetryInterval(), is(DEFAULT_RETRY_INTERVAL));
   assertThat(result.getComponent(), instanceOf(DummyProcess.class));
   ProcessProfile inner = ((DummyProcess) result.getComponent()).inner;
   assertThat(inner.getName(), is(not(profile.getName())));
   assertThat(inner.getConfiguration(), is(map()));
 }