コード例 #1
0
  @Test
  public void testExecute() throws Exception {
    HashMap<UserOptions, String> configMap = new HashMap<UserOptions, String>();
    configMap.put(UserOptions.DisplayButtons, Boolean.toString(true));
    configMap.put(UserOptions.EditorPageSize, Integer.toString(25));
    configMap.put(UserOptions.EnterSavesApproved, Boolean.toString(true));

    SaveOptionsAction action = new SaveOptionsAction(configMap);

    SaveOptionsResult result = handler.execute(action, null);

    assertThat(result.isSuccess(), Matchers.equalTo(true));
    List<HAccountOption> accountOptions =
        getEm().createQuery("from HAccountOption").getResultList();

    assertThat(accountOptions, Matchers.hasSize(configMap.size()));
    Map<String, HAccountOption> editorOptions = authenticatedAccount.getEditorOptions();

    assertThat(editorOptions.values(), Matchers.containsInAnyOrder(accountOptions.toArray()));

    handler.execute(action, null); // save again should override previous
    // value
    accountOptions = getEm().createQuery("from HAccountOption").getResultList();

    assertThat(accountOptions, Matchers.hasSize(configMap.size()));
    assertThat(editorOptions.values(), Matchers.containsInAnyOrder(accountOptions.toArray()));
  }
コード例 #2
0
  @Test
  public void testImportOnEmptyDb() throws Exception {
    FluentIterable<ComponentCSVRecord> compCSVRecords = getCompCSVRecordsFromTestFile(fileName);

    assertThat(componentClient.getComponentSummary(user), is(empty()));
    assertThat(componentClient.getReleaseSummary(user), is(empty()));

    ComponentImportUtils.writeToDatabase(
        compCSVRecords, componentClient, vendorClient, attachmentClient, user);

    assertExpectedComponentsInDb();

    final String attachmentContentId = getCreatedAttachmentContentId();

    final AttachmentContent overwriter =
        new AttachmentContent()
            .setId(OVERRIDING_ID)
            .setOnlyRemote(true)
            .setRemoteUrl(REMOTE_URL)
            .setType(TYPE_ATTACHMENT);
    final AttachmentContent addition =
        new AttachmentContent()
            .setId(ADDITIONAL_ID)
            .setOnlyRemote(true)
            .setRemoteUrl(REMOTE_URL)
            .setType(TYPE_ATTACHMENT);

    attachmentRepository.add(overwriter);
    attachmentRepository.add(addition);

    assertThat(attachmentRepository.getAll(), Matchers.hasSize(3));
    FluentIterable<ComponentAttachmentCSVRecord> compAttachmentCSVRecords =
        getCompAttachmentCSVRecordsFromTestFile(attachmentsFilename);

    ComponentImportUtils.writeAttachmentsToDatabase(
        compAttachmentCSVRecords, user, componentClient, attachmentClient);

    try {
      attachmentClient.getAttachmentContent(attachmentContentId);
      fail("Expected exception not thrown");
    } catch (Exception e) {
      assertThat(e, is(instanceOf(SW360Exception.class)));
      assertThat(
          ((SW360Exception) e).getWhy(),
          is("Cannot find " + attachmentContentId + " in database."));
    }

    assertThat(attachmentRepository.getAll(), Matchers.hasSize(2));
    final AttachmentContent attachmentContent =
        attachmentClient.getAttachmentContent(getCreatedAttachmentContentId());

    assertThat(attachmentContent, is(overwriter));
  }
