Moving configuration to the new IS
This commit is contained in:
parent
f8e6a0cc43
commit
fdabed4a87
|
@ -3,6 +3,12 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
||||||
# Changelog for gCube Catalogue (gCat) Service
|
# Changelog for gCube Catalogue (gCat) Service
|
||||||
|
|
||||||
|
|
||||||
|
## [v2.4.2-SNAPSHOT]
|
||||||
|
|
||||||
|
- Switched from commons-lang3 to commons-lang to avoid duplicates
|
||||||
|
- Set resource-registry-publisher dependency scope to provided
|
||||||
|
|
||||||
|
|
||||||
## [v2.4.1]
|
## [v2.4.1]
|
||||||
|
|
||||||
- Integrating Sphinx for documentation [#23833]
|
- Integrating Sphinx for documentation [#23833]
|
||||||
|
|
8
pom.xml
8
pom.xml
|
@ -12,7 +12,7 @@
|
||||||
<groupId>org.gcube.data-catalogue</groupId>
|
<groupId>org.gcube.data-catalogue</groupId>
|
||||||
<artifactId>gcat</artifactId>
|
<artifactId>gcat</artifactId>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
<version>2.4.1</version>
|
<version>2.4.2-SNAPSHOT</version>
|
||||||
<name>gCube Catalogue (gCat) Service</name>
|
<name>gCube Catalogue (gCat) Service</name>
|
||||||
<description>
|
<description>
|
||||||
This service allows any client to publish on the gCube Catalogue.
|
This service allows any client to publish on the gCube Catalogue.
|
||||||
|
@ -208,9 +208,9 @@
|
||||||
|
|
||||||
<!-- Used by Validator -->
|
<!-- Used by Validator -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>commons-lang</groupId>
|
||||||
<artifactId>commons-lang3</artifactId>
|
<artifactId>commons-lang</artifactId>
|
||||||
<version>3.12.0</version>
|
<version>2.6</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|
|
@ -50,8 +50,10 @@ public class CatalogueConfigurationFactory {
|
||||||
public synchronized static ServiceCatalogueConfiguration createOrUpdate(ServiceCatalogueConfiguration catalogueConfiguration) throws Exception {
|
public synchronized static ServiceCatalogueConfiguration createOrUpdate(ServiceCatalogueConfiguration catalogueConfiguration) throws Exception {
|
||||||
String context = SecretManagerProvider.instance.get().getContext();
|
String context = SecretManagerProvider.instance.get().getContext();
|
||||||
catalogueConfigurations.remove(context);
|
catalogueConfigurations.remove(context);
|
||||||
|
|
||||||
GCoreISConfigurationProxy gCoreISConfigurationProxy = new GCoreISConfigurationProxy(context, catalogueConfiguration);
|
GCoreISConfigurationProxy gCoreISConfigurationProxy = new GCoreISConfigurationProxy(context, catalogueConfiguration);
|
||||||
catalogueConfiguration = gCoreISConfigurationProxy.createOrUpdateOnIS();
|
catalogueConfiguration = gCoreISConfigurationProxy.createOrUpdateOnIS();
|
||||||
|
|
||||||
catalogueConfigurations.put(context, catalogueConfiguration);
|
catalogueConfigurations.put(context, catalogueConfiguration);
|
||||||
|
|
||||||
// The supported organizations could be changed we need to empty the user cache for the context
|
// The supported organizations could be changed we need to empty the user cache for the context
|
||||||
|
|
|
@ -38,7 +38,6 @@ import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||||
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
||||||
import org.gcube.resources.discovery.icclient.ICFactory;
|
import org.gcube.resources.discovery.icclient.ICFactory;
|
||||||
import org.gcube.smartgears.ContextProvider;
|
import org.gcube.smartgears.ContextProvider;
|
||||||
import org.gcube.smartgears.configuration.application.ApplicationConfiguration;
|
|
||||||
import org.gcube.smartgears.configuration.container.ContainerConfiguration;
|
import org.gcube.smartgears.configuration.container.ContainerConfiguration;
|
||||||
import org.gcube.smartgears.context.application.ApplicationContext;
|
import org.gcube.smartgears.context.application.ApplicationContext;
|
||||||
import org.gcube.smartgears.context.container.ContainerContext;
|
import org.gcube.smartgears.context.container.ContainerContext;
|
||||||
|
@ -48,7 +47,7 @@ import org.slf4j.LoggerFactory;
|
||||||
/**
|
/**
|
||||||
* @author Luca Frosini (ISTI - CNR)
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
*/
|
*/
|
||||||
public class GCoreISConfigurationProxy {
|
public class GCoreISConfigurationProxy extends ISConfigurationProxy<ServiceEndpoint> {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(GCoreISConfigurationProxy.class);
|
private static final Logger logger = LoggerFactory.getLogger(GCoreISConfigurationProxy.class);
|
||||||
|
|
||||||
|
@ -88,24 +87,21 @@ public class GCoreISConfigurationProxy {
|
||||||
private final static String OLD_CATEGORY = "Application";
|
private final static String OLD_CATEGORY = "Application";
|
||||||
private final static String OLD_NAME = "CKanDataCatalogue";
|
private final static String OLD_NAME = "CKanDataCatalogue";
|
||||||
|
|
||||||
protected final String context;
|
|
||||||
protected ObjectMapper mapper;
|
protected ObjectMapper mapper;
|
||||||
protected ServiceCatalogueConfiguration catalogueConfiguration;
|
|
||||||
|
|
||||||
public GCoreISConfigurationProxy(String context) {
|
public GCoreISConfigurationProxy(String context) {
|
||||||
this.context = context;
|
super(context);
|
||||||
this.mapper = new ObjectMapper();
|
this.mapper = new ObjectMapper();
|
||||||
}
|
}
|
||||||
|
|
||||||
public GCoreISConfigurationProxy(String context, ServiceCatalogueConfiguration catalogueConfiguration) {
|
public GCoreISConfigurationProxy(String context, ServiceCatalogueConfiguration catalogueConfiguration) {
|
||||||
this(context);
|
super(context, catalogueConfiguration);
|
||||||
this.catalogueConfiguration = catalogueConfiguration;
|
|
||||||
this.mapper = new ObjectMapper();
|
this.mapper = new ObjectMapper();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServiceCatalogueConfiguration getCatalogueConfiguration() throws WebApplicationException {
|
public ServiceCatalogueConfiguration getCatalogueConfiguration() throws WebApplicationException {
|
||||||
if (catalogueConfiguration == null) {
|
if (catalogueConfiguration == null) {
|
||||||
catalogueConfiguration = getCatalogueConfigurationFromIS();
|
catalogueConfiguration = readFromIS();
|
||||||
}
|
}
|
||||||
return catalogueConfiguration;
|
return catalogueConfiguration;
|
||||||
}
|
}
|
||||||
|
@ -168,7 +164,8 @@ public class GCoreISConfigurationProxy {
|
||||||
return serviceEndpoints;
|
return serviceEndpoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ServiceEndpoint getServiceEndpoint() {
|
@Override
|
||||||
|
protected ServiceEndpoint getISResource() {
|
||||||
List<ServiceEndpoint> serviceEndpoints = getServiceEndpoints(GCatConstants.CONFIGURATION_CATEGORY, GCatConstants.CONFIGURATION_NAME);
|
List<ServiceEndpoint> serviceEndpoints = getServiceEndpoints(GCatConstants.CONFIGURATION_CATEGORY, GCatConstants.CONFIGURATION_NAME);
|
||||||
if (serviceEndpoints==null || serviceEndpoints.size() == 0) {
|
if (serviceEndpoints==null || serviceEndpoints.size() == 0) {
|
||||||
logger.error("There is no {} having Category {} and Name {} in this context.",
|
logger.error("There is no {} having Category {} and Name {} in this context.",
|
||||||
|
@ -179,10 +176,11 @@ public class GCoreISConfigurationProxy {
|
||||||
return serviceEndpoint;
|
return serviceEndpoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ServiceCatalogueConfiguration getCatalogueConfigurationFromIS() throws WebApplicationException {
|
@Override
|
||||||
ServiceEndpoint serviceEndpoint = getServiceEndpoint();
|
protected ServiceCatalogueConfiguration readFromIS() throws WebApplicationException {
|
||||||
|
ServiceEndpoint serviceEndpoint = getISResource();
|
||||||
if(serviceEndpoint==null) {
|
if(serviceEndpoint==null) {
|
||||||
return getOLDCatalogueConfigurationFromIS();
|
return getOLDCatalogueConfigurationFromGCoreIS();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return getConfiguration(serviceEndpoint);
|
return getConfiguration(serviceEndpoint);
|
||||||
|
@ -240,7 +238,7 @@ public class GCoreISConfigurationProxy {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
protected ServiceCatalogueConfiguration getOLDCatalogueConfigurationFromIS() {
|
protected ServiceCatalogueConfiguration getOLDCatalogueConfigurationFromGCoreIS() {
|
||||||
ServiceCatalogueConfiguration catalogueConfiguration = new ServiceCatalogueConfiguration(context);
|
ServiceCatalogueConfiguration catalogueConfiguration = new ServiceCatalogueConfiguration(context);
|
||||||
try {
|
try {
|
||||||
// boolean mustBeUpdated = false;
|
// boolean mustBeUpdated = false;
|
||||||
|
@ -498,14 +496,13 @@ public class GCoreISConfigurationProxy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void delete() {
|
public void delete() {
|
||||||
RegistryPublisher registryPublisher = RegistryPublisherFactory.create();
|
RegistryPublisher registryPublisher = RegistryPublisherFactory.create();
|
||||||
|
ServiceEndpoint serviceEndpoint = getISResource();
|
||||||
ServiceEndpoint serviceEndpoint = getServiceEndpoint();
|
|
||||||
if(serviceEndpoint!=null) {
|
if(serviceEndpoint!=null) {
|
||||||
registryPublisher.remove(serviceEndpoint);
|
registryPublisher.remove(serviceEndpoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Property addProperty(Group<Property> properties, String name, String value) {
|
protected Property addProperty(Group<Property> properties, String name, String value) {
|
||||||
|
@ -554,17 +551,6 @@ public class GCoreISConfigurationProxy {
|
||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Version getGcatVersion() {
|
|
||||||
try {
|
|
||||||
ApplicationContext applicationContext = ContextProvider.get();
|
|
||||||
ApplicationConfiguration applicationConfiguration = applicationContext.configuration();
|
|
||||||
Version version = new Version(applicationConfiguration.version());
|
|
||||||
return version;
|
|
||||||
}catch (Exception e) {
|
|
||||||
return new Version("2.2.0");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the version of gcat so that in future implementation
|
* Set the version of gcat so that in future implementation
|
||||||
* we can understand if the configuration must be updated.
|
* we can understand if the configuration must be updated.
|
||||||
|
@ -668,7 +654,8 @@ public class GCoreISConfigurationProxy {
|
||||||
return serviceEndpoint;
|
return serviceEndpoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServiceCatalogueConfiguration createOnIS() throws Exception {
|
@Override
|
||||||
|
protected ServiceCatalogueConfiguration createOnIS() throws Exception {
|
||||||
RegistryPublisher registryPublisher = RegistryPublisherFactory.create();
|
RegistryPublisher registryPublisher = RegistryPublisherFactory.create();
|
||||||
String id = catalogueConfiguration.getID();
|
String id = catalogueConfiguration.getID();
|
||||||
if(id==null || id.compareTo("")==0) {
|
if(id==null || id.compareTo("")==0) {
|
||||||
|
@ -680,7 +667,8 @@ public class GCoreISConfigurationProxy {
|
||||||
return catalogueConfiguration;
|
return catalogueConfiguration;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServiceCatalogueConfiguration updateOnIS(ServiceEndpoint serviceEndpoint) throws Exception {
|
@Override
|
||||||
|
protected ServiceCatalogueConfiguration updateOnIS(ServiceEndpoint serviceEndpoint) throws Exception {
|
||||||
RegistryPublisher registryPublisher = RegistryPublisherFactory.create();
|
RegistryPublisher registryPublisher = RegistryPublisherFactory.create();
|
||||||
String id = serviceEndpoint.id();
|
String id = serviceEndpoint.id();
|
||||||
catalogueConfiguration.setID(id);
|
catalogueConfiguration.setID(id);
|
||||||
|
@ -689,16 +677,4 @@ public class GCoreISConfigurationProxy {
|
||||||
return catalogueConfiguration;
|
return catalogueConfiguration;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServiceCatalogueConfiguration createOrUpdateOnIS() throws Exception {
|
|
||||||
ServiceEndpoint serviceEndpoint = getServiceEndpoint();
|
|
||||||
if(serviceEndpoint!=null) {
|
|
||||||
// It's an update
|
|
||||||
updateOnIS(serviceEndpoint);
|
|
||||||
}else {
|
|
||||||
// It's a create
|
|
||||||
createOnIS();
|
|
||||||
}
|
|
||||||
return catalogueConfiguration;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
package org.gcube.gcat.configuration;
|
||||||
|
|
||||||
|
import javax.ws.rs.WebApplicationException;
|
||||||
|
|
||||||
|
import org.gcube.smartgears.ContextProvider;
|
||||||
|
import org.gcube.smartgears.configuration.application.ApplicationConfiguration;
|
||||||
|
import org.gcube.smartgears.context.application.ApplicationContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
|
*/
|
||||||
|
public abstract class ISConfigurationProxy<ISResource extends Object> {
|
||||||
|
|
||||||
|
protected final String context;
|
||||||
|
protected ServiceCatalogueConfiguration catalogueConfiguration;
|
||||||
|
|
||||||
|
public ISConfigurationProxy(String context) {
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ISConfigurationProxy(String context, ServiceCatalogueConfiguration catalogueConfiguration) {
|
||||||
|
this(context);
|
||||||
|
this.catalogueConfiguration = catalogueConfiguration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ServiceCatalogueConfiguration getCatalogueConfiguration() throws WebApplicationException {
|
||||||
|
if (catalogueConfiguration == null) {
|
||||||
|
catalogueConfiguration = readFromIS();
|
||||||
|
}
|
||||||
|
return catalogueConfiguration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ServiceCatalogueConfiguration createOrUpdateOnIS() throws Exception {
|
||||||
|
ISResource isResource = getISResource();
|
||||||
|
if(isResource!=null) {
|
||||||
|
// It's an update
|
||||||
|
catalogueConfiguration = updateOnIS(isResource);
|
||||||
|
}else {
|
||||||
|
// It's a create
|
||||||
|
catalogueConfiguration = createOnIS();
|
||||||
|
}
|
||||||
|
return catalogueConfiguration;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Version getGcatVersion() {
|
||||||
|
try {
|
||||||
|
ApplicationContext applicationContext = ContextProvider.get();
|
||||||
|
ApplicationConfiguration applicationConfiguration = applicationContext.configuration();
|
||||||
|
Version version = new Version(applicationConfiguration.version());
|
||||||
|
return version;
|
||||||
|
}catch (Exception e) {
|
||||||
|
return new Version("2.2.0");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract ServiceCatalogueConfiguration createOnIS() throws Exception;
|
||||||
|
|
||||||
|
protected abstract ISResource getISResource();
|
||||||
|
|
||||||
|
protected abstract ServiceCatalogueConfiguration readFromIS();
|
||||||
|
|
||||||
|
protected abstract ServiceCatalogueConfiguration updateOnIS(ISResource isResource) throws Exception;
|
||||||
|
|
||||||
|
protected abstract void delete();
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
package org.gcube.gcat.configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
|
*/
|
||||||
|
public class RestISConfigurationProxy extends ISConfigurationProxy {
|
||||||
|
|
||||||
|
public RestISConfigurationProxy(String context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public RestISConfigurationProxy(String context, ServiceCatalogueConfiguration catalogueConfiguration) {
|
||||||
|
super(context, catalogueConfiguration);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ServiceCatalogueConfiguration readFromIS() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void delete() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ServiceCatalogueConfiguration createOnIS() throws Exception {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Object getISResource() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ServiceCatalogueConfiguration updateOnIS(Object isResource) throws Exception {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -16,7 +16,7 @@ import javax.ws.rs.InternalServerErrorException;
|
||||||
import javax.ws.rs.WebApplicationException;
|
import javax.ws.rs.WebApplicationException;
|
||||||
import javax.ws.rs.core.Response.Status;
|
import javax.ws.rs.core.Response.Status;
|
||||||
|
|
||||||
import org.apache.commons.lang3.math.NumberUtils;
|
import org.apache.commons.lang.math.NumberUtils;
|
||||||
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
|
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
|
||||||
import org.gcube.com.fasterxml.jackson.databind.ObjectMapper;
|
import org.gcube.com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.gcube.com.fasterxml.jackson.databind.node.ArrayNode;
|
import org.gcube.com.fasterxml.jackson.databind.node.ArrayNode;
|
||||||
|
@ -588,7 +588,7 @@ public class Validator {
|
||||||
break;
|
break;
|
||||||
case Number:
|
case Number:
|
||||||
|
|
||||||
if(!NumberUtils.isCreatable(value))
|
if(!NumberUtils.isNumber(value))
|
||||||
throw new BadRequestException("Field's value with key '" + key + "' is not a valid number!");
|
throw new BadRequestException("Field's value with key '" + key + "' is not a valid number!");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -21,6 +21,7 @@ import javax.ws.rs.core.MultivaluedMap;
|
||||||
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
|
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
|
||||||
import org.gcube.com.fasterxml.jackson.databind.node.ArrayNode;
|
import org.gcube.com.fasterxml.jackson.databind.node.ArrayNode;
|
||||||
import org.gcube.com.fasterxml.jackson.databind.node.ObjectNode;
|
import org.gcube.com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
|
import org.gcube.common.scope.impl.ScopeBean;
|
||||||
import org.gcube.common.scope.impl.ScopeBean.Type;
|
import org.gcube.common.scope.impl.ScopeBean.Type;
|
||||||
import org.gcube.gcat.api.GCatConstants;
|
import org.gcube.gcat.api.GCatConstants;
|
||||||
import org.gcube.gcat.api.configuration.CatalogueConfiguration;
|
import org.gcube.gcat.api.configuration.CatalogueConfiguration;
|
||||||
|
@ -891,7 +892,10 @@ public class CKANPackage extends CKAN implements Moderated {
|
||||||
((ObjectNode) jsonNode).remove(RESOURCES_KEY);
|
((ObjectNode) jsonNode).remove(RESOURCES_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(configuration.getScopeBean().is(Type.VRE)) {
|
String context = configuration.getContext();
|
||||||
|
ScopeBean scopeBean = new ScopeBean(context);
|
||||||
|
|
||||||
|
if(scopeBean.is(Type.VRE)) {
|
||||||
addItemURLViaResolver(jsonNode);
|
addItemURLViaResolver(jsonNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -904,7 +908,7 @@ public class CKANPackage extends CKAN implements Moderated {
|
||||||
postItemCreated();
|
postItemCreated();
|
||||||
|
|
||||||
if(!isModerationEnabled()) {
|
if(!isModerationEnabled()) {
|
||||||
if(configuration.getScopeBean().is(Type.VRE)) {
|
if(scopeBean.is(Type.VRE)) {
|
||||||
// Actions performed after a package has been correctly created on ckan.
|
// Actions performed after a package has been correctly created on ckan.
|
||||||
sendSocialPost();
|
sendSocialPost();
|
||||||
}
|
}
|
||||||
|
@ -1489,7 +1493,10 @@ public class CKANPackage extends CKAN implements Moderated {
|
||||||
moderationThread.setItemCoordinates(itemID, name, itemTitle, itemURL);
|
moderationThread.setItemCoordinates(itemID, name, itemTitle, itemURL);
|
||||||
moderationThread.postItemApproved(moderatorMessage);
|
moderationThread.postItemApproved(moderatorMessage);
|
||||||
|
|
||||||
if(configuration.getScopeBean().is(Type.VRE)) {
|
String context = configuration.getContext();
|
||||||
|
ScopeBean scopeBean = new ScopeBean(context);
|
||||||
|
|
||||||
|
if(scopeBean.is(Type.VRE)) {
|
||||||
// Actions performed after a package has been correctly created on ckan.
|
// Actions performed after a package has been correctly created on ckan.
|
||||||
sendSocialPost();
|
sendSocialPost();
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class GCoreISConfigurationProxyTest extends ContextTest {
|
||||||
ContextTest.setContextByName("/gcube/devsec/devVRE");
|
ContextTest.setContextByName("/gcube/devsec/devVRE");
|
||||||
String context = SecretManagerProvider.instance.get().getContext();
|
String context = SecretManagerProvider.instance.get().getContext();
|
||||||
GCoreISConfigurationProxy gCoreISConfigurationProxy = new GCoreISConfigurationProxy(context);
|
GCoreISConfigurationProxy gCoreISConfigurationProxy = new GCoreISConfigurationProxy(context);
|
||||||
ServiceCatalogueConfiguration catalogueConfiguration = gCoreISConfigurationProxy.getCatalogueConfigurationFromIS();
|
ServiceCatalogueConfiguration catalogueConfiguration = gCoreISConfigurationProxy.readFromIS();
|
||||||
String json = catalogueConfiguration.toJsonString();
|
String json = catalogueConfiguration.toJsonString();
|
||||||
logger.info("Configuration in context {} is {}", context, json);
|
logger.info("Configuration in context {} is {}", context, json);
|
||||||
/*
|
/*
|
||||||
|
@ -57,7 +57,7 @@ public class GCoreISConfigurationProxyTest extends ContextTest {
|
||||||
String context = SecretManagerProvider.instance.get().getContext();
|
String context = SecretManagerProvider.instance.get().getContext();
|
||||||
GCoreISConfigurationProxy gCoreISConfigurationProxy = new GCoreISConfigurationProxy(context);
|
GCoreISConfigurationProxy gCoreISConfigurationProxy = new GCoreISConfigurationProxy(context);
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
ServiceCatalogueConfiguration catalogueConfiguration = gCoreISConfigurationProxy.getOLDCatalogueConfigurationFromIS();
|
ServiceCatalogueConfiguration catalogueConfiguration = gCoreISConfigurationProxy.getOLDCatalogueConfigurationFromGCoreIS();
|
||||||
String json = catalogueConfiguration.toJsonString();
|
String json = catalogueConfiguration.toJsonString();
|
||||||
logger.debug("Read configuration {}", json);
|
logger.debug("Read configuration {}", json);
|
||||||
catalogueConfiguration = gCoreISConfigurationProxy.createOrUpdateOnIS();
|
catalogueConfiguration = gCoreISConfigurationProxy.createOrUpdateOnIS();
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class CKANOrganizationTest extends ContextTest {
|
||||||
ScopeBean scopeBean = new ScopeBean(context);
|
ScopeBean scopeBean = new ScopeBean(context);
|
||||||
CKANOrganization ckanOrganization = new CKANOrganization();
|
CKANOrganization ckanOrganization = new CKANOrganization();
|
||||||
ckanOrganization.setApiKey(CKANUtility.getSysAdminAPI());
|
ckanOrganization.setApiKey(CKANUtility.getSysAdminAPI());
|
||||||
String name = CatalogueConfiguration.getOrganizationName(scopeBean);
|
String name = CatalogueConfiguration.getOrganizationName(context);
|
||||||
ckanOrganization.setName(name);
|
ckanOrganization.setName(name);
|
||||||
String json = "{\"display_name\": \"" + scopeBean.name() + "\",\"description\": \"" + context + " Organization\",\"name\": \"" + name + "\"}";
|
String json = "{\"display_name\": \"" + scopeBean.name() + "\",\"description\": \"" + context + " Organization\",\"name\": \"" + name + "\"}";
|
||||||
logger.info("Going to create Organization {} : {}", name, json);
|
logger.info("Going to create Organization {} : {}", name, json);
|
||||||
|
|
|
@ -180,8 +180,7 @@ public class CKANPackageTest extends ContextTest {
|
||||||
@Test
|
@Test
|
||||||
public void listWithParameters() throws Exception {
|
public void listWithParameters() throws Exception {
|
||||||
String contextName = "/gcube/devNext/NextNext";
|
String contextName = "/gcube/devNext/NextNext";
|
||||||
ScopeBean scopeBean = new ScopeBean(contextName);
|
String ckanOrganizationName = CatalogueConfiguration.getOrganizationName(contextName);
|
||||||
String ckanOrganizationName = CatalogueConfiguration.getOrganizationName(scopeBean);
|
|
||||||
ContextTest.setContextByName(contextName);
|
ContextTest.setContextByName(contextName);
|
||||||
|
|
||||||
CKANPackage ckanPackage = new CKANPackage();
|
CKANPackage ckanPackage = new CKANPackage();
|
||||||
|
@ -312,8 +311,7 @@ public class CKANPackageTest extends ContextTest {
|
||||||
|
|
||||||
protected CKANPackage createPackage(ObjectMapper mapper, Boolean socialPost) throws Exception {
|
protected CKANPackage createPackage(ObjectMapper mapper, Boolean socialPost) throws Exception {
|
||||||
String currentContext = SecretManagerProvider.instance.get().getContext();
|
String currentContext = SecretManagerProvider.instance.get().getContext();
|
||||||
ScopeBean scopeBean = new ScopeBean(currentContext);
|
String organization = CatalogueConfiguration.getOrganizationName(currentContext);
|
||||||
String organization = CatalogueConfiguration.getOrganizationName(scopeBean);
|
|
||||||
|
|
||||||
ObjectNode itemObjectNode = mapper.createObjectNode();
|
ObjectNode itemObjectNode = mapper.createObjectNode();
|
||||||
itemObjectNode.put(CKAN.NAME_KEY, ITEM_NAME_VALUE);
|
itemObjectNode.put(CKAN.NAME_KEY, ITEM_NAME_VALUE);
|
||||||
|
|
Loading…
Reference in New Issue