Search in sources :

Example 1 with RdsDetails

use of com.sequenceiq.cloudbreak.structuredevent.event.RdsDetails in project cloudbreak by hortonworks.

the class RdsConfigToRdsDetailsConverterTest method testWhenSourceWorkspaceIdIsNotNullThenItsValueShouldBePassedBesideAllLogicIndependentData.

@ParameterizedTest(name = "Current RDS type - Database vendor pair: [{0} - {1}]")
@MethodSource("databaseTypeAndVendorDataProvider")
public void testWhenSourceWorkspaceIdIsNotNullThenItsValueShouldBePassedBesideAllLogicIndependentData(DatabaseType databaseType, DatabaseVendor vendor) {
    Workspace workspace = new Workspace();
    workspace.setId(23L);
    RDSConfig source = TestUtil.rdsConfig(databaseType, vendor);
    source.setWorkspace(workspace);
    RdsDetails result = underTest.convert(source);
    assertThat(result).isNotNull();
}
Also used : RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig) RdsDetails(com.sequenceiq.cloudbreak.structuredevent.event.RdsDetails) Workspace(com.sequenceiq.cloudbreak.workspace.model.Workspace) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 2 with RdsDetails

use of com.sequenceiq.cloudbreak.structuredevent.event.RdsDetails in project cloudbreak by hortonworks.

the class RdsConfigToRdsDetailsConverter method convert.

public RdsDetails convert(RDSConfig source) {
    RdsDetails rdsDetails = new RdsDetails();
    rdsDetails.setSslMode(Optional.ofNullable(source.getSslMode()).map(Enum::name).orElse(null));
    rdsDetails.setCreationDate(source.getCreationDate());
    rdsDetails.setDatabaseEngine(source.getDatabaseEngine().name());
    if (DatabaseVendor.EMBEDDED == source.getDatabaseEngine()) {
        rdsDetails.setExternal(Boolean.FALSE);
    } else {
        rdsDetails.setExternal(Boolean.TRUE);
    }
    rdsDetails.setStackVersion(source.getStackVersion());
    rdsDetails.setStatus(source.getStatus().name());
    rdsDetails.setType(source.getType());
    return rdsDetails;
}
Also used : RdsDetails(com.sequenceiq.cloudbreak.structuredevent.event.RdsDetails)

Example 3 with RdsDetails

use of com.sequenceiq.cloudbreak.structuredevent.event.RdsDetails in project cloudbreak by hortonworks.

the class RdsConfigToRdsDetailsConverterTest method testWhenSourceWorkspaceIdIsNullThenItsValueShouldBePassedBesideAllLogicIndependentData.

@ParameterizedTest(name = "Current RDS type - Database vendor pair: [{0} - {1}]")
@MethodSource("databaseTypeAndVendorDataProvider")
public void testWhenSourceWorkspaceIdIsNullThenItsValueShouldBePassedBesideAllLogicIndependentData(DatabaseType databaseType, DatabaseVendor vendor) {
    RDSConfig source = TestUtil.rdsConfig(databaseType, vendor);
    source.setWorkspace(null);
    RdsDetails result = underTest.convert(source);
    assertThat(result).isNotNull();
}
Also used : RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig) RdsDetails(com.sequenceiq.cloudbreak.structuredevent.event.RdsDetails) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 4 with RdsDetails

use of com.sequenceiq.cloudbreak.structuredevent.event.RdsDetails in project cloudbreak by hortonworks.

the class RdsConfigToRdsDetailsConverterTest method testAllLogicIndependentDataArePassedProperly.

@ParameterizedTest(name = "Current RDS type - Database vendor pair: [{0} - {1}]")
@MethodSource("databaseTypeAndVendorDataProvider")
public void testAllLogicIndependentDataArePassedProperly(DatabaseType databaseType, DatabaseVendor vendor) {
    RDSConfig source = TestUtil.rdsConfig(databaseType, vendor);
    RdsDetails result = underTest.convert(source);
    assertThat(result).isNotNull();
    assertThat(result.getCreationDate()).isEqualTo(source.getCreationDate());
    assertThat(result.getDatabaseEngine()).isEqualTo(source.getDatabaseEngine().name());
    assertThat(result.getStackVersion()).isEqualTo(source.getStackVersion());
    assertThat(result.getStatus()).isEqualTo(source.getStatus().name());
    assertThat(result.getType()).isEqualTo(source.getType());
}
Also used : RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig) RdsDetails(com.sequenceiq.cloudbreak.structuredevent.event.RdsDetails) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 5 with RdsDetails

use of com.sequenceiq.cloudbreak.structuredevent.event.RdsDetails in project cloudbreak by hortonworks.

the class RdsConfigToRdsDetailsConverterTest method testWhenDatabaseEngineIsEmbeddedThenIsExternalShouldBeFalseOtherwiseTrue.

@ParameterizedTest(name = "Current RDS type - Database vendor pair: [{0} - {1}]")
@MethodSource("databaseTypeAndVendorDataProvider")
public void testWhenDatabaseEngineIsEmbeddedThenIsExternalShouldBeFalseOtherwiseTrue(DatabaseType databaseType, DatabaseVendor vendor) {
    RDSConfig source = TestUtil.rdsConfig(databaseType, vendor);
    RdsDetails result = underTest.convert(source);
    assertThat(result).isNotNull();
    assertThat(result.getExternal()).isEqualTo(source.getDatabaseEngine() != DatabaseVendor.EMBEDDED);
}
Also used : RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig) RdsDetails(com.sequenceiq.cloudbreak.structuredevent.event.RdsDetails) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Aggregations

RdsDetails (com.sequenceiq.cloudbreak.structuredevent.event.RdsDetails)6 RDSConfig (com.sequenceiq.cloudbreak.domain.RDSConfig)5 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)4 MethodSource (org.junit.jupiter.params.provider.MethodSource)4 Workspace (com.sequenceiq.cloudbreak.workspace.model.Workspace)1