org.springframework.boot.test.EnvironmentTestUtils Java Examples
The following examples show how to use
org.springframework.boot.test.EnvironmentTestUtils.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FtpSinkPropertiesTests.java From spring-cloud-stream-app-starters with Apache License 2.0 | 5 votes |
@Test public void remoteDirCanBeCustomized() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(context, "ftp.remoteDir:/remote"); context.register(Conf.class); context.refresh(); FtpSinkProperties properties = context.getBean(FtpSinkProperties.class); assertThat(properties.getRemoteDir(), equalTo("/remote")); }
Example #2
Source File: DatasetSinkPropertiesTests.java From spring-cloud-stream-app-starters with Apache License 2.0 | 5 votes |
@Test public void allowNullValuesCanBeCustomized() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(context, "hdfs.dataset.allowNullValues:true"); context.register(Conf.class); context.refresh(); HdfsDatasetSinkProperties properties = context.getBean(HdfsDatasetSinkProperties.class); assertThat(properties.isAllowNullValues(), equalTo(true)); }
Example #3
Source File: SftpSourcePropertiesTests.java From spring-cloud-stream-app-starters with Apache License 2.0 | 5 votes |
@Test public void remoteDirCanBeCustomized() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(context, "sftp.remoteDir:/remote"); context.register(Conf.class); context.refresh(); SftpSourceProperties properties = context.getBean(SftpSourceProperties.class); assertThat(properties.getRemoteDir(), equalTo("/remote")); }
Example #4
Source File: JdbcSourcePropertiesTests.java From spring-cloud-stream-app-starters with Apache License 2.0 | 5 votes |
@Test public void queryCanBeCustomized() { String query = "select foo from bar"; EnvironmentTestUtils.addEnvironment(this.context, "jdbc.query:" + query); this.context.register(Conf.class); this.context.refresh(); JdbcSourceProperties properties = this.context.getBean(JdbcSourceProperties.class); assertThat(properties.getQuery(), equalTo(query)); }
Example #5
Source File: JdbcSourcePropertiesTests.java From spring-cloud-stream-app-starters with Apache License 2.0 | 5 votes |
@Test public void updateCanBeCustomized() { EnvironmentTestUtils.addEnvironment(this.context, "jdbc.query:select foo from bar where baz < 1"); String update = "update bar set baz=1 where foo in (:foo)"; EnvironmentTestUtils.addEnvironment(this.context, "jdbc.update:" + update); this.context.register(Conf.class); this.context.refresh(); JdbcSourceProperties properties = this.context.getBean(JdbcSourceProperties.class); assertThat(properties.getUpdate(), equalTo(update)); }
Example #6
Source File: SftpSourcePropertiesTests.java From spring-cloud-stream-app-starters with Apache License 2.0 | 5 votes |
@Test public void preserveTimestampDirCanBeDisabled() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(context, "sftp.preserveTimestamp:false"); context.register(Conf.class); context.refresh(); SftpSourceProperties properties = context.getBean(SftpSourceProperties.class); assertTrue(!properties.isPreserveTimestamp()); }
Example #7
Source File: SftpSourcePropertiesTests.java From spring-cloud-stream-app-starters with Apache License 2.0 | 5 votes |
@Test public void filenamePatternCanBeCustomized() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(context, "sftp.filenamePattern:*.foo"); context.register(Conf.class); context.refresh(); SftpSourceProperties properties = context.getBean(SftpSourceProperties.class); assertThat(properties.getFilenamePattern(), equalTo("*.foo")); }
Example #8
Source File: HdfsSinkPropertiesTests.java From spring-cloud-stream-app-starters with Apache License 2.0 | 5 votes |
@Test public void idleTimeoutCanBeCustomized() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(context, "hdfs.idleTimeout:12345"); context.register(Conf.class); context.refresh(); HdfsSinkProperties properties = context.getBean(HdfsSinkProperties.class); assertThat(properties.getIdleTimeout(), equalTo(12345L)); }
Example #9
Source File: HdfsSinkPropertiesTests.java From spring-cloud-stream-app-starters with Apache License 2.0 | 5 votes |
@Test public void closeTimeoutCanBeCustomized() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(context, "hdfs.closeTimeout:12345"); context.register(Conf.class); context.refresh(); HdfsSinkProperties properties = context.getBean(HdfsSinkProperties.class); assertThat(properties.getCloseTimeout(), equalTo(12345L)); }
Example #10
Source File: SftpSourcePropertiesTests.java From spring-cloud-stream-app-starters with Apache License 2.0 | 5 votes |
@Test public void deleteRemoteFilesCanBeEnabled() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(context, "sftp.deleteRemoteFiles:true"); context.register(Conf.class); context.refresh(); SftpSourceProperties properties = context.getBean(SftpSourceProperties.class); assertTrue(properties.isDeleteRemoteFiles()); }
Example #11
Source File: SftpSourcePropertiesTests.java From spring-cloud-stream-app-starters with Apache License 2.0 | 5 votes |
@Test public void filenameRegexCanBeCustomized() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(context, "sftp.filenameRegex:.*\\.foo"); context.register(Conf.class); context.refresh(); SftpSourceProperties properties = context.getBean(SftpSourceProperties.class); assertThat(properties.getFilenameRegex().toString(), equalTo(".*\\.foo")); }
Example #12
Source File: FtpSinkPropertiesTests.java From spring-cloud-stream-app-starters with Apache License 2.0 | 5 votes |
@Test public void remoteFileSeparatorCanBeCustomized() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(context, "ftp.remoteFileSeparator:\\"); context.register(Conf.class); context.refresh(); FtpSinkProperties properties = context.getBean(FtpSinkProperties.class); assertThat(properties.getRemoteFileSeparator(), equalTo("\\")); }
Example #13
Source File: FtpSinkPropertiesTests.java From spring-cloud-stream-app-starters with Apache License 2.0 | 5 votes |
@Test public void tmpFileRemoteDirCanBeCustomized() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(context, "ftp.temporaryRemoteDir:/foo"); context.register(Conf.class); context.refresh(); FtpSinkProperties properties = context.getBean(FtpSinkProperties.class); assertThat(properties.getTemporaryRemoteDir(), equalTo("/foo")); }
Example #14
Source File: DatasetSinkPropertiesTests.java From spring-cloud-stream-app-starters with Apache License 2.0 | 5 votes |
@Test public void partitionPathCanBeCustomized() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(context, "hdfs.dataset.partitionPath:year('timestamp')"); context.register(Conf.class); context.refresh(); HdfsDatasetSinkProperties properties = context.getBean(HdfsDatasetSinkProperties.class); assertThat(properties.getPartitionPath(), equalTo("year('timestamp')")); }
Example #15
Source File: FtpSinkPropertiesTests.java From spring-cloud-stream-app-starters with Apache License 2.0 | 5 votes |
@Test public void autoCreateDirCanBeDisabled() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(context, "ftp.autoCreateDir:false"); context.register(Conf.class); context.refresh(); FtpSinkProperties properties = context.getBean(FtpSinkProperties.class); assertTrue(!properties.isAutoCreateDir()); }
Example #16
Source File: FtpSinkPropertiesTests.java From spring-cloud-stream-app-starters with Apache License 2.0 | 5 votes |
@Test public void useTemporaryFileNameCanBeCustomized() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(context, "ftp.useTemporaryFilename:false"); context.register(Conf.class); context.refresh(); FtpSinkProperties properties = context.getBean(FtpSinkProperties.class); assertFalse(properties.isUseTemporaryFilename()); }
Example #17
Source File: AmazonS3SinkPropertiesTests.java From spring-cloud-stream-app-starters with Apache License 2.0 | 5 votes |
@Test public void s3BucketCanBeCustomized() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(context, "s3.bucket:foo"); context.register(Conf.class); context.refresh(); AmazonS3SinkProperties properties = context.getBean(AmazonS3SinkProperties.class); assertThat(properties.getBucket(), equalTo("foo")); context.close(); }
Example #18
Source File: FtpSourcePropertiesTests.java From spring-cloud-stream-app-starters with Apache License 2.0 | 5 votes |
@Test public void remoteFileSeparatorCanBeCustomized() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(context, "ftp.remoteFileSeparator:\\"); context.register(Conf.class); context.refresh(); FtpSourceProperties properties = context.getBean(FtpSourceProperties.class); assertThat(properties.getRemoteFileSeparator(), equalTo("\\")); }
Example #19
Source File: HdfsSinkPropertiesTests.java From spring-cloud-stream-app-starters with Apache License 2.0 | 5 votes |
@Test public void partitionPathCanBeCustomized() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(context, "hdfs.partitionPath:dateFormat('yyyy/MM/dd')"); context.register(Conf.class); context.refresh(); HdfsSinkProperties properties = context.getBean(HdfsSinkProperties.class); assertThat(properties.getPartitionPath(), equalTo("dateFormat('yyyy/MM/dd')")); }
Example #20
Source File: DatasetSinkPropertiesTests.java From spring-cloud-stream-app-starters with Apache License 2.0 | 5 votes |
@Test public void directoryCanBeCustomized() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(context, "hdfs.dataset.directory:/tmp/test"); context.register(Conf.class); context.refresh(); HdfsDatasetSinkProperties properties = context.getBean(HdfsDatasetSinkProperties.class); assertThat(properties.getDirectory(), equalTo("/tmp/test")); }
Example #21
Source File: FtpSourcePropertiesTests.java From spring-cloud-stream-app-starters with Apache License 2.0 | 5 votes |
@Test public void autoCreateLocalDirCanBeDisabled() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(context, "ftp.autoCreateLocalDir:false"); context.register(Conf.class); context.refresh(); FtpSourceProperties properties = context.getBean(FtpSourceProperties.class); assertTrue(!properties.isAutoCreateLocalDir()); }
Example #22
Source File: FtpSourcePropertiesTests.java From spring-cloud-stream-app-starters with Apache License 2.0 | 5 votes |
@Test public void deleteRemoteFilesCanBeEnabled() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(context, "ftp.deleteRemoteFiles:true"); context.register(Conf.class); context.refresh(); FtpSourceProperties properties = context.getBean(FtpSourceProperties.class); assertTrue(properties.isDeleteRemoteFiles()); }
Example #23
Source File: CassandraSinkPropertiesTests.java From spring-cloud-stream-app-starters with Apache License 2.0 | 5 votes |
@Test public void ingestQueryCanBeCustomized() { String query = "insert into book (isbn, title, author) values (?, ?, ?)"; AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(context, "cassandra.ingest-query:" + query); context.register(Conf.class); context.refresh(); CassandraSinkProperties properties = context.getBean(CassandraSinkProperties.class); assertThat(properties.getIngestQuery(), equalTo(query)); context.close(); }
Example #24
Source File: FtpSourcePropertiesTests.java From spring-cloud-stream-app-starters with Apache License 2.0 | 5 votes |
@Test public void localDirCanBeCustomized() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(context, "ftp.localDir:local"); context.register(Conf.class); context.refresh(); FtpSourceProperties properties = context.getBean(FtpSourceProperties.class); assertThat(properties.getLocalDir(), equalTo(new File("local"))); }
Example #25
Source File: DatasetSinkPropertiesTests.java From spring-cloud-stream-app-starters with Apache License 2.0 | 5 votes |
@Test public void writerCacheSizeCanBeCustomized() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(context, "hdfs.dataset.writerCacheSize:20"); context.register(Conf.class); context.refresh(); HdfsDatasetSinkProperties properties = context.getBean(HdfsDatasetSinkProperties.class); assertThat(properties.getWriterCacheSize(), equalTo(20)); }
Example #26
Source File: CassandraSinkPropertiesTests.java From spring-cloud-stream-app-starters with Apache License 2.0 | 5 votes |
@Test public void queryTypeCanBeCustomized() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(context, "cassandra.query-type:" + CassandraMessageHandler.Type.UPDATE); context.register(Conf.class); context.refresh(); CassandraSinkProperties properties = context.getBean(CassandraSinkProperties.class); assertThat(properties.getQueryType(), equalTo(CassandraMessageHandler.Type.UPDATE)); context.close(); }
Example #27
Source File: SparkClientTaskPropertiesTests.java From spring-cloud-task-app-starters with Apache License 2.0 | 5 votes |
@Test public void testResourceArchivesCanBeCustomized() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(context, "spark.app-class: Dummy"); EnvironmentTestUtils.addEnvironment(context, "spark.app-jar: dummy.jar"); EnvironmentTestUtils.addEnvironment(context, "spark.resource-archives: foo.jar,bar.jar"); context.register(Conf.class); context.refresh(); SparkClientTaskProperties properties = context.getBean(SparkClientTaskProperties.class); assertThat(properties.getResourceArchives(), equalTo("foo.jar,bar.jar")); }
Example #28
Source File: SparkClientTaskPropertiesTests.java From spring-cloud-task-app-starters with Apache License 2.0 | 5 votes |
@Test public void testResourceFilesCanBeCustomized() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(context, "spark.app-class: Dummy"); EnvironmentTestUtils.addEnvironment(context, "spark.app-jar: dummy.jar"); EnvironmentTestUtils.addEnvironment(context, "spark.resource-files: test.txt"); context.register(Conf.class); context.refresh(); SparkClientTaskProperties properties = context.getBean(SparkClientTaskProperties.class); assertThat(properties.getResourceFiles(), equalTo("test.txt")); }
Example #29
Source File: SparkClientTaskPropertiesTests.java From spring-cloud-task-app-starters with Apache License 2.0 | 5 votes |
@Test public void testAppArgsCanBeCustomized() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(context, "spark.app-class: Dummy"); EnvironmentTestUtils.addEnvironment(context, "spark.app-jar: dummy.jar"); EnvironmentTestUtils.addEnvironment(context, "spark.app-args: arg1,arg2"); context.register(Conf.class); context.refresh(); SparkClientTaskProperties properties = context.getBean(SparkClientTaskProperties.class); assertThat(properties.getAppArgs(), equalTo(new String[]{"arg1", "arg2"})); }
Example #30
Source File: HdfsSinkPropertiesTests.java From spring-cloud-stream-app-starters with Apache License 2.0 | 5 votes |
@Test public void fileUuidCanBeCustomized() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(context, "hdfs.fileUuid:true"); context.register(Conf.class); context.refresh(); HdfsSinkProperties properties = context.getBean(HdfsSinkProperties.class); assertThat(properties.isFileUuid(), equalTo(true)); }