Skip to content

Commit

Permalink
Feature/podaac 6169: Regression tests (#74)
Browse files Browse the repository at this point in the history
* unit test against pre-saved ummg.json

* code cleanup

* upgrade Mockito libraries, change the way to initialize/close staticMock

---------

Co-authored-by: Yen, David (398B-Affiliate) <[email protected]>
  • Loading branch information
yenes56 and Yen, David (398B-Affiliate) committed Apr 24, 2024
1 parent 04bef97 commit b9aaddd
Show file tree
Hide file tree
Showing 27 changed files with 3,422 additions and 111 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Update to use CMA 2.0.0, thus allowing 2.0.3 layer for lambda
- Update build to use java 11
- To generate java 11 compatible UMMG schema POJOs, jsonschema2pojo shall make use of command line parameter: --target-version 1.11
- **PODAAC-6169**
- SWOT iso.xml
- OPERA iso.xml
- SWOT archive.xml
- .mp
- SWOT CalVal XML
- Does/does not cross the IDL
### Deprecated
### Removed
### Fixed
Expand Down
19 changes: 12 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-s3</artifactId>
<version>1.12.641</version>
<version>1.12.701</version>
</dependency>
<!-- For AWS Secret Manager -->
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-secretsmanager</artifactId>
<version>1.12.544</version>
<version>1.12.701</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
Expand Down Expand Up @@ -107,7 +107,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-reload4j</artifactId>
<version>1.7.36</version>
<version>2.0.13</version>
</dependency>
<dependency>
<groupId>com.vividsolutions</groupId>
Expand All @@ -120,17 +120,22 @@
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.17.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mockito/mockito-core -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>4.5.1</version>
<version>5.11.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-inline</artifactId>
<version>4.5.1</version>
<version>5.2.0</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api -->
Expand Down Expand Up @@ -213,8 +218,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public String PerformFunction(String input, Context context) throws Exception {
}

/*
Typically should only have 1 file tagged with "Data"
Typically should only have 1 file tagged as "data"
*/
//data location
String s3Location = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.io.IOException;
import java.math.BigDecimal;
import java.net.URISyntaxException;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.regex.Matcher;
Expand Down Expand Up @@ -99,7 +100,6 @@ public void readConfiguration(String file) throws IOException, ParseException {
(Boolean) metadata.get("rangeIs360"),
null,
additionalAttributes);

}

/**
Expand Down Expand Up @@ -1081,7 +1081,7 @@ public void writeJson(String outputLocation)
throws IOException, ParseException, URISyntaxException{
JSONObject granuleJson = createJson();
JSONUtils.cleanJSON(granuleJson);
FileUtils.writeStringToFile(new File(outputLocation), granuleJson.toJSONString());
FileUtils.writeStringToFile(new File(outputLocation), granuleJson.toJSONString(), StandardCharsets.UTF_8);
}

public Dataset getDataset(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ public UMMGranuleFile(Granule granule, Dataset dataset, boolean rangeIs360) {
this(granule, dataset,rangeIs360, new HashSet<MENDsIsoXMLSpatialTypeEnum>() );
}

public UMMGranuleFile() {
}

public UMMGranuleFile(Granule granule, Dataset dataset, boolean rangeIs360,
HashSet<MENDsIsoXMLSpatialTypeEnum> inputIsoXMLSpatialTypeEnumHashSet) {
this.granule = granule;
Expand Down
Loading

0 comments on commit b9aaddd

Please sign in to comment.