Search in sources :

Example 16 with AppType

use of com.quorum.tessera.config.AppType in project tessera by ConsenSys.

the class PrometheusProtocolFormatterTest method noArgResourceResponseCorrectlyFormatted.

@Test
public void noArgResourceResponseCorrectlyFormatted() {
    mockMetrics.add(new MBeanResourceMetric("GET->upCheck()#a10a4f8d", "AverageTime[ms]_total", "100"));
    AppType type = AppType.P2P;
    String expectedResponse = "tessera_P2P_GET_upCheck_AverageTime_ms 100\n";
    assertThat(protocolFormatter.format(mockMetrics, type)).isEqualTo(expectedResponse);
}
Also used : AppType(com.quorum.tessera.config.AppType) Test(org.junit.Test)

Example 17 with AppType

use of com.quorum.tessera.config.AppType in project tessera by ConsenSys.

the class PrometheusProtocolFormatterTest method noMetricsToFormatIsHandled.

@Test
public void noMetricsToFormatIsHandled() {
    AppType type = AppType.P2P;
    assertThat(protocolFormatter.format(mockMetrics, type)).isEmpty();
}
Also used : AppType(com.quorum.tessera.config.AppType) Test(org.junit.Test)

Example 18 with AppType

use of com.quorum.tessera.config.AppType in project tessera by ConsenSys.

the class ServerConfigsValidatorTest method onSetUp.

@Before
public void onSetUp() {
    cvc = mock(ConstraintValidatorContext.class);
    for (AppType appType : AppType.values()) {
        ServerConfig serverConfig = new ServerConfig();
        serverConfig.setApp(appType);
        serverConfig.setServerAddress("localhost:123");
        serverConfig.setCommunicationType(CommunicationType.REST);
        serverConfig.setSslConfig(null);
        serverConfig.setInfluxConfig(null);
        serverConfig.setBindingAddress(null);
        serverConfigsMap.put(appType, serverConfig);
    }
    validator = new ServerConfigsValidator();
    when(cvc.buildConstraintViolationWithTemplate(anyString())).thenReturn(mock(ConstraintValidatorContext.ConstraintViolationBuilder.class));
}
Also used : ServerConfig(com.quorum.tessera.config.ServerConfig) ConstraintValidatorContext(jakarta.validation.ConstraintValidatorContext) AppType(com.quorum.tessera.config.AppType) Before(org.junit.Before)

Aggregations

AppType (com.quorum.tessera.config.AppType)18 Test (org.junit.Test)16 ServerConfig (com.quorum.tessera.config.ServerConfig)1 ConstraintValidatorContext (jakarta.validation.ConstraintValidatorContext)1 GET (jakarta.ws.rs.GET)1 Produces (jakarta.ws.rs.Produces)1 Assertions.catchThrowable (org.assertj.core.api.Assertions.catchThrowable)1 Before (org.junit.Before)1