コード例 #3
0
ファイル: ProjectWorkspace.java プロジェクト: sdwilsh/buck
  public Map<String, Path> buildMultipleAndReturnOutputs(String... args) throws IOException {
    // Add in `--show-output` to the build, so we can parse the output paths after the fact.
    ImmutableList<String> buildArgs =
        ImmutableList.<String>builder().add("--show-output").add(args).build();
    ProjectWorkspace.ProcessResult buildResult =
        runBuckBuild(buildArgs.toArray(new String[buildArgs.size()]));
    buildResult.assertSuccess();

    // Grab the stdout lines, which have the build outputs.
    List<String> lines =
        Splitter.on(CharMatcher.anyOf(System.lineSeparator()))
            .trimResults()
            .omitEmptyStrings()
            .splitToList(buildResult.getStdout());

    // Skip the first line, which is just "The outputs are:".
    assertThat(lines.get(0), Matchers.equalTo("The outputs are:"));
    lines = lines.subList(1, lines.size());

    Splitter lineSplitter = Splitter.on(' ').trimResults();
    ImmutableMap.Builder<String, Path> builder = ImmutableMap.builder();
    for (String line : lines) {
      List<String> fields = lineSplitter.splitToList(line);
      assertThat(fields, Matchers.hasSize(2));
      builder.put(fields.get(0), getPath(fields.get(1)));
    }

    return builder.build();
  }
コード例 #4
0
 @Test
 public void testCaseInSelect() {
   String queryString = "select case when buch.name = 'nupsi' then 1 else 2 end from Buch buch";
   Query query = em.createQuery(queryString);
   List<Integer> resultList = query.getResultList();
   Assert.assertThat(resultList, Matchers.hasSize(2));
   //        Assert.assertThat(resultList, Matchers.contains(1));
   //        Assert.assertThat(resultList, Matchers.contains(2));
 }
コード例 #5
0
  @Test
  public void listAll() {
    Mockito.when(repository.all(QSampleEntity.sampleEntity, QSampleEntity.sampleEntity))
        .thenReturn(getList());
    List<SampleEntity> list = service.list("");

    Mockito.verify(repository).all(QSampleEntity.sampleEntity, QSampleEntity.sampleEntity);

    MatcherAssert.assertThat(list, Matchers.hasSize(1));
    MatcherAssert.assertThat(list, Matchers.contains(createSampleEntity(ID, null)));
  }
コード例 #6
0
ファイル: ProjectWorkspace.java プロジェクト: sdwilsh/buck
  public Path buildAndReturnOutput(String... args) throws IOException {
    Map<String, Path> outputs = buildMultipleAndReturnOutputs(args);

    // Verify we only have a single output.
    assertThat(
        String.format(
            "expected only a single build target in command `%s`: %s",
            ImmutableList.copyOf(args), outputs),
        outputs.entrySet(),
        Matchers.hasSize(1));

    return outputs.values().iterator().next();
  }
 @Test
 public void testPathMatchingConfiguration() {
   loadBeanDefinitions("mvc-config-path-matching.xml");
   RequestMappingHandlerMapping hm = appContext.getBean(RequestMappingHandlerMapping.class);
   assertNotNull(hm);
   assertTrue(hm.useSuffixPatternMatch());
   assertFalse(hm.useTrailingSlashMatch());
   assertTrue(hm.useRegisteredSuffixPatternMatch());
   assertThat(hm.getUrlPathHelper(), Matchers.instanceOf(TestPathHelper.class));
   assertThat(hm.getPathMatcher(), Matchers.instanceOf(TestPathMatcher.class));
   List<String> fileExtensions = hm.getContentNegotiationManager().getAllFileExtensions();
   assertThat(fileExtensions, Matchers.contains("xml"));
   assertThat(fileExtensions, Matchers.hasSize(1));
 }
