Ejemplo n.º 1
0
 public <V> Collection<V> createNew() {
   if (config.getValueCollectionType().equals(MultiMapConfig.ValueCollectionType.SET)) {
     return new HashSet<V>(10);
   } else if (config.getValueCollectionType().equals(MultiMapConfig.ValueCollectionType.LIST)) {
     return new LinkedList<V>();
   }
   throw new IllegalArgumentException("No Matching CollectionProxyType!");
 }
 private Collection<MultiMapRecord> createCollection(Collection<MultiMapRecord> coll) {
   if (config.getValueCollectionType().equals(MultiMapConfig.ValueCollectionType.SET)) {
     return new HashSet<MultiMapRecord>(coll);
   } else if (config.getValueCollectionType().equals(MultiMapConfig.ValueCollectionType.LIST)) {
     return new ArrayList<MultiMapRecord>(coll);
   }
   return null;
 }
 private Collection<Data> createCollection(int size) {
   final MultiMapConfig config = getClientEngine().getConfig().findMultiMapConfig(name);
   if (config.getValueCollectionType().equals(MultiMapConfig.ValueCollectionType.SET)) {
     return new HashSet<Data>(size);
   } else if (config.getValueCollectionType().equals(MultiMapConfig.ValueCollectionType.LIST)) {
     return new ArrayList<Data>(size);
   }
   return null;
 }
 @Test
 public void testMultimapConfig() {
   MultiMapConfig testMultiMapConfig = config.getMultiMapConfig("testMultimap");
   assertEquals(
       MultiMapConfig.ValueCollectionType.LIST, testMultiMapConfig.getValueCollectionType());
   assertEquals(2, testMultiMapConfig.getEntryListenerConfigs().size());
   for (EntryListenerConfig listener : testMultiMapConfig.getEntryListenerConfigs()) {
     if (listener.getClassName() != null) {
       assertNull(listener.getImplementation());
       assertTrue(listener.isIncludeValue());
       assertFalse(listener.isLocal());
     } else {
       assertNotNull(listener.getImplementation());
       assertEquals(entryListener, listener.getImplementation());
       assertTrue(listener.isLocal());
       assertTrue(listener.isIncludeValue());
     }
   }
 }