/**
   *
   *
   * <ul>
   *   <li><code>"OnewayRequest"="true"</code> client header
   *   <li>Calling {@link ITestService#addTestPojo(TestPojo)} which returns <code>void</code> and is
   *       annotated with {@link Oneway}.
   * </ul>
   */
  @Test
  public void witHeaderOnewayVoidMethod() {
    final ITestService client = createJmsClient(true);
    final TestPojo testPojo = createTestPojo(123);

    client.addTestPojoOneWayReturnsVoid(testPojo);
    assertThat(WebClient.client(client).getResponse().getStatus(), is(202));
  }
  /**
   *
   *
   * <ul>
   *   <li>No <code>"OnewayRequest"</code> client header
   *   <li>Calling {@link ITestService#addTestPojo(TestPojo)} which returns <code>void</code> and is
   *       <b>not</b> annotated with {@link Oneway}.
   * </ul>
   *
   * Note: i guess receiving 204 is fine here. Still, the client has to wait until the server
   * implementation returned in order to receive this response.
   */
  @Test
  public void withoutHeaderTwowayVoidMethod() {
    final ITestService client = createJmsClient(false);
    final TestPojo testPojo = createTestPojo(123);

    client.addTestPojoReturnsVoid(testPojo);
    assertThat(WebClient.client(client).getResponse().getStatus(), is(204));
  }
  /**
   * I would call this the "normal" scenario. Works nicely, but is not what i think we need.
   *
   * <ul>
   *   <li>No <code>"OnewayRequest"</code> client header
   *   <li>Calling {@link ITestService#addTestPojoOneWay(TestPojo)} which returns a {@link Response}
   *       and is annotated with {@link Oneway}.
   * </ul>
   */
  @Test
  public void withoutHeaderOnewayResponseMethod() {
    final ITestService client = createJmsClient(false);
    final TestPojo testPojo = createTestPojo(123);

    final Response response = client.addTestPojoOneWay(testPojo);
    assertThat(response.getStatus(), is(202));
    assertThat(WebClient.client(client).getResponse(), is(response));
  }
  /**
   *
   *
   * <ul>
   *   <li><code>"OnewayRequest"="true"</code> client header
   *   <li>Calling {@link ITestService#addTestPojo(TestPojo)} which returns a {@link Response} and
   *       is <b>not</b> annotated with {@link Oneway}.
   *   <li>I think it's ok that this doesn't work, because the client header is inconsistent with
   *       the annotation.
   * </ul>
   *
   * Note: one has to wait 60 seconds before this one fails with a timeout. I tried setting the
   * timeout in the JMS-config but probably I set the wrong property.
   */
  @Test
  @Ignore
  public void withHeaderTwowayResponseMethod() {
    final ITestService client = createJmsClient(true);
    final TestPojo testPojo = createTestPojo(123);

    final Response response = client.addTestPojo(testPojo);
    assertThat(response.getStatus(), is(202));
    assertThat(WebClient.client(client).getResponse(), is(response));
  }
Example #5
0
  @Ignore
  @Test
  public void testDeleteTestInDatabase() {
    boolean result;
    boolean expected = true;

    result =
        testService.deleteTest(
            factoryTest.create("TestServiceTest", "TestDescription", "Y", "Y", null));

    Assert.assertEquals(expected, result);
  }
Example #6
0
  @Test
  public void testServiceIsInvisibleDuringConstruction() {
    ServiceTracker<ITestService> tracker =
        new ServiceTracker<ITestService>(ITestService.class) {
          private static final long serialVersionUID = 1L;

          @Override
          protected void onServiceAdded(ITestService service, String name) {
            service.test();
          }
        };
    context.registerTracker(tracker, "service.test");

    JavaPluginConfig config = new JavaPluginConfig("test");
    config.put("plugin.class", TestSubclassingPlugin.class.getName());
    JavaClusterConfig cluster = new JavaClusterConfig();
    cluster.addPlugin(config);
    IClusterControl control = context.newCluster(cluster, new JavaPluginConfig());
    control.start();

    ITestService testService = context.getService("service.test", ITestService.class);
    assertNotNull(testService);
    testService.test();
  }