コード例 #8
0
  @Test
  public void testImportTwiceIsANoOp() throws Exception {
    FluentIterable<ComponentCSVRecord> compCSVRecords = getCompCSVRecordsFromTestFile(fileName);

    assertThat(componentClient.getComponentSummary(user), hasSize(0));
    assertThat(componentClient.getReleaseSummary(user), hasSize(0));
    assertThat(attachmentRepository.getAll(), Matchers.hasSize(0));

    ComponentImportUtils.writeToDatabase(
        compCSVRecords, componentClient, vendorClient, attachmentClient, user);
    assertThat(attachmentRepository.getAll(), Matchers.hasSize(1));
    List<Component> componentSummaryAfterFirst = componentClient.getComponentSummary(user);
    List<Release> releaseSummaryAfterFirst = componentClient.getReleaseSummary(user);

    assertExpectedComponentsInDb();

    ComponentImportUtils.writeToDatabase(
        compCSVRecords, componentClient, vendorClient, attachmentClient, user);
    assertExpectedComponentsInDb();
    assertThat(attachmentRepository.getAll(), Matchers.hasSize(1));
    assertThat(componentClient.getComponentSummary(user), is(componentSummaryAfterFirst));
    assertThat(componentClient.getReleaseSummary(user), is(releaseSummaryAfterFirst));
  }
コード例 #9
0
  @Test
  public void testCaseBuilder() {

    QBuch qBuch = QBuch.buch;

    CaseBuilder caseBuilder = new CaseBuilder();

    NumberExpression<Integer> numberExpression =
        caseBuilder.when(qBuch.genre.eq(Genre.history)).then(99).otherwise(88);
    List<Integer> result = new JPAQuery(em).from(qBuch).list(numberExpression);

    Assert.assertThat(result, Matchers.hasSize(2));
    Assert.assertThat(result, Matchers.contains(99));
    Assert.assertThat(result, Matchers.contains(88));
  }
コード例 #10
0
  @Test
  public void listWithError() {
    String schearch = "search";
    Mockito.when(
            repository.list(
                QSampleEntity.sampleEntity,
                service.getFilter(schearch),
                QSampleEntity.sampleEntity))
        .thenReturn(getList());
    List<SampleEntity> list = service.list(schearch);

    Mockito.verify(repository)
        .list(QSampleEntity.sampleEntity, service.getFilter(schearch), QSampleEntity.sampleEntity);

    MatcherAssert.assertThat(list, Matchers.hasSize(1));
    MatcherAssert.assertThat(list, Matchers.contains(createSampleEntity(ID, null)));
  }
コード例 #11
0
  @Test
  public void testE2EBigtableWrite() throws Exception {
    final String tableName = bigtableOptions.getInstanceName().toTableNameStr(tableId);
    final String instanceName = bigtableOptions.getInstanceName().toString();
    final int numRows = 1000;
    final List<KV<ByteString, ByteString>> testData = generateTableData(numRows);

    createEmptyTable(instanceName, tableId);

    Pipeline p = Pipeline.create(options);
    p.apply(CountingInput.upTo(numRows))
        .apply(
            ParDo.of(
                new DoFn<Long, KV<ByteString, Iterable<Mutation>>>() {
                  @ProcessElement
                  public void processElement(ProcessContext c) {
                    int index = c.element().intValue();

                    Iterable<Mutation> mutations =
                        ImmutableList.of(
                            Mutation.newBuilder()
                                .setSetCell(
                                    Mutation.SetCell.newBuilder()
                                        .setValue(testData.get(index).getValue())
                                        .setFamilyName(COLUMN_FAMILY_NAME))
                                .build());
                    c.output(KV.of(testData.get(index).getKey(), mutations));
                  }
                }))
        .apply(BigtableIO.write().withBigtableOptions(bigtableOptions).withTableId(tableId));
    p.run();

    // Test number of column families and column family name equality
    Table table = getTable(tableName);
    assertThat(table.getColumnFamilies().keySet(), Matchers.hasSize(1));
    assertThat(table.getColumnFamilies(), Matchers.hasKey(COLUMN_FAMILY_NAME));

    // Test table data equality
    List<KV<ByteString, ByteString>> tableData = getTableData(tableName);
    assertThat(tableData, Matchers.containsInAnyOrder(testData.toArray()));
  }
