Skip to content

Commit c75d7be

Browse files
committed
release: v1.7.3
1 parent 091bb06 commit c75d7be

File tree

40 files changed

+445
-438
lines changed

40 files changed

+445
-438
lines changed

base/src/main/java/eu/openanalytics/rdepot/base/technology/InternalTechnology.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public String getName() {
4646

4747
@Override
4848
public String getVersion() {
49-
return "1.7.2";
49+
return "1.7.3";
5050
}
5151

5252
@Override

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ ext.buildTime = {
4141
}
4242

4343
group = 'eu.openanalytics'
44-
ext.versionNumber = '1.7.2'
44+
ext.versionNumber = '1.7.3'
4545
ext.baseVersion = versionNumber
4646
version = versionNumber
4747
description = """rdepot"""

docker-compose.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,10 @@ services:
3131
networks:
3232
- oa-rdepot
3333
app:
34-
image: openanalytics/rdepot-app:1.7.2
34+
image: openanalytics/rdepot-app:1.7.3
3535
restart: unless-stopped
3636
hostname: oa-rdepot-app
3737
container_name: oa-rdepot-app
38-
entrypoint: java -jar /opt/rdepot/rdepot.war --spring.config.additional-location=file:/opt/rdepot/application.yml
3938
volumes:
4039
- repositories:/opt/rdepot/repositories/
4140
- snapshots:/opt/rdepot/generated/
@@ -55,7 +54,7 @@ services:
5554
timeout: 10s
5655
retries: 10
5756
repo:
58-
image: openanalytics/rdepot-repo:1.7.2
57+
image: openanalytics/rdepot-repo:1.7.3
5958
restart: unless-stopped
6059
hostname: oa-rdepot-repo
6160
container_name: oa-rdepot-repo
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
FROM openanalytics/rdepot-app-it:1.7.2
1+
FROM openanalytics/rdepot-app-it:1.7.3
22

33
COPY rdepot-app-*application.war /opt/rdepot/rdepot.war
4+
5+
ENTRYPOINT exec java $JAVA_OPTS -jar /opt/rdepot/rdepot.war --spring.config.location=classpath:/application.yml --spring.config.additional-location=file:/opt/rdepot/application.yml
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
FROM openanalytics/rdepot-repo-it:1.7.2
1+
FROM openanalytics/rdepot-repo-it:1.7.3
22

33
COPY rdepot-repo-*application.jar /opt/repo/rdepot-repo.jar

r-module/src/main/java/eu/openanalytics/rdepot/r/RDescription.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,9 @@ private void load0 (Scanner scanner) throws IOException
267267
}
268268
}
269269
else
270-
{
271-
nextLine = scanner.next();
272-
if (!nextLine.contains(":"))
270+
{
271+
nextLine = scanner.hasNext() ? scanner.next() : null;
272+
if (nextLine != null && !nextLine.contains(":"))
273273
{
274274
currentValue += " " + nextLine;
275275
}

r-module/src/main/java/eu/openanalytics/rdepot/r/legacy/api/v1/controllers/PackageController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ else if(requester == null || !securityMediator.isAuthorizedToEdit(packageBag, re
313313
@RequestMapping(value="/{id}/download/{name}_{version}.tar.gz", method=RequestMethod.GET)
314314
public @ResponseBody ResponseEntity<byte[]> downloadPage(@PathVariable Integer id,
315315
@PathVariable String name, @PathVariable String version) {
316-
RPackage packageBag = packageService.findById(id).orElse(null);
316+
RPackage packageBag = packageService.findOneNonDeleted(id).orElse(null);
317317
byte[] bytes = null;
318318
HttpHeaders httpHeaders = new HttpHeaders();
319319
HttpStatus httpStatus = HttpStatus.OK;

r-module/src/main/java/eu/openanalytics/rdepot/r/strategy/upload/RPackageUploadStrategy.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ protected RPackage parseTechnologySpecificPackageProperties(Properties propertie
103103
protected Submission actualStrategy() throws StrategyFailure {
104104
Submission submission = super.actualStrategy();
105105
try {
106-
rStorage.generateManual(packageBag);
106+
if(request.getGenerateManual())
107+
rStorage.generateManual(packageBag);
107108
} catch (GenerateManualException e) {
108109
logger.error(e.getMessage(), e);
109110
throw new StrategyFailure(e);

src/integration-test/java/eu/openanalytics/rdepot/integrationtest/manager/v1/PackageIntegrationTest.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,17 @@ public void shouldDownloadPackage() throws IOException {
174174

175175
assertArrayEquals("Wrong package has been downloaded", expectedpkg, pkg);
176176
}
177+
178+
@Test
179+
public void shouldNotDownloadDeletedPackage() throws IOException {
180+
given()
181+
.header(AUTHORIZATION, BEARER + ADMIN_TOKEN)
182+
.accept(ContentType.ANY)
183+
.when()
184+
.get(API_PATH + "/14/download/npordtests_1.1.tar.gz")
185+
.then()
186+
.statusCode(404);
187+
}
177188

178189
@Test
179190
public void shouldDownloadPdf() throws IOException {

src/integration-test/java/eu/openanalytics/rdepot/integrationtest/manager/v1/SubmissionIntegrationTest.java

Lines changed: 55 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,11 @@
4343
import org.json.simple.JSONObject;
4444
import org.json.simple.parser.JSONParser;
4545
import org.json.simple.parser.ParseException;
46-
import org.junit.Rule;
4746
import org.junit.Test;
4847

4948
import com.google.gson.JsonArray;
5049
import com.google.gson.JsonObject;
5150
import com.google.gson.JsonParser;
52-
import com.icegreen.greenmail.configuration.GreenMailConfiguration;
53-
import com.icegreen.greenmail.junit.GreenMailRule;
54-
import com.icegreen.greenmail.util.ServerSetup;
5551

5652
import eu.openanalytics.rdepot.integrationtest.IntegrationTest;
5753
import eu.openanalytics.rdepot.integrationtest.utils.JSONConverter;
@@ -73,9 +69,7 @@ public SubmissionIntegrationTest() {
7369

7470
private final String PACKAGE_ID_TO_DOWNLOAD = "32";
7571
private final String PACKAGE_NAME_TO_DOWNLOAD = "Benchmarking";
76-
private final String PDF_PATH = "src/integration-test/resources/itestPdf";
77-
78-
private static final ServerSetup serverSetup = new ServerSetup(3925, "0.0.0.0", "smtp");
72+
private final String PDF_PATH = "src/integration-test/resources/itestPdf";
7973

8074
@Test
8175
public void shouldNotPublishPackageWhenRepositoryIsUnpublished() throws IOException, ParseException {
@@ -238,60 +232,60 @@ public void shouldUploadPackageAndCreateManualByDefault() throws ParseException,
238232
}
239233

240234
//TODO wait to decision about manual - if always create or only on specified conditions
241-
// @Test
242-
// public void shouldUploadPackageAndNotCreateManual() throws ParseException, IOException {
243-
// File packageBag = new File ("src/integration-test/resources/itestPackages/Benchmarking_0.10.tar.gz");
244-
//
245-
// given()
246-
// .header(AUTHORIZATION, BEARER + ADMIN_TOKEN)
247-
// .accept("application/json")
248-
// .contentType("multipart/form-data")
249-
// .multiPart("repository", "testrepo2")
250-
// .multiPart("generateManual", "false")
251-
// .multiPart(new MultiPartSpecBuilder(Files.readAllBytes(packageBag.toPath()))
252-
// .fileName(packageBag.getName())
253-
// .mimeType("application/gzip")
254-
// .controlName("file")
255-
// .build())
256-
// .when()
257-
// .post(API_PACKAGES_PATH + "/submit")
258-
// .then()
259-
// .statusCode(200)
260-
// .extract();
261-
//
262-
// FileReader reader = new FileReader(JSON_PATH + "/submission/repositories_after_uploading_package.json");
263-
// JsonArray expectedJSON = (JsonArray) JsonParser.parseReader(reader);
264-
//
265-
// List<Set<JsonObject>> expectedPackages = JSONConverter.convertNewPackagesFromRepo(expectedJSON);
266-
//
267-
// String data = given()
268-
// .header(AUTHORIZATION, BEARER + USER_TOKEN)
269-
// .accept(ContentType.JSON)
270-
// .when()
271-
// .get(API_REPOSITORIES_PATH + "/list")
272-
// .then()
273-
// .statusCode(200)
274-
// .extract()
275-
// .asString();
276-
//
277-
// JsonArray actualJSON = (JsonArray) JsonParser.parseString(data);
278-
//
279-
// List<Set<JsonObject>> actualPackages = JSONConverter.convertNewPackagesFromRepo(actualJSON);
280-
//
281-
// given()
282-
// .header(AUTHORIZATION, BEARER + ADMIN_TOKEN)
283-
// .accept(ContentType.ANY)
284-
//
285-
// .when()
286-
// .get(API_PACKAGES_PATH + "/" + PACKAGE_ID_TO_DOWNLOAD + "/download/" + PACKAGE_NAME_TO_DOWNLOAD + ".pdf")
287-
// .then()
288-
// .statusCode(404)
289-
// .extract()
290-
// .asByteArray();
291-
//
292-
// assertEquals("expected packages: " + expectedPackages + " but was: " + actualPackages, expectedPackages, actualPackages);
293-
// assertTrue("expected json: " + expectedJSON + "but was: " + actualJSON, compare(expectedJSON, actualJSON));
294-
// }
235+
@Test
236+
public void shouldUploadPackageAndNotCreateManual() throws ParseException, IOException {
237+
File packageBag = new File ("src/integration-test/resources/itestPackages/Benchmarking_0.10.tar.gz");
238+
239+
given()
240+
.header(AUTHORIZATION, BEARER + ADMIN_TOKEN)
241+
.accept("application/json")
242+
.contentType("multipart/form-data")
243+
.multiPart("repository", "testrepo2")
244+
.multiPart("generateManual", "false")
245+
.multiPart(new MultiPartSpecBuilder(Files.readAllBytes(packageBag.toPath()))
246+
.fileName(packageBag.getName())
247+
.mimeType("application/gzip")
248+
.controlName("file")
249+
.build())
250+
.when()
251+
.post(API_PACKAGES_PATH + "/submit")
252+
.then()
253+
.statusCode(200)
254+
.extract();
255+
256+
FileReader reader = new FileReader(JSON_PATH + "/submission/repositories_after_uploading_package.json");
257+
JsonArray expectedJSON = (JsonArray) JsonParser.parseReader(reader);
258+
259+
List<Set<JsonObject>> expectedPackages = JSONConverter.convertNewPackagesFromRepo(expectedJSON);
260+
261+
String data = given()
262+
.header(AUTHORIZATION, BEARER + USER_TOKEN)
263+
.accept(ContentType.JSON)
264+
.when()
265+
.get(API_REPOSITORIES_PATH + "/list")
266+
.then()
267+
.statusCode(200)
268+
.extract()
269+
.asString();
270+
271+
JsonArray actualJSON = (JsonArray) JsonParser.parseString(data);
272+
273+
List<Set<JsonObject>> actualPackages = JSONConverter.convertNewPackagesFromRepo(actualJSON);
274+
275+
given()
276+
.header(AUTHORIZATION, BEARER + ADMIN_TOKEN)
277+
.accept(ContentType.ANY)
278+
279+
.when()
280+
.get(API_PACKAGES_PATH + "/" + PACKAGE_ID_TO_DOWNLOAD + "/download/" + PACKAGE_NAME_TO_DOWNLOAD + ".pdf")
281+
.then()
282+
.statusCode(404)
283+
.extract()
284+
.asByteArray();
285+
286+
assertEquals("expected packages: " + expectedPackages + " but was: " + actualPackages, expectedPackages, actualPackages);
287+
assertTrue("expected json: " + expectedJSON + "but was: " + actualJSON, compare(expectedJSON, actualJSON));
288+
}
295289

296290
@Test
297291
public void shouldUploadPackageWithReplaceOption() throws IOException, ParseException {

0 commit comments

Comments
 (0)