@Test(expected = DaemonInitException.class)
  public void shouldThrowOnInitIfInvalidClassProvided() throws Exception {
    // given
    when(daemonContext.getArguments()).thenReturn(new String[] {"java.lang.String"});

    // when
    jobWorkerDaemon.init(daemonContext);
  }
  @Test
  public void shouldInitializeDefaultConfiguration() throws Exception {
    // given
    when(daemonContext.getArguments()).thenReturn(new String[0]);

    // when
    jobWorkerDaemon.init(daemonContext);
  }
  @Test(expected = DaemonInitException.class)
  public void shouldThrowOnInitIfNonExistentClassProvided() throws Exception {
    // given
    when(daemonContext.getArguments()).thenReturn(new String[] {"non-existent-class"});

    // when
    jobWorkerDaemon.init(daemonContext);
  }
Пример #4
0
 @Override
 public void init(DaemonContext dc) throws DaemonInitException {
   s_logger.debug("Initializing AgentShell from JSVC");
   try {
     init(dc.getArguments());
   } catch (ConfigurationException ex) {
     throw new DaemonInitException("Initialization failed", ex);
   }
 }
  @Test
  public void shouldLoadThirdPartyConfiguration() throws Exception {
    // given
    when(daemonContext.getArguments())
        .thenReturn(
            new String[] {
              "com.amazonaws.codepipeline.jobworker.configuration.ThirdPartyJobWorkerConfiguration"
            });

    // when
    jobWorkerDaemon.init(daemonContext);
  }