use of io.gravitee.rest.api.service.EnvironmentService in project gravitee-management-rest-api by gravitee-io.
the class HelloCommandProducerTest method handleReplay_shouldUpdateDefaultEnvironmentCockpitId.
@Test
public void handleReplay_shouldUpdateDefaultEnvironmentCockpitId() {
HelloReply helloReply = new HelloReply();
helloReply.setCommandStatus(CommandStatus.SUCCEEDED);
helloReply.setDefaultEnvironmentCockpitId("env#cockpit-1");
String defaultEnvId = "DEFAULT";
EnvironmentEntity defaultEnvironment = new EnvironmentEntity();
defaultEnvironment.setId(defaultEnvId);
defaultEnvironment.setOrganizationId("org#1");
when(environmentService.findById(defaultEnvId)).thenReturn(defaultEnvironment);
cut.handleReply(helloReply);
verify(environmentService).createOrUpdate(eq(defaultEnvironment.getOrganizationId()), eq(defaultEnvId), argThat(env -> env.getCockpitId().equals("env#cockpit-1")));
}
Aggregations