Search in sources :

Example 1 with BaseDiagnosticsCollectionRequest

use of com.sequenceiq.common.api.diagnostics.BaseDiagnosticsCollectionRequest in project cloudbreak by hortonworks.

the class DiagnosticsCollectionValidatorTest method testWithValidEngDestination.

@Test
void testWithValidEngDestination() {
    BaseDiagnosticsCollectionRequest request = new BaseDiagnosticsCollectionRequest();
    request.setDestination(DiagnosticsDestination.ENG);
    StackV4Response stackV4Response = new StackV4Response();
    stackV4Response.setCrn(DATALAKE_CRN);
    TelemetryResponse telemetry = new TelemetryResponse();
    FeaturesResponse features = new FeaturesResponse();
    FeatureSetting featureSetting = new FeatureSetting();
    featureSetting.setEnabled(true);
    features.setClusterLogsCollection(featureSetting);
    telemetry.setFeatures(features);
    stackV4Response.setTelemetry(telemetry);
    underTest.validate(request, stackV4Response);
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) BaseDiagnosticsCollectionRequest(com.sequenceiq.common.api.diagnostics.BaseDiagnosticsCollectionRequest) StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) FeaturesResponse(com.sequenceiq.common.api.telemetry.response.FeaturesResponse) FeatureSetting(com.sequenceiq.common.api.type.FeatureSetting) Test(org.junit.jupiter.api.Test)

Example 2 with BaseDiagnosticsCollectionRequest

use of com.sequenceiq.common.api.diagnostics.BaseDiagnosticsCollectionRequest in project cloudbreak by hortonworks.

the class DiagnosticsCollectionValidatorTest method testWithCloudStorageWithDisabledLogging.

@Test
void testWithCloudStorageWithDisabledLogging() {
    BaseDiagnosticsCollectionRequest request = new BaseDiagnosticsCollectionRequest();
    request.setDestination(DiagnosticsDestination.CLOUD_STORAGE);
    StackV4Response stackV4Response = new StackV4Response();
    stackV4Response.setCrn(DATALAKE_CRN);
    TelemetryResponse telemetry = new TelemetryResponse();
    stackV4Response.setTelemetry(telemetry);
    BadRequestException thrown = assertThrows(BadRequestException.class, () -> underTest.validate(request, stackV4Response));
    assertTrue(thrown.getMessage().contains("Cloud storage logging is disabled for Data Lake"));
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) BaseDiagnosticsCollectionRequest(com.sequenceiq.common.api.diagnostics.BaseDiagnosticsCollectionRequest) StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) BadRequestException(com.sequenceiq.cloudbreak.common.exception.BadRequestException) Test(org.junit.jupiter.api.Test)

Example 3 with BaseDiagnosticsCollectionRequest

use of com.sequenceiq.common.api.diagnostics.BaseDiagnosticsCollectionRequest in project cloudbreak by hortonworks.

the class DiagnosticsCollectionValidatorTest method testWithEngDestinationAndDisabledLogCollection.

@Test
void testWithEngDestinationAndDisabledLogCollection() {
    BaseDiagnosticsCollectionRequest request = new BaseDiagnosticsCollectionRequest();
    request.setDestination(DiagnosticsDestination.ENG);
    StackV4Response stackV4Response = new StackV4Response();
    stackV4Response.setCrn(DATALAKE_CRN);
    TelemetryResponse telemetry = new TelemetryResponse();
    stackV4Response.setTelemetry(telemetry);
    BadRequestException thrown = assertThrows(BadRequestException.class, () -> underTest.validate(request, stackV4Response));
    assertTrue(thrown.getMessage().contains("Cluster log collection is not enabled for Data Lake"));
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) BaseDiagnosticsCollectionRequest(com.sequenceiq.common.api.diagnostics.BaseDiagnosticsCollectionRequest) StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) BadRequestException(com.sequenceiq.cloudbreak.common.exception.BadRequestException) Test(org.junit.jupiter.api.Test)

Example 4 with BaseDiagnosticsCollectionRequest

use of com.sequenceiq.common.api.diagnostics.BaseDiagnosticsCollectionRequest in project cloudbreak by hortonworks.

the class DiagnosticsCollectionValidatorTest method testValidateWithValidCloudStorage.

@Test
void testValidateWithValidCloudStorage() {
    BaseDiagnosticsCollectionRequest request = new BaseDiagnosticsCollectionRequest();
    request.setDestination(DiagnosticsDestination.CLOUD_STORAGE);
    Telemetry telemetry = new Telemetry();
    Logging logging = new Logging();
    logging.setS3(new S3CloudStorageV1Parameters());
    telemetry.setLogging(logging);
    underTest.validate(request, createStack(), telemetry);
}
Also used : Logging(com.sequenceiq.common.api.telemetry.model.Logging) BaseDiagnosticsCollectionRequest(com.sequenceiq.common.api.diagnostics.BaseDiagnosticsCollectionRequest) S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) Test(org.junit.jupiter.api.Test)

Example 5 with BaseDiagnosticsCollectionRequest

use of com.sequenceiq.common.api.diagnostics.BaseDiagnosticsCollectionRequest in project cloudbreak by hortonworks.

the class DiagnosticsCollectionValidatorTest method testValidateWithCloudStorageWithEmptyTelemetry.

@Test
void testValidateWithCloudStorageWithEmptyTelemetry() {
    BaseDiagnosticsCollectionRequest request = new BaseDiagnosticsCollectionRequest();
    request.setDestination(DiagnosticsDestination.CLOUD_STORAGE);
    Telemetry telemetry = new Telemetry();
    BadRequestException thrown = assertThrows(BadRequestException.class, () -> underTest.validate(request, createStack(), telemetry));
    assertTrue(thrown.getMessage().contains("Cloud storage logging is disabled for Data Hub"));
}
Also used : BaseDiagnosticsCollectionRequest(com.sequenceiq.common.api.diagnostics.BaseDiagnosticsCollectionRequest) BadRequestException(com.sequenceiq.cloudbreak.common.exception.BadRequestException) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) Test(org.junit.jupiter.api.Test)

Aggregations

BaseDiagnosticsCollectionRequest (com.sequenceiq.common.api.diagnostics.BaseDiagnosticsCollectionRequest)19 Test (org.junit.jupiter.api.Test)19 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)14 Telemetry (com.sequenceiq.common.api.telemetry.model.Telemetry)13 StackV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response)6 TelemetryResponse (com.sequenceiq.common.api.telemetry.response.TelemetryResponse)5 Logging (com.sequenceiq.common.api.telemetry.model.Logging)4 FeatureSetting (com.sequenceiq.common.api.type.FeatureSetting)4 Features (com.sequenceiq.common.api.telemetry.model.Features)3 S3CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters)2 FeaturesResponse (com.sequenceiq.common.api.telemetry.response.FeaturesResponse)1 LoggingResponse (com.sequenceiq.common.api.telemetry.response.LoggingResponse)1 Stack (com.sequenceiq.freeipa.entity.Stack)1