Package com.kurento.tool.rom.test.model.client

Examples of com.kurento.tool.rom.test.model.client.SampleClass


  public void useRom(JsonRpcClient client) {

    RemoteObjectTypedFactory factory = new RemoteObjectTypedFactory(
        new RemoteObjectFactory(new RomClientJsonRpcClient(client)));

    SampleClass obj = factory.getFactory(SampleClass.Factory.class)
        .create("XXX", false).withAtt3(0.5f).withAtt4(22).build();

    for (int i = 0; i < 5; i++) {

      assertEquals(obj.getAtt1(), "XXX");
      assertFalse(obj.getAtt2());
      assertEquals(obj.getAtt3(), 0.5f, 0.01);
      assertEquals(obj.getAtt4(), 22);

      assertEquals(SampleEnum.CONSTANT_1,
          obj.echoEnum(SampleEnum.CONSTANT_1));

      ComplexParam returnValue = obj.echoRegister(new ComplexParam(
          "prop1", 33));

      assertEquals(returnValue.getProp1(), "prop1");
      assertEquals(returnValue.getProp2(), 33);

      List<SampleEnum> result = obj.echoListEnum(Arrays.asList(
          SampleEnum.CONSTANT_1, SampleEnum.CONSTANT_2));

      assertEquals(SampleEnum.CONSTANT_1, result.get(0));
      assertEquals(SampleEnum.CONSTANT_2, result.get(1));

      List<ComplexParam> params = new ArrayList<>();
      params.add(new ComplexParam("prop1_1", 33));
      params.add(new ComplexParam("prop1_2", 44));

      List<ComplexParam> returnParams = obj.echoListRegister(params);

      ComplexParam value1 = returnParams.get(0);
      ComplexParam value2 = returnParams.get(1);

      assertEquals(value1.getProp1(), "prop1_1");
View Full Code Here


  }

  @Test
  public void objectRefTest() {

    SampleClass obj = factory.getFactory(SampleClass.Factory.class)
        .create("AAA", false).withAtt3(0.5f).withAtt4(22).build();

    SampleClass obj2 = factory.getFactory(SampleClass.Factory.class)
        .create("BBB", false).withAtt3(0.5f).withAtt4(22).build();

    SampleClass obj3 = obj.echoObjectRef(obj2);

    assertEquals(obj3.getAtt1(), obj2.getAtt1());
    assertEquals(obj3.getAtt2(), obj2.getAtt2());
  }
View Full Code Here

  }

  @Test
  public void objectRefTestAsync() throws InterruptedException {

    SampleClass obj = factory.getFactory(SampleClass.Factory.class)
        .create("AAA", false).withAtt3(0.5f).withAtt4(22).build();

    final SampleClass obj2 = factory.getFactory(SampleClass.Factory.class)
        .create("BBB", false).withAtt3(0.5f).withAtt4(22).build();

    final BlockingQueue<SampleClass> queue = new ArrayBlockingQueue<>(1);

    obj.echoObjectRef(obj2, new Continuation<SampleClass>() {

      @Override
      public void onSuccess(SampleClass obj3) {
        queue.add(obj3);
      }

      @Override
      public void onError(Throwable cause) {

      }
    });

    SampleClass obj3 = queue.poll(10000, MILLISECONDS);

    Assert.assertNotNull(obj3);

    assertEquals(obj3.getAtt1(), obj2.getAtt1());
    assertEquals(obj3.getAtt2(), obj2.getAtt2());
  }
View Full Code Here

TOP

Related Classes of com.kurento.tool.rom.test.model.client.SampleClass

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.