@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);
  }
Esempio n. 2
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);
  }