コード例 #1
0
  public void testEvent() {
    AppUtil appUtil = new AppUtil();
    AI a = (AI) appUtil.getService("producer");
    TestEvent te = a.ma();
    long start = System.currentTimeMillis();
    while (te.getResult() != 100) {}
    long stop = System.currentTimeMillis();

    Assert.assertEquals(te.getResult(), 100);
    System.out.print("ok " + "  " + (stop - start) + "\n");
  }
コード例 #2
0
 public void testCommand() {
   AppUtil appUtil = new AppUtil();
   AComponentIF a = (AComponentIF) appUtil.getComponentInstance("producerforCommand");
   BModel bModel = new BModel("one");
   TestCommand testCommand = a.ma(bModel);
   long start = System.currentTimeMillis();
   while (testCommand.getOutput() != 199) {}
   long stop = System.currentTimeMillis();
   Assert.assertEquals(testCommand.getOutput(), 199);
   System.out.print("ok " + "  " + (stop - start) + "\n");
 }
コード例 #3
0
  public void testCQRS() {
    AppUtil appUtil = new AppUtil();
    AService service = (AService) appUtil.getComponentInstance("aService");
    AggregateRootA aggregateRootA = service.getAggregateRootA("11");
    DomainMessage res = service.commandA("11", aggregateRootA, 100);

    long start = System.currentTimeMillis();
    int result = 0;
    DomainMessage res1 = (DomainMessage) res.getBlockEventResult();
    if (res1.getBlockEventResult() != null) result = (Integer) res1.getBlockEventResult();

    long stop = System.currentTimeMillis();
    Assert.assertEquals(result, 400);
    System.out.print("\n test CQRS ok \n" + result + " " + (stop - start));
  }
コード例 #4
0
  public void testDCIDomainEvent() {

    IServiceSampleTwo serviceSample = (IServiceSampleTwo) appUtil.getService("serviceSampleTwo");
    String res = (String) serviceSample.nameFinderContext();
    System.out.print(res);
    Assert.assertEquals(res, "Asynchronous eventMessage=100");
  }
コード例 #5
0
  public void testDomainEventSimple() {

    IServiceSampleTwo serviceSample = (IServiceSampleTwo) appUtil.getService("serviceSampleTwo");
    String res = (String) serviceSample.eventPointEntry();
    System.out.print(res);
    Assert.assertEquals(res, "Synchronous sayHello and Asynchronous eventMessage=100");
  }
コード例 #6
0
  /** @param args */
  public static void main(String[] args) {
    AppUtil appUtil = new AppUtil();
    ModelCacheManager modelCacheManager =
        (ModelCacheManager) appUtil.getComponentInstance("modelCacheManager");
    MyModel myModel = new MyModel();
    myModel.setId(new Long(123));
    myModel.setName("test");
    modelCacheManager.saveCache(myModel.getId(), MyModel.class.getName(), myModel);
    if (modelCacheManager.containInCache(myModel.getId(), MyModel.class.getName()))
      System.out.print("ok");
    else System.out.print("no");

    ModelManager modelManager = (ModelManager) appUtil.getComponentInstance("modelManager");
    ModelKey modelKey = new ModelKey(myModel.getId(), MyModel.class);
    if (modelManager.containInCache(modelKey)) System.out.print("ok");
    else System.out.print("no");
  }
コード例 #7
0
  public void testDomainEvent() {

    IServiceSample serviceSample = (IServiceSample) appUtil.getService("serviceSample");
    Assert.assertEquals("hello", serviceSample.eventPointEntry("hello"));
  }
コード例 #8
0
 public void testGetService() {
   BInterface b = (BInterface) appUtil.getService("b");
   Assert.assertEquals(b.bMethod(1), 10);
 }
コード例 #9
0
 public void testXml() {
   BBI bb = (BBI) appUtil.getService("bb");
   Assert.assertEquals(bb.myDo(), 99);
 }
コード例 #10
0
 protected void tearDown() throws Exception {
   super.tearDown();
   appUtil.clear();
 }
コード例 #11
0
  public void testComponentsEvent() {

    AI a = (AI) appUtil.getService("producer");
    a.ma();
  }
コード例 #12
0
  public void testOnEvent() {

    IServiceSampleTwo serviceSample = (IServiceSampleTwo) appUtil.getService("serviceSampleTwo");
    serviceSample.onEventTest();
    Assert.assertTrue(true);
  }