Search in sources :

Example 1 with AwsVariantMigrationTriggerEvent

use of com.sequenceiq.cloudbreak.core.flow2.event.AwsVariantMigrationTriggerEvent in project cloudbreak by hortonworks.

the class AwsVariantMigrationActions method createResources.

@Bean(name = "CREATE_RESOURCES_STATE")
public Action<?, ?> createResources() {
    return new AbstractAwsVariantMigrationAction<>(AwsVariantMigrationTriggerEvent.class) {

        @Override
        protected void doExecute(AwsVariantMigrationFlowContext context, AwsVariantMigrationTriggerEvent payload, Map<Object, Object> variables) throws Exception {
            CreateResourcesRequest request = new CreateResourcesRequest(context.getCloudContext(), context.getCloudCredential(), context.getCloudStack(), payload.getHostGroupName());
            sendEvent(context, request.selector(), request);
        }
    };
}
Also used : AwsVariantMigrationTriggerEvent(com.sequenceiq.cloudbreak.core.flow2.event.AwsVariantMigrationTriggerEvent) CreateResourcesRequest(com.sequenceiq.cloudbreak.cloud.event.resource.migration.aws.CreateResourcesRequest) Map(java.util.Map) Bean(org.springframework.context.annotation.Bean)

Example 2 with AwsVariantMigrationTriggerEvent

use of com.sequenceiq.cloudbreak.core.flow2.event.AwsVariantMigrationTriggerEvent in project cloudbreak by hortonworks.

the class ClusterRepairFlowEventChainFactoryTest method testAddAwsNativeMigrationIfNeedWhenUpgradeAndAwsNativeVariant.

@Test
public void testAddAwsNativeMigrationIfNeedWhenUpgradeAndAwsNativeVariant() {
    Queue<Selectable> flowTriggers = new ConcurrentLinkedDeque<>();
    String groupName = "groupName";
    boolean upgrade = true;
    String variant = "AWS_NATIVE";
    underTest.addAwsNativeEventMigrationIfNeed(flowTriggers, STACK_ID, groupName, upgrade, variant);
    Assertions.assertFalse(flowTriggers.isEmpty());
    AwsVariantMigrationTriggerEvent actual = (AwsVariantMigrationTriggerEvent) flowTriggers.peek();
    Assertions.assertEquals(groupName, actual.getHostGroupName());
}
Also used : Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) AwsVariantMigrationTriggerEvent(com.sequenceiq.cloudbreak.core.flow2.event.AwsVariantMigrationTriggerEvent) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) ConcurrentLinkedDeque(java.util.concurrent.ConcurrentLinkedDeque) Test(org.junit.Test)

Aggregations

AwsVariantMigrationTriggerEvent (com.sequenceiq.cloudbreak.core.flow2.event.AwsVariantMigrationTriggerEvent)2 CreateResourcesRequest (com.sequenceiq.cloudbreak.cloud.event.resource.migration.aws.CreateResourcesRequest)1 Selectable (com.sequenceiq.cloudbreak.common.event.Selectable)1 Map (java.util.Map)1 ConcurrentLinkedDeque (java.util.concurrent.ConcurrentLinkedDeque)1 Test (org.junit.Test)1 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)1 Bean (org.springframework.context.annotation.Bean)1