Package com.sun.sgs.app.util

Examples of com.sun.sgs.app.util.ScalableHashMap$RemoveNodeEntriesTask


    @SuppressWarnings("unchecked")
    @Test public void testContainsValueKeyNotFound() throws Exception {
  txnScheduler.runTask(
      new TestAbstractKernelRunnable() {
    public void run() throws Exception {
        ScalableHashMap test = new ScalableHashMap();
        dataService.setBinding("test", test);
        Bar bar = new Bar(1);
        dataService.setBinding("bar", bar);
        test.put(bar, 1);
        test.put(new Bar(2), 2);
    }
      }, taskOwner);
  txnScheduler.runTask(
      new TestAbstractKernelRunnable() {
    public void run() throws Exception {
        dataService.removeObject(dataService.getBinding("bar"));
        ScalableHashMap test =
      (ScalableHashMap) dataService.getBinding("test");
        assertTrue(test.containsValue(1));
        assertEquals(2, test.size());
    }
      }, taskOwner);
  txnScheduler.runTask(
      new TestAbstractKernelRunnable() {
    public void run() throws Exception {
        ScalableHashMap test =
      (ScalableHashMap) dataService.getBinding("test");
        assertTrue(test.containsValue(1));
        assertEquals(2, test.size());
    }
      }, taskOwner);
    }
View Full Code Here


  final Map control = new HashMap();
  final Set controlKeys = control.keySet();
  txnScheduler.runTask(
      new TestAbstractKernelRunnable() {
    public void run() throws Exception {
        Map test = new ScalableHashMap();
        Set keys = test.keySet();
        assertEquals(controlKeys, keys);
        assertIteratorDone(keys.iterator());
        assertEquals(controlKeys.hashCode(), keys.hashCode());
        for (int i = 0; i < 50; i++) {
      int j = RANDOM.nextInt();
      test.put(j,-j);
      control.put(j,-j);
        }
        assertEquals(controlKeys, keys);
        assertIteratorContains(controlKeys, keys.iterator());
        assertEquals(controlKeys.hashCode(), keys.hashCode());
View Full Code Here

  final Map control = new HashMap();
  final Set controlEntries = control.entrySet();
  txnScheduler.runTask(
      new TestAbstractKernelRunnable() {
    public void run() throws Exception {
        Map test = new ScalableHashMap();
        Set entries = test.entrySet();
        assertEquals(controlEntries, entries);
        assertIteratorDone(entries.iterator());
        assertEquals(controlEntries.hashCode(), entries.hashCode());
        for (int i = 0; i < 50; i++) {
      int j = RANDOM.nextInt();
      test.put(j,-j);
      control.put(j,-j);
        }
        assertEquals(controlEntries, entries);
        assertIteratorContains(controlEntries, entries.iterator());
        assertEquals(controlEntries.hashCode(), entries.hashCode());
View Full Code Here

    @Test public void testEquals() throws Exception {
  final Map control = new HashMap();
  txnScheduler.runTask(
      new TestAbstractKernelRunnable() {
    public void run() throws Exception {
        ScalableHashMap test = new ScalableHashMap();
        assertFalse(test.equals(null));
        assertFalse(test.equals(1));
        assertTrue(test.equals(control));
        assertEquals(test.hashCode(), control.hashCode());
        for (int i = 0; i < 50; i++) {
      int j = RANDOM.nextInt();
      test.put(j,-j);
      control.put(j,-j);
        }
        assertTrue(test.equals(control));
        assertEquals(test.hashCode(), control.hashCode());
        dataService.setBinding("test", test);
    }
      }, taskOwner);
  txnScheduler.runTask(
      new TestAbstractKernelRunnable() {
    public void run() throws Exception {
        ScalableHashMap test =
      (ScalableHashMap) dataService.getBinding("test");
        assertTrue(test.equals(control));
        assertEquals(test.hashCode(), control.hashCode());
    }
      }, taskOwner);
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    @Test public void testRemoveValueNotFound() throws Exception {
  txnScheduler.runTask(
      new TestAbstractKernelRunnable() {
    public void run() throws Exception {
        ScalableHashMap test = new ScalableHashMap();
        dataService.setBinding("test", test);
        Bar bar = new Bar(1);
        dataService.setBinding("bar", bar);
        test.put(1, bar);
    }
      }, taskOwner);
  txnScheduler.runTask(
      new TestAbstractKernelRunnable() {
    public void run() throws Exception {
        dataService.removeObject(dataService.getBinding("bar"));
        ScalableHashMap test =
      (ScalableHashMap) dataService.getBinding("test");
        try {
      test.remove(1);
      fail("Expected ObjectNotFoundException");
        } catch (ObjectNotFoundException e) {
        }
        assertEquals(null, test.remove(2));
    }
      }, taskOwner);
  txnScheduler.runTask(
      new TestAbstractKernelRunnable() {
    public void run() throws Exception {
        ScalableHashMap test =
      (ScalableHashMap) dataService.getBinding("test");
        try {
      test.remove(1);
      fail("Expected ObjectNotFoundException");
        } catch (ObjectNotFoundException e) {
        }
        assertEquals(null, test.remove(2));
    }
      }, taskOwner);
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    @Test public void testRemoveKeyNotFound() throws Exception {
  txnScheduler.runTask(
      new TestAbstractKernelRunnable() {
    public void run() throws Exception {
        ScalableHashMap test = new ScalableHashMap();
        dataService.setBinding("test", test);
        Bar bar = new Bar(1);
        dataService.setBinding("bar", bar);
        test.put(bar, 1);
    }
      }, taskOwner);
  txnScheduler.runTask(
      new TestAbstractKernelRunnable() {
    public void run() throws Exception {
        dataService.removeObject(dataService.getBinding("bar"));
        ScalableHashMap test =
      (ScalableHashMap) dataService.getBinding("test");
        assertEquals(null, test.remove(new Bar(1)));
        assertEquals(null, test.remove(1));
        assertEquals(null, test.remove(new Bar(2)));
    }
      }, taskOwner);
  txnScheduler.runTask(
      new TestAbstractKernelRunnable() {
    public void run() throws Exception {
        ScalableHashMap test =
      (ScalableHashMap) dataService.getBinding("test");
        assertEquals(null, test.remove(new Bar(1)));
        assertEquals(null, test.remove(1));
        assertEquals(null, test.remove(new Bar(2)));
    }
      }, taskOwner);
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    @Test public void testIteratorNotFound() throws Exception {
  txnScheduler.runTask(
      new TestAbstractKernelRunnable() {
    public void run() throws Exception {
        ScalableHashMap test = new ScalableHashMap();
        dataService.setBinding("test", test);
        Bar bar = new Bar(1);
        dataService.setBinding("bar", bar);
        test.put(1, bar);
        test.put(2, new Bar(2));
    }
      }, taskOwner);
  for (int i = 0; i < 2; i++) {
      final int local = i;
      txnScheduler.runTask(
          new TestAbstractKernelRunnable() {
        public void run() throws Exception {
      ScalableHashMap test =
          (ScalableHashMap) dataService.getBinding("test");
      dataService.setBinding("valuesIter",
          new ManagedSerializable(test.values().iterator()));
        }
    }, taskOwner);
      txnScheduler.runTask(
          new TestAbstractKernelRunnable() {
        public void run() throws Exception {
View Full Code Here

TOP

Related Classes of com.sun.sgs.app.util.ScalableHashMap$RemoveNodeEntriesTask

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.