-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Shwetha N <[email protected]>
- Loading branch information
1 parent
ae62cc5
commit 5da65ce
Showing
7 changed files
with
574 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...ensor-collector/src/test/java/io/pravega/sensor/collector/file/FileIngestServiceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package io.pravega.sensor.collector.file; | ||
|
||
import io.pravega.sensor.collector.util.TransactionCoordinator; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.mockito.Mock; | ||
import org.mockito.MockitoAnnotations; | ||
|
||
import java.sql.SQLException; | ||
|
||
import static org.mockito.ArgumentMatchers.anyString; | ||
import static org.mockito.Mockito.doNothing; | ||
import static org.mockito.Mockito.when; | ||
|
||
public class FileIngestServiceTest { | ||
|
||
@Mock | ||
private FileProcessor processor; | ||
|
||
@BeforeEach | ||
public void setUp() throws SQLException { | ||
MockitoAnnotations.initMocks(this); | ||
|
||
} | ||
|
||
@Test | ||
public void watchFileTests() throws Exception { | ||
doNothing().when(processor).watchFiles(); | ||
|
||
} | ||
} |
81 changes: 81 additions & 0 deletions
81
...or-collector/src/test/java/io/pravega/sensor/collector/file/FileProcessorFactoryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package io.pravega.sensor.collector.file; | ||
|
||
import io.pravega.sensor.collector.file.csvfile.CsvFileSequenceProcessor; | ||
import io.pravega.sensor.collector.file.parquet.ParquetFileProcessor; | ||
import io.pravega.sensor.collector.file.rawfile.RawFileProcessor; | ||
import io.pravega.sensor.collector.util.EventWriter; | ||
import io.pravega.sensor.collector.util.TransactionCoordinator; | ||
import io.pravega.sensor.collector.util.TransactionStateInMemoryImpl; | ||
import io.pravega.sensor.collector.util.TransactionStateSQLiteImpl; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.mockito.Mock; | ||
import org.mockito.MockitoAnnotations; | ||
|
||
import java.sql.SQLException; | ||
|
||
import static org.mockito.Mockito.doNothing; | ||
|
||
public class FileProcessorFactoryTest { | ||
|
||
|
||
private FileConfig config; | ||
@Mock | ||
private EventWriter writer; | ||
@Mock | ||
private TransactionCoordinator transactionCoordinator; | ||
@Mock | ||
private TransactionStateInMemoryImpl state; | ||
|
||
@BeforeEach | ||
public void setUp() { | ||
MockitoAnnotations.initMocks(this); | ||
|
||
} | ||
|
||
/* | ||
* Test for creating Raw file processor | ||
*/ | ||
@Test | ||
public void createRAWFileProcessorTest() throws Exception { | ||
String stateDatabaseFileName = ":memory:"; | ||
config = new FileConfig(stateDatabaseFileName,"/opt/pravega-sensor-collector/Files/A","parquet","key12", | ||
"stream1","{}",10, false, | ||
true,20.0,"RawFileIngestService"); | ||
FileProcessor rawFileProcessor = FileProcessorFactory.createFileSequenceProcessor(config,state,writer,transactionCoordinator,"writerId"); | ||
|
||
Assertions.assertTrue(rawFileProcessor instanceof RawFileProcessor); | ||
|
||
} | ||
|
||
/* | ||
* Test for creating CSV file processor | ||
*/ | ||
@Test | ||
public void createCSVFileProcessorTest() throws Exception { | ||
String stateDatabaseFileName = ":memory:"; | ||
config = new FileConfig(stateDatabaseFileName,"/opt/pravega-sensor-collector/Files/A","parquet","key12", | ||
"stream1","{}",10, false, | ||
true,20.0,"CsvFileIngestService"); | ||
FileProcessor csvFileProcessor = FileProcessorFactory.createFileSequenceProcessor(config,state,writer,transactionCoordinator,"writerId"); | ||
|
||
Assertions.assertTrue(csvFileProcessor instanceof CsvFileSequenceProcessor); | ||
|
||
} | ||
|
||
/* | ||
* Test for creating PARQUET file processor | ||
*/ | ||
@Test | ||
public void createParquetFileProcessorTest() throws Exception { | ||
String stateDatabaseFileName = ":memory:"; | ||
config = new FileConfig(stateDatabaseFileName,"/opt/pravega-sensor-collector/Files/A","parquet","key12", | ||
"stream1","{}",10, false, | ||
true,20.0,"ParquetFileIngestService"); | ||
FileProcessor parquetFileProcessor = FileProcessorFactory.createFileSequenceProcessor(config,state,writer,transactionCoordinator,"writerId"); | ||
|
||
Assertions.assertTrue(parquetFileProcessor instanceof ParquetFileProcessor); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.