Package com.opengamma.engine.cache

Examples of com.opengamma.engine.cache.RemoteFudgeMessageStore


    InMemoryViewComputationCacheSource cache = new InMemoryViewComputationCacheSource(s_fudgeContext);
    ViewComputationCacheServer server = new ViewComputationCacheServer(cache);
    DirectFudgeConnection conduit = new DirectFudgeConnection(cache.getFudgeContext());
    conduit.connectEnd2(server);
    RemoteCacheClient client = new RemoteCacheClient(conduit.getEnd1());
    FudgeMessageStore dataStore = new RemoteFudgeMessageStore(client, new ViewComputationCacheKey(UniqueId.of("Test", "ViewCycle1"), "Config1"));

    // Single value
    final MutableFudgeMsg inputValue1 = s_fudgeContext.newMessage();
    for (int i = 0; i < 32; i++) {
      inputValue1.add(i, Integer.toString(i));
    }
    long identifier1 = 1L;
    dataStore.put(identifier1, inputValue1);

    FudgeMsg outputValue = dataStore.get(identifier1);
    assertNotNull(outputValue);
    assertEquals(inputValue1.getAllFields(), outputValue.getAllFields());

    outputValue = dataStore.get(identifier1 + 1);
    assertNull(outputValue);

    outputValue = dataStore.get(identifier1);
    assertNotNull(outputValue);
    assertEquals(inputValue1.getAllFields(), outputValue.getAllFields());

    // Multiple value
    final MutableFudgeMsg inputValue2 = s_fudgeContext.newMessage();
    for (int i = 32; i < 64; i++) {
      inputValue2.add(i, Integer.toString(i));
    }
    final Map<Long, FudgeMsg> inputMap = new HashMap<Long, FudgeMsg>();
    identifier1++;
    long identifier2 = identifier1 + 1;
    inputMap.put(identifier1, inputValue1);
    inputMap.put(identifier2, inputValue2);
    dataStore.put(inputMap);

    final Map<Long, FudgeMsg> outputMap = dataStore.get(Arrays.asList(identifier1, identifier2));
    assertEquals(2, outputMap.size());
    assertEquals(inputValue1.getAllFields(), outputMap.get(identifier1).getAllFields());
    assertEquals(inputValue2.getAllFields(), outputMap.get(identifier2).getAllFields());
  }
View Full Code Here


    InMemoryViewComputationCacheSource cache = new InMemoryViewComputationCacheSource(s_fudgeContext);
    ViewComputationCacheServer server = new ViewComputationCacheServer(cache);
    DirectFudgeConnection conduit = new DirectFudgeConnection(cache.getFudgeContext());
    conduit.connectEnd2(server);
    RemoteCacheClient client = new RemoteCacheClient(conduit.getEnd1());
    FudgeMessageStore dataStore = new RemoteFudgeMessageStore(client, new ViewComputationCacheKey(
        UniqueId.of("Test", "ViewCycle1"), "Config1"));
    final MutableFudgeMsg inputValue = s_fudgeContext.newMessage();
    for (int i = 0; i < 32; i++) {
      inputValue.add(i, Integer.toString(i));
    }
    final long identifier = 1L;
    dataStore.put(identifier, inputValue);

    FudgeMsg outputValue = dataStore.get(identifier);
    assertNotNull(outputValue);
    assertEquals(inputValue.getAllFields(), outputValue.getAllFields());

    dataStore.delete();

    outputValue = dataStore.get(identifier);
    assertNull(outputValue);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.engine.cache.RemoteFudgeMessageStore

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.