use of io.codekvast.javaagent.model.v1.rest.GetConfigResponse1 in project codekvast by crispab.
the class AgentServiceImplTest method should_return_enabled_publishers_when_below_agent_limit_no_trial_period.
@Test
public void should_return_enabled_publishers_when_below_agent_limit_no_trial_period() {
// given
when(jdbcTemplate.queryForObject(anyString(), eq(Integer.class), anyLong(), any(), anyString())).thenReturn(1);
// when
GetConfigResponse1 response = service.getConfig(request);
// then
assertThat(response.getCodeBasePublisherName(), is("http"));
assertThat(response.getCodeBasePublisherConfig(), is("enabled=true"));
assertThat(response.getInvocationDataPublisherName(), is("http"));
assertThat(response.getInvocationDataPublisherConfig(), is("enabled=true"));
}
use of io.codekvast.javaagent.model.v1.rest.GetConfigResponse1 in project codekvast by crispab.
the class AgentServiceImplTest method should_return_disabled_publishers_when_below_agent_limit_after_trial_period_has_expired.
@Test
public void should_return_disabled_publishers_when_below_agent_limit_after_trial_period_has_expired() {
// given
Instant now = Instant.now();
setupCustomerData(now.minus(10, DAYS), now.minus(1, DAYS));
when(jdbcTemplate.queryForObject(anyString(), eq(Integer.class), anyLong(), any(), anyString())).thenReturn(1);
// when
GetConfigResponse1 response = service.getConfig(request);
// then
assertThat(response.getCodeBasePublisherName(), is("http"));
assertThat(response.getCodeBasePublisherConfig(), is("enabled=false"));
assertThat(response.getInvocationDataPublisherName(), is("http"));
assertThat(response.getInvocationDataPublisherConfig(), is("enabled=false"));
}
use of io.codekvast.javaagent.model.v1.rest.GetConfigResponse1 in project codekvast by crispab.
the class MariadbIntegrationTest method should_getConfig_for_enabled_agent.
@Test
@Sql(scripts = "/sql/base-data.sql")
public void should_getConfig_for_enabled_agent() {
// given
new Timestamps().invoke();
// when
GetConfigResponse1 response = agentService.getConfig(GetConfigRequest1.sample().toBuilder().jvmUuid("uuid1").licenseKey("").startedAtMillis(Instant.now().minus(2, HOURS).toEpochMilli()).build());
// then
assertConfigPollResponse(response, "enabled=true");
// Assert all dead agents are marked as disabled as well
assertAgentEnabled("uuid1", TRUE);
assertAgentEnabled("uuid2", FALSE);
assertAgentEnabled("uuid3", FALSE);
assertAgentEnabled("uuid4", FALSE);
}
use of io.codekvast.javaagent.model.v1.rest.GetConfigResponse1 in project codekvast by crispab.
the class MariadbIntegrationTest method should_getConfig_for_disabled_agent.
@Test
@Sql(scripts = "/sql/base-data.sql")
public void should_getConfig_for_disabled_agent() {
// given
new Timestamps().invoke();
// when
GetConfigResponse1 response = agentService.getConfig(GetConfigRequest1.sample().toBuilder().jvmUuid("uuid2").licenseKey("").startedAtMillis(Instant.now().minus(2, HOURS).toEpochMilli()).build());
// then
assertConfigPollResponse(response, "enabled=false");
assertAgentEnabled("uuid1", TRUE);
assertAgentEnabled("uuid2", FALSE);
assertAgentEnabled("uuid3", FALSE);
assertAgentEnabled("uuid4", FALSE);
}
use of io.codekvast.javaagent.model.v1.rest.GetConfigResponse1 in project codekvast by crispab.
the class AgentController method getConfig1.
@RequestMapping(value = V1_POLL_CONFIG)
public GetConfigResponse1 getConfig1(@Valid @RequestBody GetConfigRequest1 request) {
logger.debug("Received {}", request);
GetConfigResponse1 response = agentService.getConfig(request);
logger.debug("Responds with {}", response);
return response;
}
Aggregations