コード例 #12
0
  @Test
  public void webSocketHandlers() {
    loadBeanDefinitions("websocket-config-handlers.xml");
    Map<String, HandlerMapping> handlersMap = appContext.getBeansOfType(HandlerMapping.class);
    assertNotNull(handlersMap);
    assertThat(handlersMap.values(), Matchers.hasSize(2));

    for (HandlerMapping handlerMapping : handlersMap.values()) {
      assertTrue(handlerMapping instanceof SimpleUrlHandlerMapping);
      SimpleUrlHandlerMapping urlHandlerMapping = (SimpleUrlHandlerMapping) handlerMapping;

      if (urlHandlerMapping.getUrlMap().keySet().contains("/foo")) {
        assertThat(urlHandlerMapping.getUrlMap().keySet(), Matchers.contains("/foo", "/bar"));
        WebSocketHttpRequestHandler handler =
            (WebSocketHttpRequestHandler) urlHandlerMapping.getUrlMap().get("/foo");
        assertNotNull(handler);
        checkDelegateHandlerType(handler.getWebSocketHandler(), FooWebSocketHandler.class);
        HandshakeHandler handshakeHandler =
            (HandshakeHandler)
                new DirectFieldAccessor(handler).getPropertyValue("handshakeHandler");
        assertNotNull(handshakeHandler);
        assertTrue(handshakeHandler instanceof DefaultHandshakeHandler);
      } else {
        assertThat(urlHandlerMapping.getUrlMap().keySet(), Matchers.contains("/test"));
        WebSocketHttpRequestHandler handler =
            (WebSocketHttpRequestHandler) urlHandlerMapping.getUrlMap().get("/test");
        assertNotNull(handler);
        checkDelegateHandlerType(handler.getWebSocketHandler(), TestWebSocketHandler.class);
        HandshakeHandler handshakeHandler =
            (HandshakeHandler)
                new DirectFieldAccessor(handler).getPropertyValue("handshakeHandler");
        assertNotNull(handshakeHandler);
        assertTrue(handshakeHandler instanceof DefaultHandshakeHandler);
      }
    }
  }
