Search in sources :

Example 31 with ChangeSet

use of com.navercorp.pinpoint.hbase.schema.reader.core.ChangeSet 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 32 with ChangeSet

use of com.navercorp.pinpoint.hbase.schema.reader.core.ChangeSet 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 33 with ChangeSet

use of com.navercorp.pinpoint.hbase.schema.reader.core.ChangeSet 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 34 with ChangeSet

use of com.navercorp.pinpoint.hbase.schema.reader.core.ChangeSet 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 35 with ChangeSet

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

the class HbaseSchemaCommandManagerTest method modifyingNonExistingTableShouldFail.

@Test(expected = InvalidHbaseSchemaException.class)
public void modifyingNonExistingTableShouldFail() {
    String namespace = "namespace";
    String tableName = "table";
    String nonExistingTableName = "anotherTable";
    HTableDescriptor existingTable = createHtd(namespace, tableName, "CF");
    HbaseSchemaCommandManager manager = new HbaseSchemaCommandManager(namespace, null, Arrays.asList(existingTable));
    TableChange modifyTableChange = newTableChange(ChangeType.MODIFY, nonExistingTableName);
    ChangeSet modifyTableChangeSet = newChangeSet(modifyTableChange);
    manager.applyChangeSet(modifyTableChangeSet);
}
Also used : ChangeSet(com.navercorp.pinpoint.hbase.schema.reader.core.ChangeSet) HTableDescriptor(org.apache.hadoop.hbase.HTableDescriptor) CreateTableChange(com.navercorp.pinpoint.hbase.schema.reader.core.CreateTableChange) TableChange(com.navercorp.pinpoint.hbase.schema.reader.core.TableChange) ModifyTableChange(com.navercorp.pinpoint.hbase.schema.reader.core.ModifyTableChange) Test(org.junit.Test)

Aggregations

ChangeSet (com.navercorp.pinpoint.hbase.schema.reader.core.ChangeSet)39 Test (org.junit.Test)28 SchemaChangeLog (com.navercorp.pinpoint.hbase.schema.domain.SchemaChangeLog)23 ArrayList (java.util.ArrayList)8 TableChange (com.navercorp.pinpoint.hbase.schema.reader.core.TableChange)7 CreateTableChange (com.navercorp.pinpoint.hbase.schema.reader.core.CreateTableChange)6 ModifyTableChange (com.navercorp.pinpoint.hbase.schema.reader.core.ModifyTableChange)6 HTableDescriptor (org.apache.hadoop.hbase.HTableDescriptor)6 HbaseSchemaStatus (com.navercorp.pinpoint.hbase.schema.core.HbaseSchemaStatus)5 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)5 CreateColumnFamilyChange (com.navercorp.pinpoint.hbase.schema.reader.core.CreateColumnFamilyChange)4 ColumnFamilyChange (com.navercorp.pinpoint.hbase.schema.reader.core.ColumnFamilyChange)3 HbaseAdminOperation (com.navercorp.pinpoint.common.hbase.HbaseAdminOperation)2 ChangeSetManager (com.navercorp.pinpoint.hbase.schema.core.ChangeSetManager)2 HbaseSchemaCommandManager (com.navercorp.pinpoint.hbase.schema.core.command.HbaseSchemaCommandManager)2 InvalidHbaseSchemaException (com.navercorp.pinpoint.hbase.schema.reader.InvalidHbaseSchemaException)2 ColumnFamilyConfiguration (com.navercorp.pinpoint.hbase.schema.reader.core.ColumnFamilyConfiguration)2 TableCommand (com.navercorp.pinpoint.hbase.schema.core.command.TableCommand)1 HbaseSchemaParseException (com.navercorp.pinpoint.hbase.schema.reader.HbaseSchemaParseException)1 TableConfiguration (com.navercorp.pinpoint.hbase.schema.reader.core.TableConfiguration)1