use of com.cloudera.api.swagger.model.ApiEvent in project knox by apache.
the class PollingConfigurationAnalyzerTest method testExistingServiceStartWithConfigChange.
/**
* Test the start of an existing service when relevant configuration has changed.
*/
@Test
public void testExistingServiceStartWithConfigChange() {
final String clusterName = "Cluster E";
// Simulate a service Start event
ApiEvent startEvent = createApiEvent(clusterName, NameNodeServiceModelGenerator.SERVICE_TYPE, NameNodeServiceModelGenerator.SERVICE, PollingConfigurationAnalyzer.START_COMMAND, PollingConfigurationAnalyzer.SUCCEEDED_STATUS);
doTestEventWithConfigChange(startEvent, clusterName);
}
use of com.cloudera.api.swagger.model.ApiEvent in project knox by apache.
the class PollingConfigurationAnalyzerTest method testRestartWaitingForStalenessSuccessEvent.
/**
* Test the restart waiting for staleness, for which it should be assumed that configuration has changed.
*/
@Test
public void testRestartWaitingForStalenessSuccessEvent() {
final String address = "http://host1:1234";
final String clusterName = "Cluster 8";
// Simulate a successful restart waiting for staleness event
final ApiEvent rollingRestartEvent = createApiEvent(clusterName, PollingConfigurationAnalyzer.CM_SERVICE_TYPE, PollingConfigurationAnalyzer.CM_SERVICE, PollingConfigurationAnalyzer.RESTART_WAITING_FOR_STALENESS_SUCCESS_COMMAND, PollingConfigurationAnalyzer.SUCCEEDED_STATUS, "EV_CLUSTER_RESTARTED");
final ChangeListener listener = doTestEvent(rollingRestartEvent, address, clusterName, Collections.emptyMap(), Collections.emptyMap());
assertTrue("Expected a change notification", listener.wasNotified(address, clusterName));
}
use of com.cloudera.api.swagger.model.ApiEvent in project knox by apache.
the class PollingConfigurationAnalyzerTest method testExistingServiceStartWithoutConfigChange.
/**
* Test the start of an existing service when no relevant configuration has changed.
*/
@Test
public void testExistingServiceStartWithoutConfigChange() {
final String clusterName = "Cluster E";
// Simulate a service Start event
ApiEvent startEvent = createApiEvent(clusterName, NameNodeServiceModelGenerator.SERVICE_TYPE, NameNodeServiceModelGenerator.SERVICE, PollingConfigurationAnalyzer.START_COMMAND, PollingConfigurationAnalyzer.SUCCEEDED_STATUS);
doTestEventWithoutConfigChange(startEvent, clusterName);
}
use of com.cloudera.api.swagger.model.ApiEvent in project knox by apache.
the class PollingConfigurationAnalyzerTest method testNewServiceStartEvent.
/**
* Test the start of a new service.
*/
@Test
public void testNewServiceStartEvent() {
final String address = "http://host1:1234";
final String clusterName = "Cluster N";
// Simulate a service Start event
ApiEvent startEvent = createApiEvent(clusterName, NameNodeServiceModelGenerator.SERVICE_TYPE, NameNodeServiceModelGenerator.SERVICE, PollingConfigurationAnalyzer.START_COMMAND, PollingConfigurationAnalyzer.SUCCEEDED_STATUS);
ChangeListener listener = doTestEvent(startEvent, address, clusterName, Collections.emptyMap(), Collections.emptyMap());
assertTrue("Expected a change notification", listener.wasNotified(address, clusterName));
}
use of com.cloudera.api.swagger.model.ApiEvent in project knox by apache.
the class PollingConfigurationAnalyzerTest method testEventWithoutCommandOrCommandStatus.
/**
* KNOX-2350
*/
@Test
public void testEventWithoutCommandOrCommandStatus() {
final String clusterName = "Cluster T";
// Simulate an event w/o COMMAND and/or COMMAND_STATUS attributes
final List<ApiEventAttribute> revisionEventAttrs = new ArrayList<>();
revisionEventAttrs.add(createEventAttribute("CLUSTER", clusterName));
revisionEventAttrs.add(createEventAttribute("SERVICE_TYPE", HiveOnTezServiceModelGenerator.SERVICE_TYPE));
revisionEventAttrs.add(createEventAttribute("SERVICE", HiveOnTezServiceModelGenerator.SERVICE));
revisionEventAttrs.add(createEventAttribute("REVISION", "215"));
revisionEventAttrs.add(createEventAttribute("EVENTCODE", "EV_REVISION_CREATED"));
final ApiEvent revisionEvent = createApiEvent(ApiEventCategory.AUDIT_EVENT, revisionEventAttrs, null);
doTestEventWithoutConfigChange(revisionEvent, clusterName);
}
Aggregations