Search in sources :

Example 1 with CreateBindUserFailureEvent

use of com.sequenceiq.freeipa.flow.freeipa.binduser.create.event.CreateBindUserFailureEvent in project cloudbreak by hortonworks.

the class KerberosBindUserCreationHandler method defaultFailureEvent.

@Override
protected Selectable defaultFailureEvent(Long resourceId, Exception e, Event<CreateKerberosBindUserEvent> event) {
    CreateBindUserEvent eventData = event.getData();
    String failureMsg = String.format("Kerberos bind user creation failed for %s with %s", eventData.getSuffix(), e.getMessage());
    return new CreateBindUserFailureEvent(CreateBindUserFlowEvent.CREATE_BIND_USER_FAILED_EVENT.event(), eventData, failureMsg, e);
}
Also used : CreateBindUserFailureEvent(com.sequenceiq.freeipa.flow.freeipa.binduser.create.event.CreateBindUserFailureEvent) CreateBindUserEvent(com.sequenceiq.freeipa.flow.freeipa.binduser.create.event.CreateBindUserEvent)

Example 2 with CreateBindUserFailureEvent

use of com.sequenceiq.freeipa.flow.freeipa.binduser.create.event.CreateBindUserFailureEvent in project cloudbreak by hortonworks.

the class KerberosBindUserCreationHandlerTest method testDefaultFailureEventCreation.

@Test
public void testDefaultFailureEventCreation() {
    CreateBindUserEvent createBindUserEvent = new CreateBindUserEvent("selector", 1L, "acc", "opid", "suffix", "envcrn");
    CreateKerberosBindUserEvent createKerberosBindUserEvent = new CreateKerberosBindUserEvent(createBindUserEvent);
    Exception exception = new Exception("test");
    Selectable result = underTest.defaultFailureEvent(1L, exception, new Event<>(createKerberosBindUserEvent));
    assertTrue(result instanceof CreateBindUserFailureEvent);
    CreateBindUserFailureEvent failureEvent = (CreateBindUserFailureEvent) result;
    assertEquals(CreateBindUserFlowEvent.CREATE_BIND_USER_FAILED_EVENT.event(), failureEvent.selector());
    assertEquals("Kerberos bind user creation failed for suffix with test", failureEvent.getFailureMessage());
    assertEquals(exception, failureEvent.getException());
}
Also used : CreateKerberosBindUserEvent(com.sequenceiq.freeipa.flow.freeipa.binduser.create.event.CreateKerberosBindUserEvent) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) CreateBindUserFailureEvent(com.sequenceiq.freeipa.flow.freeipa.binduser.create.event.CreateBindUserFailureEvent) CreateBindUserEvent(com.sequenceiq.freeipa.flow.freeipa.binduser.create.event.CreateBindUserEvent) FreeIpaClientException(com.sequenceiq.freeipa.client.FreeIpaClientException) Test(org.junit.jupiter.api.Test)

Example 3 with CreateBindUserFailureEvent

use of com.sequenceiq.freeipa.flow.freeipa.binduser.create.event.CreateBindUserFailureEvent in project cloudbreak by hortonworks.

the class LdapBindUserCreationHandlerTest method testDefaultFailureEventCreation.

@Test
public void testDefaultFailureEventCreation() {
    CreateBindUserEvent createBindUserEvent = new CreateBindUserEvent("selector", 1L, "acc", "opid", "suffix", "envcrn");
    CreateLdapBindUserEvent createLdapBindUserEvent = new CreateLdapBindUserEvent(createBindUserEvent);
    Exception exception = new Exception("test");
    Selectable result = underTest.defaultFailureEvent(1L, exception, new Event<>(createLdapBindUserEvent));
    assertTrue(result instanceof CreateBindUserFailureEvent);
    CreateBindUserFailureEvent failureEvent = (CreateBindUserFailureEvent) result;
    assertEquals(CreateBindUserFlowEvent.CREATE_BIND_USER_FAILED_EVENT.event(), failureEvent.selector());
    assertEquals("LDAP bind user creation failed for suffix with test", failureEvent.getFailureMessage());
    assertEquals(exception, failureEvent.getException());
}
Also used : Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) CreateBindUserFailureEvent(com.sequenceiq.freeipa.flow.freeipa.binduser.create.event.CreateBindUserFailureEvent) CreateBindUserEvent(com.sequenceiq.freeipa.flow.freeipa.binduser.create.event.CreateBindUserEvent) CreateLdapBindUserEvent(com.sequenceiq.freeipa.flow.freeipa.binduser.create.event.CreateLdapBindUserEvent) FreeIpaClientException(com.sequenceiq.freeipa.client.FreeIpaClientException) Test(org.junit.jupiter.api.Test)

Example 4 with CreateBindUserFailureEvent

use of com.sequenceiq.freeipa.flow.freeipa.binduser.create.event.CreateBindUserFailureEvent in project cloudbreak by hortonworks.

the class LdapBindUserCreationHandler method defaultFailureEvent.

@Override
protected Selectable defaultFailureEvent(Long resourceId, Exception e, Event<CreateLdapBindUserEvent> event) {
    CreateBindUserEvent eventData = event.getData();
    String failureMsg = String.format("LDAP bind user creation failed for %s with %s", eventData.getSuffix(), e.getMessage());
    return new CreateBindUserFailureEvent(CreateBindUserFlowEvent.CREATE_BIND_USER_FAILED_EVENT.event(), eventData, failureMsg, e);
}
Also used : CreateBindUserFailureEvent(com.sequenceiq.freeipa.flow.freeipa.binduser.create.event.CreateBindUserFailureEvent) CreateBindUserEvent(com.sequenceiq.freeipa.flow.freeipa.binduser.create.event.CreateBindUserEvent)

Aggregations

CreateBindUserEvent (com.sequenceiq.freeipa.flow.freeipa.binduser.create.event.CreateBindUserEvent)4 CreateBindUserFailureEvent (com.sequenceiq.freeipa.flow.freeipa.binduser.create.event.CreateBindUserFailureEvent)4 Selectable (com.sequenceiq.cloudbreak.common.event.Selectable)2 FreeIpaClientException (com.sequenceiq.freeipa.client.FreeIpaClientException)2 Test (org.junit.jupiter.api.Test)2 CreateKerberosBindUserEvent (com.sequenceiq.freeipa.flow.freeipa.binduser.create.event.CreateKerberosBindUserEvent)1 CreateLdapBindUserEvent (com.sequenceiq.freeipa.flow.freeipa.binduser.create.event.CreateLdapBindUserEvent)1