コード例 #13
0
 /* start */
 public void testAssert() {
   List<String> list = new ArrayList<String>();
   list.add("test");
   list.add("webdriver");
   assertThat("Assert that the list has size of 3", list, Matchers.hasSize(3));
 }
  @Test
  public void simpleBroker() {
    loadBeanDefinitions("websocket-config-broker-simple.xml");

    HandlerMapping hm = this.appContext.getBean(HandlerMapping.class);
    assertThat(hm, Matchers.instanceOf(SimpleUrlHandlerMapping.class));
    SimpleUrlHandlerMapping suhm = (SimpleUrlHandlerMapping) hm;
    assertThat(suhm.getUrlMap().keySet(), Matchers.hasSize(4));
    assertThat(suhm.getUrlMap().values(), Matchers.hasSize(4));

    HttpRequestHandler httpRequestHandler = (HttpRequestHandler) suhm.getUrlMap().get("/foo");
    assertNotNull(httpRequestHandler);
    assertThat(httpRequestHandler, Matchers.instanceOf(WebSocketHttpRequestHandler.class));

    WebSocketHttpRequestHandler wsHttpRequestHandler =
        (WebSocketHttpRequestHandler) httpRequestHandler;
    HandshakeHandler handshakeHandler = wsHttpRequestHandler.getHandshakeHandler();
    assertNotNull(handshakeHandler);
    assertTrue(handshakeHandler instanceof TestHandshakeHandler);
    List<HandshakeInterceptor> interceptors = wsHttpRequestHandler.getHandshakeInterceptors();
    assertThat(
        interceptors,
        contains(instanceOf(FooTestInterceptor.class), instanceOf(BarTestInterceptor.class)));

    WebSocketHandler wsHandler = unwrapWebSocketHandler(wsHttpRequestHandler.getWebSocketHandler());
    assertNotNull(wsHandler);
    assertThat(wsHandler, Matchers.instanceOf(SubProtocolWebSocketHandler.class));

    SubProtocolWebSocketHandler subProtocolWsHandler = (SubProtocolWebSocketHandler) wsHandler;
    assertEquals(
        Arrays.asList("v10.stomp", "v11.stomp", "v12.stomp"),
        subProtocolWsHandler.getSubProtocols());
    assertEquals(25 * 1000, subProtocolWsHandler.getSendTimeLimit());
    assertEquals(1024 * 1024, subProtocolWsHandler.getSendBufferSizeLimit());

    StompSubProtocolHandler stompHandler =
        (StompSubProtocolHandler) subProtocolWsHandler.getProtocolHandlerMap().get("v12.stomp");
    assertNotNull(stompHandler);
    assertEquals(128 * 1024, stompHandler.getMessageSizeLimit());

    assertNotNull(new DirectFieldAccessor(stompHandler).getPropertyValue("eventPublisher"));

    httpRequestHandler = (HttpRequestHandler) suhm.getUrlMap().get("/test/**");
    assertNotNull(httpRequestHandler);
    assertThat(httpRequestHandler, Matchers.instanceOf(SockJsHttpRequestHandler.class));

    SockJsHttpRequestHandler sockJsHttpRequestHandler =
        (SockJsHttpRequestHandler) httpRequestHandler;
    wsHandler = unwrapWebSocketHandler(sockJsHttpRequestHandler.getWebSocketHandler());
    assertNotNull(wsHandler);
    assertThat(wsHandler, Matchers.instanceOf(SubProtocolWebSocketHandler.class));
    assertNotNull(sockJsHttpRequestHandler.getSockJsService());
    assertThat(
        sockJsHttpRequestHandler.getSockJsService(),
        Matchers.instanceOf(DefaultSockJsService.class));

    DefaultSockJsService defaultSockJsService =
        (DefaultSockJsService) sockJsHttpRequestHandler.getSockJsService();
    WebSocketTransportHandler wsTransportHandler =
        (WebSocketTransportHandler)
            defaultSockJsService.getTransportHandlers().get(TransportType.WEBSOCKET);
    assertNotNull(wsTransportHandler.getHandshakeHandler());
    assertThat(
        wsTransportHandler.getHandshakeHandler(), Matchers.instanceOf(TestHandshakeHandler.class));

    ThreadPoolTaskScheduler scheduler =
        (ThreadPoolTaskScheduler) defaultSockJsService.getTaskScheduler();
    assertEquals(
        Runtime.getRuntime().availableProcessors(),
        scheduler.getScheduledThreadPoolExecutor().getCorePoolSize());
    assertTrue(scheduler.getScheduledThreadPoolExecutor().getRemoveOnCancelPolicy());

    interceptors = defaultSockJsService.getHandshakeInterceptors();
    assertThat(
        interceptors,
        contains(instanceOf(FooTestInterceptor.class), instanceOf(BarTestInterceptor.class)));

    UserSessionRegistry userSessionRegistry = this.appContext.getBean(UserSessionRegistry.class);
    assertNotNull(userSessionRegistry);

    UserDestinationResolver userDestResolver =
        this.appContext.getBean(UserDestinationResolver.class);
    assertNotNull(userDestResolver);
    assertThat(userDestResolver, Matchers.instanceOf(DefaultUserDestinationResolver.class));
    DefaultUserDestinationResolver defaultUserDestResolver =
        (DefaultUserDestinationResolver) userDestResolver;
    assertEquals("/personal/", defaultUserDestResolver.getDestinationPrefix());
    assertSame(
        stompHandler.getUserSessionRegistry(), defaultUserDestResolver.getUserSessionRegistry());

    UserDestinationMessageHandler userDestHandler =
        this.appContext.getBean(UserDestinationMessageHandler.class);
    assertNotNull(userDestHandler);

    SimpleBrokerMessageHandler brokerMessageHandler =
        this.appContext.getBean(SimpleBrokerMessageHandler.class);
    assertNotNull(brokerMessageHandler);
    assertEquals(
        Arrays.asList("/topic", "/queue"),
        new ArrayList<String>(brokerMessageHandler.getDestinationPrefixes()));

    List<Class<? extends MessageHandler>> subscriberTypes =
        Arrays.<Class<? extends MessageHandler>>asList(
            SimpAnnotationMethodMessageHandler.class,
            UserDestinationMessageHandler.class,
            SimpleBrokerMessageHandler.class);
    testChannel("clientInboundChannel", subscriberTypes, 0);
    testExecutor(
        "clientInboundChannel",
        Runtime.getRuntime().availableProcessors() * 2,
        Integer.MAX_VALUE,
        60);

    subscriberTypes =
        Arrays.<Class<? extends MessageHandler>>asList(SubProtocolWebSocketHandler.class);
    testChannel("clientOutboundChannel", subscriberTypes, 0);
    testExecutor(
        "clientOutboundChannel",
        Runtime.getRuntime().availableProcessors() * 2,
        Integer.MAX_VALUE,
        60);

    subscriberTypes =
        Arrays.<Class<? extends MessageHandler>>asList(
            SimpleBrokerMessageHandler.class, UserDestinationMessageHandler.class);
    testChannel("brokerChannel", subscriberTypes, 0);
    try {
      this.appContext.getBean("brokerChannelExecutor", ThreadPoolTaskExecutor.class);
      fail("expected exception");
    } catch (NoSuchBeanDefinitionException ex) {
      // expected
    }

    assertNotNull(this.appContext.getBean("webSocketScopeConfigurer", CustomScopeConfigurer.class));

    DirectFieldAccessor subscriptionRegistryAccessor =
        new DirectFieldAccessor(brokerMessageHandler.getSubscriptionRegistry());
    String pathSeparator =
        (String)
            new DirectFieldAccessor(subscriptionRegistryAccessor.getPropertyValue("pathMatcher"))
                .getPropertyValue("pathSeparator");
    assertEquals(".", pathSeparator);
  }
  @Test
  public void stompBrokerRelay() {
    loadBeanDefinitions("websocket-config-broker-relay.xml");

    HandlerMapping hm = this.appContext.getBean(HandlerMapping.class);
    assertNotNull(hm);
    assertThat(hm, Matchers.instanceOf(SimpleUrlHandlerMapping.class));

    SimpleUrlHandlerMapping suhm = (SimpleUrlHandlerMapping) hm;
    assertThat(suhm.getUrlMap().keySet(), Matchers.hasSize(1));
    assertThat(suhm.getUrlMap().values(), Matchers.hasSize(1));
    assertEquals(2, suhm.getOrder());

    HttpRequestHandler httpRequestHandler = (HttpRequestHandler) suhm.getUrlMap().get("/foo/**");
    assertNotNull(httpRequestHandler);
    assertThat(httpRequestHandler, Matchers.instanceOf(SockJsHttpRequestHandler.class));
    SockJsHttpRequestHandler sockJsHttpRequestHandler =
        (SockJsHttpRequestHandler) httpRequestHandler;
    WebSocketHandler wsHandler =
        unwrapWebSocketHandler(sockJsHttpRequestHandler.getWebSocketHandler());
    assertNotNull(wsHandler);
    assertThat(wsHandler, Matchers.instanceOf(SubProtocolWebSocketHandler.class));
    assertNotNull(sockJsHttpRequestHandler.getSockJsService());

    UserDestinationResolver userDestResolver =
        this.appContext.getBean(UserDestinationResolver.class);
    assertNotNull(userDestResolver);
    assertThat(userDestResolver, Matchers.instanceOf(DefaultUserDestinationResolver.class));
    DefaultUserDestinationResolver defaultUserDestResolver =
        (DefaultUserDestinationResolver) userDestResolver;
    assertEquals("/user/", defaultUserDestResolver.getDestinationPrefix());

    StompBrokerRelayMessageHandler messageBroker =
        this.appContext.getBean(StompBrokerRelayMessageHandler.class);
    assertNotNull(messageBroker);
    assertEquals("clientlogin", messageBroker.getClientLogin());
    assertEquals("clientpass", messageBroker.getClientPasscode());
    assertEquals("syslogin", messageBroker.getSystemLogin());
    assertEquals("syspass", messageBroker.getSystemPasscode());
    assertEquals("relayhost", messageBroker.getRelayHost());
    assertEquals(1234, messageBroker.getRelayPort());
    assertEquals("spring.io", messageBroker.getVirtualHost());
    assertEquals(5000, messageBroker.getSystemHeartbeatReceiveInterval());
    assertEquals(5000, messageBroker.getSystemHeartbeatSendInterval());
    assertThat(
        messageBroker.getDestinationPrefixes(), Matchers.containsInAnyOrder("/topic", "/queue"));

    List<Class<? extends MessageHandler>> subscriberTypes =
        Arrays.<Class<? extends MessageHandler>>asList(
            SimpAnnotationMethodMessageHandler.class,
            UserDestinationMessageHandler.class,
            StompBrokerRelayMessageHandler.class);
    testChannel("clientInboundChannel", subscriberTypes, 0);
    testExecutor(
        "clientInboundChannel",
        Runtime.getRuntime().availableProcessors() * 2,
        Integer.MAX_VALUE,
        60);

    subscriberTypes =
        Arrays.<Class<? extends MessageHandler>>asList(SubProtocolWebSocketHandler.class);
    testChannel("clientOutboundChannel", subscriberTypes, 0);
    testExecutor(
        "clientOutboundChannel",
        Runtime.getRuntime().availableProcessors() * 2,
        Integer.MAX_VALUE,
        60);

    subscriberTypes =
        Arrays.<Class<? extends MessageHandler>>asList(
            StompBrokerRelayMessageHandler.class, UserDestinationMessageHandler.class);
    testChannel("brokerChannel", subscriberTypes, 0);
    try {
      this.appContext.getBean("brokerChannelExecutor", ThreadPoolTaskExecutor.class);
      fail("expected exception");
    } catch (NoSuchBeanDefinitionException ex) {
      // expected
    }

    String name = "webSocketMessageBrokerStats";
    WebSocketMessageBrokerStats stats =
        this.appContext.getBean(name, WebSocketMessageBrokerStats.class);
    String actual = stats.toString();
    String expected =
        "WebSocketSession\\[0 current WS\\(0\\)-HttpStream\\(0\\)-HttpPoll\\(0\\), "
            + "0 total, 0 closed abnormally \\(0 connect failure, 0 send limit, 0 transport error\\)\\], "
            + "stompSubProtocol\\[processed CONNECT\\(0\\)-CONNECTED\\(0\\)-DISCONNECT\\(0\\)\\], "
            + "stompBrokerRelay\\[0 sessions, relayhost:1234 \\(not available\\), processed CONNECT\\(0\\)-CONNECTED\\(0\\)-DISCONNECT\\(0\\)\\], "
            + "inboundChannel\\[pool size = \\d, active threads = \\d, queued tasks = \\d, completed tasks = \\d\\], "
            + "outboundChannelpool size = \\d, active threads = \\d, queued tasks = \\d, completed tasks = \\d\\], "
            + "sockJsScheduler\\[pool size = \\d, active threads = \\d, queued tasks = \\d, completed tasks = \\d\\]";

    assertTrue(
        "\nExpected: " + expected.replace("\\", "") + "\n  Actual: " + actual,
        actual.matches(expected));
  }