Search in sources :

Example 6 with SchemaChangeLog

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

the class ChangeSetManagerTest method getExecutedChangeSets_largerSchemaChangeLogs.

@Test
public void getExecutedChangeSets_largerSchemaChangeLogs() {
    ChangeSet changeSet = newChangeSet("id1", "value1");
    ChangeSetManager changeSetManager = new ChangeSetManager(Arrays.asList(changeSet));
    List<SchemaChangeLog> schemaChangeLogs = Arrays.asList(newSchemaChangeLog("id1", "value1", 1), newSchemaChangeLog("id2", "value2", 2));
    List<ChangeSet> executedChangeSets = changeSetManager.getExecutedChangeSets(schemaChangeLogs);
    assertThat(executedChangeSets, hasSize(1));
    assertThat(executedChangeSets, contains(changeSet));
}
Also used : ChangeSet(com.navercorp.pinpoint.hbase.schema.reader.core.ChangeSet) SchemaChangeLog(com.navercorp.pinpoint.hbase.schema.domain.SchemaChangeLog) Test(org.junit.Test)

Example 7 with SchemaChangeLog

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

the class ChangeSetManagerTest method filterExecutedChangeSets_invalidCheckSum.

@Test(expected = IllegalArgumentException.class)
public void filterExecutedChangeSets_invalidCheckSum() {
    ChangeSet changeSet = newChangeSet("id1", "value1");
    List<ChangeSet> changeSets = Arrays.asList(changeSet);
    CheckSum invalidCheckSum = CheckSum.compute(CheckSum.getCurrentVersion(), "value2");
    List<SchemaChangeLog> schemaChangeLogs = Arrays.asList(newSchemaChangeLog("id1", "value1", invalidCheckSum, 1));
    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 8 with SchemaChangeLog

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

the class ChangeSetManagerTest method newSchemaChangeLogs.

private List<SchemaChangeLog> newSchemaChangeLogs(ChangeSet... changeSets) {
    List<SchemaChangeLog> schemaChangeLogs = new ArrayList<>();
    int execOrder = 1;
    for (ChangeSet changeSet : changeSets) {
        schemaChangeLogs.add(new SchemaChangeLog.Builder().id(changeSet.getId()).value(changeSet.getValue()).checkSum(CheckSum.compute(CheckSum.getCurrentVersion(), changeSet.getValue())).execOrder(execOrder++).build());
    }
    return schemaChangeLogs;
}
Also used : ArrayList(java.util.ArrayList) ChangeSet(com.navercorp.pinpoint.hbase.schema.reader.core.ChangeSet) SchemaChangeLog(com.navercorp.pinpoint.hbase.schema.domain.SchemaChangeLog)

Example 9 with SchemaChangeLog

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

the class ChangeSetManagerTest method getExecutedChangeSets_invalidCheckSum.

@Test(expected = IllegalArgumentException.class)
public void getExecutedChangeSets_invalidCheckSum() {
    ChangeSet changeSet = newChangeSet("id1", "value1");
    List<ChangeSet> changeSets = Arrays.asList(changeSet);
    CheckSum invalidCheckSum = CheckSum.compute(CheckSum.getCurrentVersion(), "value2");
    List<SchemaChangeLog> schemaChangeLogs = Arrays.asList(newSchemaChangeLog("id1", "value1", invalidCheckSum, 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 10 with SchemaChangeLog

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

the class ChangeSetManagerTest method filterExecutedChangeSets_invalidId.

@Test(expected = IllegalArgumentException.class)
public void filterExecutedChangeSets_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.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)

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