Search in sources :

Example 1 with HbaseSchemaStatus

use of com.navercorp.pinpoint.hbase.schema.core.HbaseSchemaStatus in project pinpoint by naver.

the class HbaseSchemaServiceImplTest method getSchemaStatus_noTables.

@Test
public void getSchemaStatus_noTables() {
    final String namespace = "namespace";
    final List<ChangeSet> changeSets = Arrays.asList(newChangeSet("id1", "value1"));
    when(schemaChangeLogService.isAvailable(namespace)).thenReturn(false);
    HbaseSchemaStatus schemaStatus = hbaseSchemaService.getSchemaStatus(namespace, changeSets);
    MatcherAssert.assertThat(schemaStatus, is(HbaseSchemaStatus.NONE));
}
Also used : ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) ChangeSet(com.navercorp.pinpoint.hbase.schema.reader.core.ChangeSet) HbaseSchemaStatus(com.navercorp.pinpoint.hbase.schema.core.HbaseSchemaStatus) Test(org.junit.Test)

Example 2 with HbaseSchemaStatus

use of com.navercorp.pinpoint.hbase.schema.core.HbaseSchemaStatus in project pinpoint by naver.

the class HbaseSchemaServiceImplTest method getSchemaStatus_validButNeedUpdateSchemaChangeLogs.

@Test
public void getSchemaStatus_validButNeedUpdateSchemaChangeLogs() {
    final String namespace = "namespace";
    final List<ChangeSet> changeSets = Arrays.asList(newChangeSet("id1", "value1"), newChangeSet("id2", "value2"), newChangeSet("id3", "value3"));
    final List<SchemaChangeLog> schemaChangeLogs = Arrays.asList(newSchemaChangeLog("id1", "value1", 1), newSchemaChangeLog("id2", "value2", 2));
    when(schemaChangeLogService.isAvailable(namespace)).thenReturn(true);
    when(schemaChangeLogService.getSchemaChangeLogs(namespace)).thenReturn(schemaChangeLogs);
    HbaseSchemaStatus schemaStatus = hbaseSchemaService.getSchemaStatus(namespace, changeSets);
    MatcherAssert.assertThat(schemaStatus, is(HbaseSchemaStatus.VALID_OUT_OF_DATE));
}
Also used : ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) ChangeSet(com.navercorp.pinpoint.hbase.schema.reader.core.ChangeSet) HbaseSchemaStatus(com.navercorp.pinpoint.hbase.schema.core.HbaseSchemaStatus) SchemaChangeLog(com.navercorp.pinpoint.hbase.schema.domain.SchemaChangeLog) Test(org.junit.Test)

Example 3 with HbaseSchemaStatus

use of com.navercorp.pinpoint.hbase.schema.core.HbaseSchemaStatus in project pinpoint by naver.

the class HbaseSchemaServiceImplTest method getSchemaStatus_validSchemaChangeLogs.

@Test
public void getSchemaStatus_validSchemaChangeLogs() {
    final String namespace = "namespace";
    final List<ChangeSet> changeSets = Arrays.asList(newChangeSet("id1", "value1"), newChangeSet("id2", "value2"), newChangeSet("id3", "value3"));
    final List<SchemaChangeLog> schemaChangeLogs = Arrays.asList(newSchemaChangeLog("id1", "value1", 1), newSchemaChangeLog("id2", "value2", 2), newSchemaChangeLog("id3", "value3", 3));
    when(schemaChangeLogService.isAvailable(namespace)).thenReturn(true);
    when(schemaChangeLogService.getSchemaChangeLogs(namespace)).thenReturn(schemaChangeLogs);
    HbaseSchemaStatus schemaStatus = hbaseSchemaService.getSchemaStatus(namespace, changeSets);
    MatcherAssert.assertThat(schemaStatus, is(HbaseSchemaStatus.VALID));
}
Also used : ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) ChangeSet(com.navercorp.pinpoint.hbase.schema.reader.core.ChangeSet) HbaseSchemaStatus(com.navercorp.pinpoint.hbase.schema.core.HbaseSchemaStatus) SchemaChangeLog(com.navercorp.pinpoint.hbase.schema.domain.SchemaChangeLog) Test(org.junit.Test)

Example 4 with HbaseSchemaStatus

use of com.navercorp.pinpoint.hbase.schema.core.HbaseSchemaStatus in project pinpoint by naver.

the class HbaseSchemaServiceImplTest method getSchemaStatus_invalidSchemaChangeLogs.

@Test
public void getSchemaStatus_invalidSchemaChangeLogs() {
    final String namespace = "namespace";
    final List<ChangeSet> changeSets = Arrays.asList(newChangeSet("id1", "value1"), newChangeSet("id2", "value2"), newChangeSet("id3", "value3"));
    final List<SchemaChangeLog> schemaChangeLogs = Arrays.asList(newSchemaChangeLog("id1", "value2", 2), newSchemaChangeLog("id2", "value1", 1), newSchemaChangeLog("someOtherId", "value3", 3));
    when(schemaChangeLogService.isAvailable(namespace)).thenReturn(true);
    when(schemaChangeLogService.getSchemaChangeLogs(namespace)).thenReturn(schemaChangeLogs);
    HbaseSchemaStatus schemaStatus = hbaseSchemaService.getSchemaStatus(namespace, changeSets);
    MatcherAssert.assertThat(schemaStatus, is(HbaseSchemaStatus.INVALID));
}
Also used : ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) ChangeSet(com.navercorp.pinpoint.hbase.schema.reader.core.ChangeSet) HbaseSchemaStatus(com.navercorp.pinpoint.hbase.schema.core.HbaseSchemaStatus) SchemaChangeLog(com.navercorp.pinpoint.hbase.schema.domain.SchemaChangeLog) Test(org.junit.Test)

Example 5 with HbaseSchemaStatus

use of com.navercorp.pinpoint.hbase.schema.core.HbaseSchemaStatus in project pinpoint by naver.

the class HbaseSchemaServiceImplTest method getSchemaStatus_noSchemaChangeLogs.

@Test
public void getSchemaStatus_noSchemaChangeLogs() {
    final String namespace = "namespace";
    final List<ChangeSet> changeSets = Arrays.asList(newChangeSet("id1", "value1"));
    when(schemaChangeLogService.isAvailable(namespace)).thenReturn(true);
    when(schemaChangeLogService.getSchemaChangeLogs(namespace)).thenReturn(Collections.emptyList());
    HbaseSchemaStatus schemaStatus = hbaseSchemaService.getSchemaStatus(namespace, changeSets);
    MatcherAssert.assertThat(schemaStatus, is(HbaseSchemaStatus.NONE));
}
Also used : ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) ChangeSet(com.navercorp.pinpoint.hbase.schema.reader.core.ChangeSet) HbaseSchemaStatus(com.navercorp.pinpoint.hbase.schema.core.HbaseSchemaStatus) Test(org.junit.Test)

Aggregations

HbaseSchemaStatus (com.navercorp.pinpoint.hbase.schema.core.HbaseSchemaStatus)5 ChangeSet (com.navercorp.pinpoint.hbase.schema.reader.core.ChangeSet)5 Test (org.junit.Test)5 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)5 SchemaChangeLog (com.navercorp.pinpoint.hbase.schema.domain.SchemaChangeLog)3