added integration test

Project: http://git-wip-us.apache.org/repos/asf/incubator-sdap-ningester/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-sdap-ningester/commit/36c25b51
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-sdap-ningester/tree/36c25b51
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-sdap-ningester/diff/36c25b51

Branch: refs/heads/master
Commit: 36c25b51d1465512c65fced81f1537f1f24b08ab
Parents: 377975a
Author: Frank Greguska <[email protected]>
Authored: Thu Oct 12 17:58:29 2017 -0700
Committer: Frank Greguska <[email protected]>
Committed: Thu Oct 12 17:58:29 2017 -0700

----------------------------------------------------------------------
 build.gradle                                    |   1 +
 gradle/wrapper/gradle-wrapper.jar               | Bin 54711 -> 54711 bytes
 gradle/wrapper/gradle-wrapper.properties        |   2 +-
 .../ningester/NingesterApplicationTests.java    |  38 +++++++++++++++++++
 src/test/resources/application.properties       |   1 +
 ...HRSST-SSTblend-AVHRR_OI-GLOB-v02.0-fv02.0.nc | Bin 0 -> 1057327 bytes
 6 files changed, 41 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-sdap-ningester/blob/36c25b51/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index c2076a0..2246bed 100644
--- a/build.gradle
+++ b/build.gradle
@@ -41,4 +41,5 @@ dependencies {
     compile group: 'com.google.guava', name: 'guava'
 
     testCompile('org.springframework.boot:spring-boot-starter-test')
+       testCompile('org.springframework.batch:spring-batch-test')
 }

http://git-wip-us.apache.org/repos/asf/incubator-sdap-ningester/blob/36c25b51/gradle/wrapper/gradle-wrapper.jar
----------------------------------------------------------------------
diff --git a/gradle/wrapper/gradle-wrapper.jar 
b/gradle/wrapper/gradle-wrapper.jar
index 391f298..abaa743 100644
Binary files a/gradle/wrapper/gradle-wrapper.jar and 
b/gradle/wrapper/gradle-wrapper.jar differ

http://git-wip-us.apache.org/repos/asf/incubator-sdap-ningester/blob/36c25b51/gradle/wrapper/gradle-wrapper.properties
----------------------------------------------------------------------
diff --git a/gradle/wrapper/gradle-wrapper.properties 
b/gradle/wrapper/gradle-wrapper.properties
index e1d4367..ec6a0c3 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,4 +1,4 @@
-#Thu Oct 12 10:22:24 PDT 2017
+#Thu Oct 12 17:50:39 PDT 2017
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME

http://git-wip-us.apache.org/repos/asf/incubator-sdap-ningester/blob/36c25b51/src/test/java/gov/nasa/jpl/nexus/ningester/NingesterApplicationTests.java
----------------------------------------------------------------------
diff --git 
a/src/test/java/gov/nasa/jpl/nexus/ningester/NingesterApplicationTests.java 
b/src/test/java/gov/nasa/jpl/nexus/ningester/NingesterApplicationTests.java
index 6e3e94e..f486419 100644
--- a/src/test/java/gov/nasa/jpl/nexus/ningester/NingesterApplicationTests.java
+++ b/src/test/java/gov/nasa/jpl/nexus/ningester/NingesterApplicationTests.java
@@ -1,16 +1,54 @@
 package gov.nasa.jpl.nexus.ningester;
 
+import gov.nasa.jpl.nexus.ningester.configuration.BatchConfig;
+import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.springframework.batch.core.JobExecution;
+import org.springframework.batch.core.JobParameters;
+import org.springframework.batch.core.JobParametersBuilder;
+import org.springframework.batch.test.JobLauncherTestUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Import;
+import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
+import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
 import org.springframework.test.context.junit4.SpringRunner;
 
+import javax.sql.DataSource;
+
 @RunWith(SpringRunner.class)
 @SpringBootTest
 public class NingesterApplicationTests {
 
+       @Configuration
+       @Import({BatchConfig.class})
+       static class NingesterApplicationTestsConfig{
+               @Bean
+               JobLauncherTestUtils jobLauncherTestUtils(){
+                       return new JobLauncherTestUtils();
+               }
+
+       }
+
+       @Autowired JobLauncherTestUtils jobLauncherTestUtils;
+
        @Test
        public void contextLoads() {
        }
 
+       @Test
+       public void testJobCompletes() throws Exception {
+
+               JobParameters jobParameters = new JobParametersBuilder()
+                               .addString("granule", 
"classpath:granules/20050101120000-NCEI-L4_GHRSST-SSTblend-AVHRR_OI-GLOB-v02.0-fv02.0.nc")
+                               .toJobParameters();
+
+               JobExecution jobExecution = 
jobLauncherTestUtils.launchJob(jobParameters);
+
+               Assert.assertEquals("COMPLETED", 
jobExecution.getExitStatus().getExitCode());
+       }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-sdap-ningester/blob/36c25b51/src/test/resources/application.properties
----------------------------------------------------------------------
diff --git a/src/test/resources/application.properties 
b/src/test/resources/application.properties
new file mode 100644
index 0000000..132728a
--- /dev/null
+++ b/src/test/resources/application.properties
@@ -0,0 +1 @@
+spring.batch.job.enabled=false
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-sdap-ningester/blob/36c25b51/src/test/resources/granules/20050101120000-NCEI-L4_GHRSST-SSTblend-AVHRR_OI-GLOB-v02.0-fv02.0.nc
----------------------------------------------------------------------
diff --git 
a/src/test/resources/granules/20050101120000-NCEI-L4_GHRSST-SSTblend-AVHRR_OI-GLOB-v02.0-fv02.0.nc
 
b/src/test/resources/granules/20050101120000-NCEI-L4_GHRSST-SSTblend-AVHRR_OI-GLOB-v02.0-fv02.0.nc
new file mode 100644
index 0000000..4935c81
Binary files /dev/null and 
b/src/test/resources/granules/20050101120000-NCEI-L4_GHRSST-SSTblend-AVHRR_OI-GLOB-v02.0-fv02.0.nc
 differ

Reply via email to