Search in sources :

Example 1 with MigrationCompleted

use of org.graylog.plugins.views.migrations.V20200204122000_MigrateUntypedViewsToDashboards.V20200204122000_MigrateUntypedViewsToDashboards.MigrationCompleted in project graylog2-server by Graylog2.

the class V20200204122000_MigrateUntypedViewsToDashboardsTest method doesNotChangeTypedViews.

@Test
@MongoDBFixtures("V20200204122000_MigrateUntypedViewsToDashboardsTest/typed_views.json")
public void doesNotChangeTypedViews() throws Exception {
    this.migration.upgrade();
    final MigrationCompleted migrationCompleted = captureMigrationCompleted();
    assertThat(migrationCompleted.viewIds()).isEmpty();
    verify(this.viewsCollection, times(1)).find(any(Bson.class));
    verify(this.viewsCollection, never()).updateOne(any(BasicDBObject.class), any(Document.class));
    verify(this.searchesCollection, never()).updateOne(any(BasicDBObject.class), any(Document.class));
}
Also used : BasicDBObject(com.mongodb.BasicDBObject) Document(org.bson.Document) MigrationCompleted(org.graylog.plugins.views.migrations.V20200204122000_MigrateUntypedViewsToDashboards.V20200204122000_MigrateUntypedViewsToDashboards.MigrationCompleted) Bson(org.bson.conversions.Bson) MongoDBFixtures(org.graylog.testing.mongodb.MongoDBFixtures) Test(org.junit.Test)

Example 2 with MigrationCompleted

use of org.graylog.plugins.views.migrations.V20200204122000_MigrateUntypedViewsToDashboards.V20200204122000_MigrateUntypedViewsToDashboards.MigrationCompleted in project graylog2-server by Graylog2.

the class V20200204122000_MigrateUntypedViewsToDashboardsTest method assertViewsMigrated.

private void assertViewsMigrated(String... viewId) {
    final MigrationCompleted migrationCompleted = captureMigrationCompleted();
    assertThat(migrationCompleted.viewIds()).containsExactlyInAnyOrder(viewId);
}
Also used : MigrationCompleted(org.graylog.plugins.views.migrations.V20200204122000_MigrateUntypedViewsToDashboards.V20200204122000_MigrateUntypedViewsToDashboards.MigrationCompleted)

Example 3 with MigrationCompleted

use of org.graylog.plugins.views.migrations.V20200204122000_MigrateUntypedViewsToDashboards.V20200204122000_MigrateUntypedViewsToDashboards.MigrationCompleted in project graylog2-server by Graylog2.

the class V20200204122000_MigrateUntypedViewsToDashboardsTest method writesMigrationCompletedAfterSuccess.

@Test
public void writesMigrationCompletedAfterSuccess() {
    this.migration.upgrade();
    final MigrationCompleted migrationCompleted = captureMigrationCompleted();
    assertThat(migrationCompleted.viewIds()).isEmpty();
}
Also used : MigrationCompleted(org.graylog.plugins.views.migrations.V20200204122000_MigrateUntypedViewsToDashboards.V20200204122000_MigrateUntypedViewsToDashboards.MigrationCompleted) Test(org.junit.Test)

Aggregations

MigrationCompleted (org.graylog.plugins.views.migrations.V20200204122000_MigrateUntypedViewsToDashboards.V20200204122000_MigrateUntypedViewsToDashboards.MigrationCompleted)3 Test (org.junit.Test)2 BasicDBObject (com.mongodb.BasicDBObject)1 Document (org.bson.Document)1 Bson (org.bson.conversions.Bson)1 MongoDBFixtures (org.graylog.testing.mongodb.MongoDBFixtures)1