Skip to content

Commit

Permalink
2312 updated INotificationDataSinkMigratorTest
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaakKrut committed Mar 6, 2024
1 parent b229fb5 commit 58bf687
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
import org.apache.streampipes.extensions.api.extractor.IDataSinkParameterExtractor;
import org.apache.streampipes.model.graph.DataSinkInvocation;
import org.apache.streampipes.model.migration.MigrationResult;
import org.apache.streampipes.model.staticproperty.FreeTextStaticProperty;

import org.junit.Test;

import java.util.ArrayList;

import static org.apache.streampipes.wrapper.standalone.StreamPipesNotificationSink.DEFAULT_WAITING_TIME_MINUTES;
import static org.apache.streampipes.wrapper.standalone.StreamPipesNotificationSink.KEY_SILENT_PERIOD;
import static org.junit.Assert.*;
import static org.mockito.Mockito.mock;
Expand All @@ -16,7 +18,7 @@
public class INotificationDataSinkMigratorTest {

@Test
public void migrate() {
public void testNotificationDataSinkMigration() {

INotificationDataSinkMigrator migrator = spy(INotificationDataSinkMigrator.class);
IDataSinkParameterExtractor extractor = mock(IDataSinkParameterExtractor.class);
Expand All @@ -26,7 +28,10 @@ public void migrate() {

MigrationResult<DataSinkInvocation> result = migrator.migrate(dataSinkInvocation, extractor);

assertEquals(result.element().getStaticProperties().size(), 1);
assertEquals(result.element().getStaticProperties().get(0).getInternalName(), KEY_SILENT_PERIOD);
assertEquals(1, result.element().getStaticProperties().size());

var property = (FreeTextStaticProperty) result.element().getStaticProperties().get(0);
assertEquals(KEY_SILENT_PERIOD, property.getInternalName());
assertEquals(DEFAULT_WAITING_TIME_MINUTES, Integer.valueOf(property.getValue()).intValue());
}
}

0 comments on commit 58bf687

Please sign in to comment.