Skip to content
This repository has been archived by the owner on Mar 31, 2022. It is now read-only.

Commit

Permalink
Merge pull request #265 from International-Data-Spaces-Association/de…
Browse files Browse the repository at this point in the history
…velop

Release v5.0.1
  • Loading branch information
juliapampus authored May 19, 2021
2 parents 548cd41 + e08f80c commit 7359b11
Show file tree
Hide file tree
Showing 9 changed files with 99 additions and 45 deletions.
26 changes: 15 additions & 11 deletions .github/workflows/build-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,19 @@ jobs:
-
name: Find tag
id: get_tag
run: echo ::set-output name=TAG::${GITHUB_REF/refs\/tags\//}
run: |
echo ${GITHUB_REF#refs/tags/}
echo ::set-output name=TAG::${GITHUB_REF#refs/tags/}
if: startsWith(github.ref, 'refs/tags')
-
name: Find branch name
id: get_branch
run: echo ::set-output name=BRANCH::$(git rev-parse --abbrev-ref HEAD)
run: |
# to lowercase
TMP=$(git rev-parse --abbrev-ref HEAD)
TMP=$(echo "$TMP" | tr '[:upper:]' '[:lower:]')
echo $TMP
echo ::set-output name=BRANCH::$TMP
-
name: Login to registry
uses: docker/login-action@v1
Expand All @@ -54,21 +61,17 @@ jobs:
echo $BRANCH
echo $TAG
TMP=$TAG
if [[ $TAG == v* ]]
if [[ $TMP == v* ]]
then
# Its a version tag
TMP=${TAG:1:${#TAG}}
echo "Found a version tag"
if [[ $BRANCH == 'master' ]]
then
# Its a release version tag
docker tag $IMAGE:$BRANCH $IMAGE:latest
docker push $IMAGE:latest
fi
docker tag $IMAGE:$BRANCH $IMAGE:latest
docker push $IMAGE:latest
fi
# Has tag
docker tag $IMAGE_NAME:$BRANCH_NAME $IMAGE_NAME:$TAG
docker push $IMAGE_NAME:$TAG
docker tag $IMAGE:$BRANCH $IMAGE:$TMP
docker push $IMAGE:$TMP
if: startsWith(github.ref, 'refs/tags')
env:
IMAGE: ${{ steps.get_repo.outputs.IMAGE }}
Expand All @@ -78,6 +81,7 @@ jobs:
name: Push branch image
run: |
docker push $IMAGE:$BRANCH
if: startsWith(github.ref, 'refs/heads')
env:
IMAGE: ${{ steps.get_repo.outputs.IMAGE }}
BRANCH: ${{ steps.get_branch.outputs.BRANCH }}
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Changelog
All notable changes to this project will be documented in this file.

## [5.0.1] - 2021-05-19

### Changed
- H2 does not persist database to files.
- Change additional list mapping for received attribute list with a single item.
- Disable unused rolling file appender in `log4j2.xml`.

## [5.0.0] - 2021-05-17

### Added
Expand Down Expand Up @@ -36,7 +43,7 @@ All notable changes to this project will be documented in this file.
- Move Swagger UI to `/api/docs`.
- Change response type from string to object.
- Use correct response codes as defined by RFC 7231.
- Replace old data model: catalogs, resources, representations, artifacts, contract, rules, and
- Replace old data model: catalogs, resources, representations, artifacts, contract, rules, and
agreements.
* Separate `ResourceRepresentation` into `Representation` and `Artifact`.
* Separate `ResourceContract` into `Contract` and `Rule`.
Expand Down
2 changes: 1 addition & 1 deletion openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ info:
license:
name: "Apache License, Version 2.0"
url: https://www.apache.org/licenses/LICENSE-2.0.txt
version: 5.0.0
version: 5.0.1
servers:
- url: http://localhost:8080
description: Generated server url
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@

<properties>
<!-- General -->
<revision>5.0.0</revision>
<revision>5.0.1</revision>
<email>[email protected]</email>

<!-- Build info -->
Expand Down
66 changes: 55 additions & 11 deletions src/main/java/io/dataspaceconnector/utils/MappingUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ public static ResourceTemplate<RequestedResourceDesc> fromIdsResource(final Reso
}

if (contentPart != null) {
additional.put("ids:contentPart", contentPart.toString());
if (contentPart.size() == 1) {
additional.put("ids:contentPart", contentPart.get(0).toString());
} else {
additional.put("ids:contentPart", contentPart.toString());
}
}

if (contentStandard != null) {
Expand All @@ -117,43 +121,71 @@ public static ResourceTemplate<RequestedResourceDesc> fromIdsResource(final Reso
}

if (representation != null) {
additional.put("ids:defaultRepresentation", representation.toString());
if (representation.size() == 1) {
additional.put("ids:defaultRepresentation", representation.get(0).toString());
} else {
additional.put("ids:defaultRepresentation", representation.toString());
}
}

if (modified != null) {
additional.put("ids:modified", modified.toXMLFormat());
}

if (resourceEndpoint != null) {
additional.put("ids:resourceEndpoint", resourceEndpoint.toString());
if (resourceEndpoint.size() == 1) {
additional.put("ids:resourceEndpoint", resourceEndpoint.get(0).toString());
} else {
additional.put("ids:resourceEndpoint", resourceEndpoint.toString());
}
}

if (resourcePart != null) {
additional.put("ids:resourcePart", resourcePart.toString());
if (resourcePart.size() == 1) {
additional.put("ids:resourcePart", resourcePart.get(0).toString());
} else {
additional.put("ids:resourcePart", resourcePart.toString());
}
}

if (sample != null) {
additional.put("ids:sample", sample.toString());
if (sample.size() == 1) {
additional.put("ids:sample", sample.get(0).toString());
} else {
additional.put("ids:sample", sample.toString());
}
}

if (shapesGraph != null) {
additional.put("ids:shapesGraph", shapesGraph.toString());
}

if (spatialCoverage != null) {
additional.put("ids:spatialCoverage", spatialCoverage.toString());
if (spatialCoverage.size() == 1) {
additional.put("ids:spatialCoverage", spatialCoverage.get(0).toString());
} else {
additional.put("ids:spatialCoverage", spatialCoverage.toString());
}
}

if (temporalCoverage != null) {
additional.put("ids:temporalCoverage", temporalCoverage.toString());
if (temporalCoverage.size() == 1) {
additional.put("ids:temporalCoverage", temporalCoverage.get(0).toString());
} else {
additional.put("ids:temporalCoverage", temporalCoverage.toString());
}
}

if (temporalRes != null) {
additional.put("ids:temporalResolution", temporalRes.toString());
}

if (theme != null) {
additional.put("ids:theme", theme.toString());
if (theme.size() == 1) {
additional.put("ids:theme", theme.get(0).toString());
} else {
additional.put("ids:theme", theme.toString());
}
}

if (variant != null) {
Expand All @@ -173,15 +205,27 @@ public static ResourceTemplate<RequestedResourceDesc> fromIdsResource(final Reso
desc.setSovereign(sovereign);

if (description != null) {
desc.setDescription(description.toString());
if (description.size() == 1) {
desc.setDescription(description.get(0).toString());
} else {
desc.setDescription(description.toString());
}
}

if (title != null) {
desc.setTitle(title.toString());
if (title.size() == 1) {
desc.setTitle(title.get(0).toString());
} else {
desc.setTitle(title.toString());
}
}

if (language != null) {
desc.setLanguage(language.toString());
if (language.size() == 1) {
desc.setLanguage(language.get(0).toString());
} else {
desc.setLanguage(language.toString());
}
}

if (resourceEndpoint != null) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ policy.framework=INTERNAL
####################################################################################################

### H2 Database
spring.datasource.url=jdbc:h2:file:./target/db/resources
spring.datasource.url=jdbc:h2:mem:connectordb
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=password
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/log4j2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<PatternLayout
pattern="%d{ISO8601} [%thread] %highlight{%level}{FATAL=bg_red, ERROR=red, WARN=yellow, INFO=green, DEBUG=blue} - %encode{%.-10000msg}{CRLF}%n" />
</Console>
<RollingFile
<!-- <RollingFile
name="RollingFile"
fileName="./log/dataspaceconnector.log"
filePattern="./log/dataspaceconnector.%i.log.gz"
Expand All @@ -17,7 +17,7 @@
<SizeBasedTriggeringPolicy size="10MB"/>
</Policies>
<DefaultRolloverStrategy max="5" />
</RollingFile>
</RollingFile>-->
</Appenders>
<Loggers>
<Root level="info">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public class RequestedResourceUpdaterTest {
@Autowired
private RequestedResourceUpdater updater;

private final UUID resourceId = UUID.fromString("550e8400-e29b-11d4-a716-446655440000");
private final Resource resource = getResource();
private final UUID resourceId = UUID.fromString("550e8400-e29b-11d4-a716-446655440000");
private final Resource resource = getResource();
private final io.dataspaceconnector.model.RequestedResource dscResource = getDscResource();
private final io.dataspaceconnector.model.RequestedResource dscUpdatedResource = getUpdatedDscResource();
private final ResourceTemplate<RequestedResourceDesc> template = getTemplate();
Expand Down Expand Up @@ -96,8 +96,7 @@ public void update_knownId_returnUpdatedRepresentation() {
final var result = updater.update(resource);
assertEquals(dscUpdatedResource, result);
Mockito.verify(requestedResourceService, Mockito.atLeastOnce()).update(Mockito.eq(
resourceId),
Mockito.eq(template.getDesc()));
resourceId), Mockito.eq(template.getDesc()));
}

private Resource getResource() {
Expand All @@ -111,7 +110,7 @@ private io.dataspaceconnector.model.RequestedResource getDscResource() {
final var resourceConstructor = RequestedResource.class.getDeclaredConstructor();
resourceConstructor.setAccessible(true);
final var output = resourceConstructor.newInstance();
ReflectionTestUtils.setField(output, "language", "[SOME Language]");
ReflectionTestUtils.setField(output, "language", "SOME Language");
return output;
}

Expand All @@ -126,7 +125,7 @@ private io.dataspaceconnector.model.RequestedResource getUpdatedDscResource() {

private ResourceTemplate<RequestedResourceDesc> getTemplate() {
final var output = new ResourceTemplate<>(new RequestedResourceDesc());
output.getDesc().setLanguage("[https://w3id.org/idsa/code/DE]");
output.getDesc().setLanguage("https://w3id.org/idsa/code/DE");
output.getDesc().setRemoteId(URI.create("550e8400-e29b-11d4-a716-446655440000"));
output.getDesc().setAdditional(new ConcurrentHashMap<>());
output.getDesc().setKeywords(new ArrayList<>());
Expand Down
22 changes: 11 additions & 11 deletions src/test/java/io/dataspaceconnector/utils/MappingUtilsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,31 +80,31 @@ public void fromIdsResource_validInput_returnResourceTemplate() {
/* ASSERT */
assertEquals(resource.getId(), result.getDesc().getRemoteId());
assertEquals(resource.getKeyword().get(0).getValue(), result.getDesc().getKeywords().get(0));
assertEquals(resource.getDescription().toString(), result.getDesc().getDescription());
assertEquals(resource.getDescription().get(0).toString(), result.getDesc().getDescription());
assertEquals(resource.getPublisher(), result.getDesc().getPublisher());
assertEquals(resource.getStandardLicense(), result.getDesc().getLicence());
assertEquals(resource.getLanguage().toString(), result.getDesc().getLanguage());
assertEquals(resource.getTitle().toString(), result.getDesc().getTitle());
assertEquals(resource.getLanguage().get(0).toString(), result.getDesc().getLanguage());
assertEquals(resource.getTitle().get(0).toString(), result.getDesc().getTitle());
assertEquals(resource.getSovereign(), result.getDesc().getSovereign());
assertEquals(resource.getResourceEndpoint().get(0).getEndpointDocumentation().get(0), result.getDesc().getEndpointDocumentation());

final var additional = result.getDesc().getAdditional();
assertEquals(resource.getAccrualPeriodicity().toRdf(), additional.get("ids:accrualPeriodicity"));
assertEquals(resource.getContentPart().toString(), additional.get("ids:contentPart"));
assertEquals(resource.getContentPart().get(0).toString(), additional.get("ids:contentPart"));
assertEquals(resource.getContentStandard().toString(), additional.get("ids:contentStandard"));
assertEquals(resource.getContentType().toRdf(), additional.get("ids:contentType"));
assertEquals(resource.getCreated().toXMLFormat(), additional.get("ids:created"));
assertEquals(resource.getCustomLicense().toString(), additional.get("ids:customLicense"));
assertEquals(resource.getDefaultRepresentation().toString(), additional.get("ids:defaultRepresentation"));
assertEquals(resource.getDefaultRepresentation().get(0).toString(), additional.get("ids:defaultRepresentation"));
assertEquals(resource.getModified().toXMLFormat(), additional.get("ids:modified"));
assertEquals(resource.getResourceEndpoint().toString(), additional.get("ids:resourceEndpoint"));
assertEquals(resource.getResourcePart().toString(), additional.get("ids:resourcePart"));
assertEquals(resource.getSample().toString(), additional.get("ids:sample"));
assertEquals(resource.getResourceEndpoint().get(0).toString(), additional.get("ids:resourceEndpoint"));
assertEquals(resource.getResourcePart().get(0).toString(), additional.get("ids:resourcePart"));
assertEquals(resource.getSample().get(0).toString(), additional.get("ids:sample"));
assertEquals(resource.getShapesGraph().toString(), additional.get("ids:shapesGraph"));
assertEquals(resource.getSpatialCoverage().toString(), additional.get("ids:spatialCoverage"));
assertEquals(resource.getTemporalCoverage().toString(), additional.get("ids:temporalCoverage"));
assertEquals(resource.getSpatialCoverage().get(0).toString(), additional.get("ids:spatialCoverage"));
assertEquals(resource.getTemporalCoverage().get(0).toString(), additional.get("ids:temporalCoverage"));
assertEquals(resource.getTemporalResolution().toString(), additional.get("ids:temporalResolution"));
assertEquals(resource.getTheme().toString(), additional.get("ids:theme"));
assertEquals(resource.getTheme().get(0).toString(), additional.get("ids:theme"));
assertEquals(resource.getVariant().toString(), additional.get("ids:variant"));
assertEquals(resource.getVersion(), additional.get("ids:version"));
assertEquals("test", additional.get("test"));
Expand Down

0 comments on commit 7359b11

Please sign in to comment.