diff --git a/pom.xml b/pom.xml
index 9f3e209..7b6870f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
ucles.weblab
weblab-api-schema
pom
- 0.5-SNAPSHOT
+ 2.0.0-SNAPSHOT
weblab-cross-context
@@ -17,8 +17,8 @@
- 0.5-SNAPSHOT
- 1.5.3.RELEASE
+ 2.0.0-SNAPSHOT
+ 2.0.0.RELEASE
1.8
UTF-8
UTF-8
diff --git a/shippable.yml b/shippable.yml
index 42a0b8e..4ea85a2 100644
--- a/shippable.yml
+++ b/shippable.yml
@@ -15,11 +15,9 @@ build:
ci:
- mkdir -p shippable/testresults
- mvn --batch-mode clean
- # Only deploy master
- - if [[ $BRANCH == "master" ]] && [[ $IS_PULL_REQUEST != true ]]; then mvn --batch-mode --update-snapshots -Pshippable deploy; fi
- # Otherwise verify all other configs
- - if [[ $BRANCH == "master" ]] && [[ $IS_PULL_REQUEST == true ]]; then mvn --batch-mode --update-snapshots -Pshippable verify; fi
- - if [[ $BRANCH != "master" ]]; then mvn --batch-mode --update-snapshots -Pshippable verify; fi
+ # Only deploy for master & release-2.0.x, otherwise just verify for branches and PRs
+ - if [[ $BRANCH == "master" || $BRANCH == "release-2.0.x" ]] && [[ $IS_PULL_REQUEST != true ]]; then mvn --batch-mode --update-snapshots -Pshippable deploy; fi
+ - if [[ $BRANCH != "master" && $BRANCH != "release-2.0.x" ]] || [[ $IS_PULL_REQUEST != true ]]; then mvn --batch-mode --update-snapshots -Pshippable verify; fi
integrations:
notifications:
diff --git a/weblab-cross-context/pom.xml b/weblab-cross-context/pom.xml
index 3d59077..b6e16a9 100644
--- a/weblab-cross-context/pom.xml
+++ b/weblab-cross-context/pom.xml
@@ -5,7 +5,7 @@
weblab-api-schema
ucles.weblab
- 0.5-SNAPSHOT
+ 2.0.0-SNAPSHOT
4.0.0
diff --git a/weblab-cross-context/src/main/java/ucles/weblab/common/xc/service/ControllerIntrospectingCrossContextConverter.java b/weblab-cross-context/src/main/java/ucles/weblab/common/xc/service/ControllerIntrospectingCrossContextConverter.java
index 12d4d4c..f7142af 100644
--- a/weblab-cross-context/src/main/java/ucles/weblab/common/xc/service/ControllerIntrospectingCrossContextConverter.java
+++ b/weblab-cross-context/src/main/java/ucles/weblab/common/xc/service/ControllerIntrospectingCrossContextConverter.java
@@ -110,7 +110,8 @@ public URI toUrn(URI url) {
@Override
public URI toUrl(URI urn) {
return Optional.ofNullable(urnToHandlerMethodInvocation(urn))
- .map(m -> MvcUriComponentsBuilder.fromMethod(m.getHandlerMethod().getMethod(), m.getArgs())
+ .map(m -> MvcUriComponentsBuilder.fromMethod(
+ m.getHandlerMethod().getMethod().getDeclaringClass(), m.getHandlerMethod().getMethod(), m.getArgs())
.build().toUri())
.orElse(null);
}
diff --git a/weblab-forms/pom.xml b/weblab-forms/pom.xml
index 6b73b3a..c70063c 100644
--- a/weblab-forms/pom.xml
+++ b/weblab-forms/pom.xml
@@ -5,7 +5,7 @@
weblab-api-schema
ucles.weblab
- 0.5-SNAPSHOT
+ 2.0.0-SNAPSHOT
4.0.0
diff --git a/weblab-forms/src/main/java/ucles/weblab/common/forms/domain/FormRepository.java b/weblab-forms/src/main/java/ucles/weblab/common/forms/domain/FormRepository.java
index d95df68..4f6329a 100644
--- a/weblab-forms/src/main/java/ucles/weblab/common/forms/domain/FormRepository.java
+++ b/weblab-forms/src/main/java/ucles/weblab/common/forms/domain/FormRepository.java
@@ -1,6 +1,7 @@
package ucles.weblab.common.forms.domain;
import java.util.List;
+import java.util.Optional;
/**
*
@@ -12,9 +13,11 @@ public interface FormRepository {
List extends FormEntity> findAllByOrderByNameAsc();
- S findOne(String id);
+ Optional extends FormEntity> findById(String id);
- int deleteById(String id);
+ boolean existsById(String id);
+
+ void deleteById(String id);
List extends FormEntity> findByBusinessStreamsContainingAndApplicationName(String businessStream, String applicationName);
}
diff --git a/weblab-forms/src/main/java/ucles/weblab/common/forms/domain/mongo/FormRepositoryMongo.java b/weblab-forms/src/main/java/ucles/weblab/common/forms/domain/mongo/FormRepositoryMongo.java
index bac7aba..59d5828 100644
--- a/weblab-forms/src/main/java/ucles/weblab/common/forms/domain/mongo/FormRepositoryMongo.java
+++ b/weblab-forms/src/main/java/ucles/weblab/common/forms/domain/mongo/FormRepositoryMongo.java
@@ -8,7 +8,5 @@
* @author Sukhraj
*/
public interface FormRepositoryMongo extends FormRepository, MongoRepository {
-
- @Override
- FormEntityMongo findOne(String id);
+
}
diff --git a/weblab-forms/src/main/java/ucles/weblab/common/forms/webapi/FormDelegate.java b/weblab-forms/src/main/java/ucles/weblab/common/forms/webapi/FormDelegate.java
index 9e3620d..82782a1 100644
--- a/weblab-forms/src/main/java/ucles/weblab/common/forms/webapi/FormDelegate.java
+++ b/weblab-forms/src/main/java/ucles/weblab/common/forms/webapi/FormDelegate.java
@@ -74,19 +74,17 @@ public FormResource create(FormResource resource) {
public FormResource get(String id) {
- FormEntity formEntity = formRepository.findOne(id);
- if (formEntity == null) {
- throw new ResourceNotFoundException(id);
- }
+ FormEntity formEntity = formRepository.findById(id).orElseThrow(() -> new ResourceNotFoundException(id));
FormResource resource = toResource(formEntity);
return resource;
}
public void delete(String id) {
- if (formRepository.deleteById(id) == 0) {
- throw new ResourceNotFoundException(id);
+ if (formRepository.existsById(id)) {
+ formRepository.deleteById(id);
}
+ throw new ResourceNotFoundException(id);
}
public List list(String businessStream, String applicationName) {
@@ -97,11 +95,9 @@ public List list(String businessStream, String applicationName) {
}
public FormResource update(FormResource resource) {
- FormEntity exisitingFormEntity = formRepository.findOne(resource.getFormId());
- if (exisitingFormEntity == null) {
- throw new ResourceNotFoundException(resource.getFormId());
- }
- String stringValue = null;
+ FormEntity existingEntity = formRepository.findById(resource.getFormId())
+ .orElseThrow(() -> new ResourceNotFoundException(resource.getFormId()));
+ String stringValue;
try {
stringValue = objectMapper.writeValueAsString(resource.getFormDefinition());
} catch (JsonProcessingException ex) {
@@ -109,16 +105,16 @@ public FormResource update(FormResource resource) {
throw new BadDataException(CONVERSION_ERROR, null, ex);
}
- exisitingFormEntity.setDescription(resource.getDescription());
- exisitingFormEntity.setName(resource.getName());
- exisitingFormEntity.setApplicationName(resource.getApplicationName());
- exisitingFormEntity.setBusinessStreams(resource.getBusinessStreams());
- exisitingFormEntity.setDescription(resource.getDescription());
- exisitingFormEntity.setSchema(stringValue);
- exisitingFormEntity.setValidFrom(resource.getValidFrom());
- exisitingFormEntity.setValidTo(resource.getValidTo());
+ existingEntity.setDescription(resource.getDescription());
+ existingEntity.setName(resource.getName());
+ existingEntity.setApplicationName(resource.getApplicationName());
+ existingEntity.setBusinessStreams(resource.getBusinessStreams());
+ existingEntity.setDescription(resource.getDescription());
+ existingEntity.setSchema(stringValue);
+ existingEntity.setValidFrom(resource.getValidFrom());
+ existingEntity.setValidTo(resource.getValidTo());
- FormEntity saved = formRepository.save(exisitingFormEntity);
+ FormEntity saved = formRepository.save(existingEntity);
FormResource savedResource = toResource(saved);
return savedResource;
diff --git a/weblab-forms/src/test/java/ucles/weblab/common/forms/webapi/FormController_IT.java b/weblab-forms/src/test/java/ucles/weblab/common/forms/webapi/FormController_IT.java
index 994fd9f..55f08e7 100644
--- a/weblab-forms/src/test/java/ucles/weblab/common/forms/webapi/FormController_IT.java
+++ b/weblab-forms/src/test/java/ucles/weblab/common/forms/webapi/FormController_IT.java
@@ -12,11 +12,11 @@
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
-import org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration;
+import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.MessageSource;
diff --git a/weblab-json-schema/pom.xml b/weblab-json-schema/pom.xml
index ce1b01e..c484921 100644
--- a/weblab-json-schema/pom.xml
+++ b/weblab-json-schema/pom.xml
@@ -5,7 +5,7 @@
weblab-api-schema
ucles.weblab
- 0.5-SNAPSHOT
+ 2.0.0-SNAPSHOT
4.0.0