use of io.codekvast.javaagent.model.v1.rest.GetConfigRequest1 in project codekvast by crispab.
the class ConfigPollerImplTest method should_serialize_deserialize_getConfigRequest1.
@Test
public void should_serialize_deserialize_getConfigRequest1() throws Exception {
GetConfigRequest1 request1 = GetConfigRequest1.sample();
String json = gson.toJson(request1);
assertThat(json, containsString("\"licenseKey\":\"licenseKey\""));
GetConfigRequest1 fromJson = gson.fromJson(json, GetConfigRequest1.class);
assertThat(fromJson, is(request1));
}
use of io.codekvast.javaagent.model.v1.rest.GetConfigRequest1 in project codekvast by crispab.
the class GetConfigRequest2Test method should_serialize_to_from_json_1.
@Test
public void should_serialize_to_from_json_1() {
GetConfigRequest1 req1 = GetConfigRequest1.sample();
String json = gson.toJson(req1);
GetConfigRequest1 req2 = gson.fromJson(json, GetConfigRequest1.class);
assertThat(req1, is(req2));
}
use of io.codekvast.javaagent.model.v1.rest.GetConfigRequest1 in project codekvast by crispab.
the class AgentControllerTest method getConfig1_should_reject_invalid_licenseKey.
@Test
public void getConfig1_should_reject_invalid_licenseKey() throws Exception {
when(agentService.getConfig(any(GetConfigRequest1.class))).thenThrow(new LicenseViolationException("foobar"));
mockMvc.perform(post(V1_POLL_CONFIG).content(gson.toJson(GetConfigRequest1.sample())).contentType(APPLICATION_JSON_UTF8)).andExpect(status().isForbidden());
}
use of io.codekvast.javaagent.model.v1.rest.GetConfigRequest1 in project codekvast by crispab.
the class IntakeIntegrationTest method should_getConfig_for_enabled_agent_1.
@Test
@Sql(scripts = "/sql/base-data.sql")
public void should_getConfig_for_enabled_agent_1() {
// given
new Timestamps(jdbcTemplate).invoke();
// when
GetConfigResponse1 response = agentService.getConfig1(GetConfigRequest1.sample().toBuilder().jvmUuid("uuid1").licenseKey("").startedAtMillis(Instant.now().minus(2, HOURS).toEpochMilli()).build());
// then
assertConfigPollResponse(response);
// Assert all dead agents are marked as disabled as well
assertAgentEnabledAndGarbage("uuid1", TRUE, FALSE);
assertAgentEnabledAndGarbage("uuid2", FALSE, FALSE);
assertAgentEnabledAndGarbage("uuid3", TRUE, TRUE);
assertAgentEnabledAndGarbage("uuid4", FALSE, TRUE);
}
Aggregations