Search in sources :

Example 21 with SchemaChangeLog

use of com.navercorp.pinpoint.hbase.schema.domain.SchemaChangeLog in project pinpoint by naver.

the class ChangeSetManagerTest method filterExecutedChangeSets_invalidOrder.

@Test(expected = IllegalArgumentException.class)
public void filterExecutedChangeSets_invalidOrder() {
    ChangeSet changeSet1 = newChangeSet("id1", "value1");
    List<ChangeSet> changeSets = Arrays.asList(changeSet1);
    List<SchemaChangeLog> schemaChangeLogs = Arrays.asList(newSchemaChangeLog("id1", "value1", 2));
    ChangeSetManager changeSetManager = new ChangeSetManager(changeSets);
    changeSetManager.filterExecutedChangeSets(schemaChangeLogs);
}
Also used : ChangeSet(com.navercorp.pinpoint.hbase.schema.reader.core.ChangeSet) SchemaChangeLog(com.navercorp.pinpoint.hbase.schema.domain.SchemaChangeLog) Test(org.junit.Test)

Example 22 with SchemaChangeLog

use of com.navercorp.pinpoint.hbase.schema.domain.SchemaChangeLog in project pinpoint by naver.

the class ChangeSetManagerTest method getExecutedChangeSets_invalidOrder.

@Test(expected = IllegalArgumentException.class)
public void getExecutedChangeSets_invalidOrder() {
    ChangeSet changeSet1 = newChangeSet("id1", "value1");
    List<ChangeSet> changeSets = Arrays.asList(changeSet1);
    List<SchemaChangeLog> schemaChangeLogs = Arrays.asList(newSchemaChangeLog("id1", "value1", 2));
    ChangeSetManager changeSetManager = new ChangeSetManager(changeSets);
    changeSetManager.getExecutedChangeSets(schemaChangeLogs);
}
Also used : ChangeSet(com.navercorp.pinpoint.hbase.schema.reader.core.ChangeSet) SchemaChangeLog(com.navercorp.pinpoint.hbase.schema.domain.SchemaChangeLog) Test(org.junit.Test)

Example 23 with SchemaChangeLog

use of com.navercorp.pinpoint.hbase.schema.domain.SchemaChangeLog in project pinpoint by naver.

the class ChangeSetManagerTest method getExecutedChangeSets_invalidId.

@Test(expected = IllegalArgumentException.class)
public void getExecutedChangeSets_invalidId() {
    ChangeSet changeSet = newChangeSet("id1", "value1");
    List<ChangeSet> changeSets = Arrays.asList(changeSet);
    List<SchemaChangeLog> schemaChangeLogs = Arrays.asList(newSchemaChangeLog("id2", "value1", 1));
    ChangeSetManager changeSetManager = new ChangeSetManager(changeSets);
    changeSetManager.getExecutedChangeSets(schemaChangeLogs);
}
Also used : ChangeSet(com.navercorp.pinpoint.hbase.schema.reader.core.ChangeSet) SchemaChangeLog(com.navercorp.pinpoint.hbase.schema.domain.SchemaChangeLog) Test(org.junit.Test)

Example 24 with SchemaChangeLog

use of com.navercorp.pinpoint.hbase.schema.domain.SchemaChangeLog in project pinpoint by naver.

the class ChangeSetManagerTest method filterExecutedChangeSets.

@Test
public void filterExecutedChangeSets() {
    ChangeSet changeSet1 = newChangeSet("id1", "value1");
    ChangeSet changeSet2 = newChangeSet("id2", "value2");
    ChangeSet changeSet3 = newChangeSet("id3", "value3");
    ChangeSet changeSet4 = newChangeSet("id4", "value4");
    List<ChangeSet> changeSets = Arrays.asList(changeSet1, changeSet2, changeSet3, changeSet4);
    List<SchemaChangeLog> schemaChangeLogs = newSchemaChangeLogs(changeSet1);
    ChangeSetManager changeSetManager = new ChangeSetManager(changeSets);
    List<ChangeSet> filteredChangeSets = changeSetManager.filterExecutedChangeSets(schemaChangeLogs);
    assertThat(filteredChangeSets, contains(changeSet2, changeSet3, changeSet4));
}
Also used : ChangeSet(com.navercorp.pinpoint.hbase.schema.reader.core.ChangeSet) SchemaChangeLog(com.navercorp.pinpoint.hbase.schema.domain.SchemaChangeLog) Test(org.junit.Test)

Example 25 with SchemaChangeLog

use of com.navercorp.pinpoint.hbase.schema.domain.SchemaChangeLog in project pinpoint by naver.

the class SchemaChangeLogServiceImplTest method recordChangeSet_withExecutionOrder.

@Test
public void recordChangeSet_withExecutionOrder() {
    // Given
    final ChangeSet changeSet = newChangeSet("id1");
    final int executionOrder = random.nextInt(100) + 1;
    doNothing().when(schemaChangeLogDao).insertChangeLog(anyString(), any(SchemaChangeLog.class));
    // When
    SchemaChangeLog schemaChangeLog = schemaChangeLogService.recordChangeSet("namespace", executionOrder, changeSet);
    // Then
    MatcherAssert.assertThat(schemaChangeLog.getId(), equalTo(changeSet.getId()));
    MatcherAssert.assertThat(schemaChangeLog.getExecOrder(), equalTo(executionOrder));
}
Also used : ChangeSet(com.navercorp.pinpoint.hbase.schema.reader.core.ChangeSet) SchemaChangeLog(com.navercorp.pinpoint.hbase.schema.domain.SchemaChangeLog) Test(org.junit.Test)

Aggregations

SchemaChangeLog (com.navercorp.pinpoint.hbase.schema.domain.SchemaChangeLog)29 ChangeSet (com.navercorp.pinpoint.hbase.schema.reader.core.ChangeSet)23 Test (org.junit.Test)20 ArrayList (java.util.ArrayList)10 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)5 HbaseSchemaStatus (com.navercorp.pinpoint.hbase.schema.core.HbaseSchemaStatus)3 ChangeSetManager (com.navercorp.pinpoint.hbase.schema.core.ChangeSetManager)1 CheckSum (com.navercorp.pinpoint.hbase.schema.core.CheckSum)1 HbaseSchemaCommandManager (com.navercorp.pinpoint.hbase.schema.core.command.HbaseSchemaCommandManager)1 HashSet (java.util.HashSet)1 TreeMap (java.util.TreeMap)1