use of io.gravitee.cockpit.api.command.hello.HelloReply in project gravitee-management-rest-api by gravitee-io.
the class HelloCommandProducerTest method handleReplay_shouldUpdateDefaultOrganizationCockpitId.
@Test
public void handleReplay_shouldUpdateDefaultOrganizationCockpitId() {
HelloReply helloReply = new HelloReply();
helloReply.setCommandStatus(CommandStatus.SUCCEEDED);
helloReply.setDefaultOrganizationCockpitId("org#cockpit-1");
String defaultOrgId = "DEFAULT";
OrganizationEntity defaultOrganization = new OrganizationEntity();
defaultOrganization.setId(defaultOrgId);
when(organizationService.findById(defaultOrgId)).thenReturn(defaultOrganization);
cut.handleReply(helloReply);
verify(organizationService).createOrUpdate(eq(defaultOrgId), argThat(org -> org.getCockpitId().equals("org#cockpit-1")));
}
use of io.gravitee.cockpit.api.command.hello.HelloReply 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