use of io.codekvast.javaagent.model.v1.rest.GetConfigRequest1 in project codekvast by crispab.
the class AgentControllerIntegrationTest method should_accept_post_to_agentPollConfig.
@Test
public void should_accept_post_to_agentPollConfig() throws Exception {
GetConfigRequest1 request = GetConfigRequest1.sample();
mvc.perform(post(V1_POLL_CONFIG).accept(APPLICATION_JSON_UTF8).contentType(APPLICATION_JSON_UTF8).content(objectMapper.writeValueAsString(request))).andExpect(status().isOk());
}
use of io.codekvast.javaagent.model.v1.rest.GetConfigRequest1 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.GetConfigRequest1 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.GetConfigRequest1 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;
}
use of io.codekvast.javaagent.model.v1.rest.GetConfigRequest1 in project codekvast by crispab.
the class GetConfigRequest1Test method should_serialize_to_from_json.
@Test
public void should_serialize_to_from_json() {
GetConfigRequest1 req1 = GetConfigRequest1.sample();
String json = gson.toJson(req1);
GetConfigRequest1 req2 = gson.fromJson(json, GetConfigRequest1.class);
assertThat(req1, is(req2));
}
Aggregations