예제 #1
0
 /** Setup */
 @BeforeClass
 public static void setUpClass() throws Exception {
   serverNode = new SgsTestNode("TestScalableHashSet", null, null);
   txnScheduler = serverNode.getSystemRegistry().getComponent(TransactionScheduler.class);
   taskOwner = serverNode.getProxy().getCurrentOwner();
   dataService = serverNode.getDataService();
 }
 private void doTestRead(boolean detectMods) throws Exception {
   Properties props = getNodeProps();
   props.setProperty(DataServiceImplClass + ".detect.modifications", String.valueOf(detectMods));
   props.setProperty("com.sun.sgs.txn.timeout", "10000");
   serverNode = new SgsTestNode("TestDataServicePerformance", null, props);
   final DataService service = serverNode.getDataService();
   TransactionScheduler txnScheduler =
       serverNode.getSystemRegistry().getComponent(TransactionScheduler.class);
   Identity taskOwner = serverNode.getProxy().getCurrentOwner();
   txnScheduler.runTask(
       new AbstractKernelRunnable() {
         public void run() {
           service.setBinding("counters", new Counters(items));
         }
       },
       taskOwner);
   for (int r = 0; r < repeat; r++) {
     long start = System.currentTimeMillis();
     for (int c = 0; c < count; c++) {
       txnScheduler.runTask(
           new AbstractKernelRunnable() {
             public void run() throws Exception {
               Counters counters = (Counters) service.getBinding("counters");
               for (int i = 0; i < items; i++) {
                 counters.get(i);
               }
             }
           },
           taskOwner);
     }
     long stop = System.currentTimeMillis();
     System.err.println("Time: " + (stop - start) / (float) count + " ms per transaction");
   }
 }
  /** Test management. */
  @Before
  public void startup() throws Exception {
    Properties properties =
        SgsTestNode.getDefaultProperties("TestAccessCoordinatorImpl", null, null);

    properties.setProperty("com.sun.sgs.finalService", "DataService");
    properties.setProperty("com.sun.sgs.txn.timeout", "1000000");

    serverNode = new SgsTestNode("TestAccessCoordinatorImpl", null, properties);

    taskOwner = serverNode.getProxy().getCurrentOwner();
    txnScheduler = serverNode.getSystemRegistry().getComponent(TransactionScheduler.class);
    dataService = serverNode.getDataService();

    accessCoordinator = serverNode.getSystemRegistry().getComponent(AccessCoordinator.class);
  }
 protected void setUp(Properties props) throws Exception {
   serverNode = new SgsTestNode(APP_NAME, null, props);
   profileCollector = getCollector(serverNode);
   systemRegistry = serverNode.getSystemRegistry();
   txnScheduler = systemRegistry.getComponent(TransactionScheduler.class);
   taskOwner = serverNode.getProxy().getCurrentOwner();
 }
예제 #5
0
 public void testConstructorNullLoggerWrapper() {
   try {
     new DummyService(serviceProps, serverNode.getSystemRegistry(), serverNode.getProxy(), null);
     fail("expected NullPointerException");
   } catch (NullPointerException e) {
     System.err.println(e);
   }
 }
예제 #6
0
 public void testConstructorNullProperties() {
   try {
     new DummyService(null, serverNode.getSystemRegistry(), serverNode.getProxy(), logger);
     fail("expected NullPointerException");
   } catch (NullPointerException e) {
     System.err.println(e);
   }
 }
예제 #7
0
 private DummyService createDummyService() {
   return new DummyService(
       serviceProps, serverNode.getSystemRegistry(), serverNode.getProxy(), logger);
 }
 /** Returns the profile collector for a given node */
 private ProfileCollector getCollector(SgsTestNode node) throws Exception {
   return node.getSystemRegistry().getComponent(ProfileCollector.class);
 }