Пример #1
0
 @AfterClass
 public static void tearDownAfterClass() throws IOException {
   clientAssetTree.close();
   serverEndpoint.close();
   serverAssetTree.close();
   TcpChannelHub.closeAllHubs();
   TCPRegistry.reset();
 }
  @After
  public void after() throws IOException {
    assetTree.close();
    if (serverEndpoint != null) serverEndpoint.close();
    serverAssetTree.close();
    if (map instanceof Closeable) ((Closeable) map).close();

    TCPRegistry.reset();
    System.setProperty("Throttler.maxEventsPreSecond", "0");
  }
  @Before
  public void before() throws IOException {
    System.setProperty("Throttler.maxEventsPreSecond", "1");
    serverAssetTree = new VanillaAssetTree().forTesting();

    methodName(name.getMethodName());
    final String hostPort =
        "ThrottledKeySubscriptionEventTest." + name.getMethodName() + ".host.port";
    TCPRegistry.createServerSocketChannelFor(hostPort);

    serverEndpoint = new ServerEndpoint(hostPort, serverAssetTree, WIRE_TYPE);
    assetTree = new VanillaAssetTree().forRemoteAccess(hostPort, WIRE_TYPE);

    map = assetTree.acquireMap(NAME, String.class, String.class);
  }
Пример #4
0
  @BeforeClass
  public static void setUpBeforeClass() throws IOException, URISyntaxException {
    //        YamlLogging.showServerReads = true;
    //        YamlLogging.clientReads = true;

    char[] chars = new char[2 << 20];
    Arrays.fill(chars, '~');
    _twoMbTestString = new String(chars);
    _twoMbTestStringLength = _twoMbTestString.length();

    serverAssetTree = new VanillaAssetTree(1).forTesting();
    // The following line doesn't add anything and breaks subscriptions
    serverAssetTree
        .root()
        .addWrappingRule(
            MapView.class,
            "map directly to KeyValueStore",
            VanillaMapView::new,
            KeyValueStore.class);
    serverAssetTree
        .root()
        .addLeafRule(
            KeyValueStore.class,
            "use Chronicle Map",
            (context, asset) ->
                new ChronicleMapKeyValueStore(
                    context
                        .basePath(OS.TARGET)
                        .entries(_noOfPuts)
                        .averageValueSize(_twoMbTestStringLength),
                    asset));
    TCPRegistry.createServerSocketChannelFor("RemoteSubscriptionModelPerformanceTest.port");
    serverEndpoint =
        new ServerEndpoint(
            "RemoteSubscriptionModelPerformanceTest.port", serverAssetTree, WireType.BINARY);

    clientAssetTree =
        new VanillaAssetTree(13)
            .forRemoteAccess("RemoteSubscriptionModelPerformanceTest.port", WireType.BINARY);
  }