ServiceCatalogueConfiguration class provided as argument
This commit is contained in:
parent
3c8932cd1f
commit
07fb1e4213
|
@ -222,7 +222,7 @@ public class Configuration extends BaseREST implements org.gcube.gcat.api.interf
|
||||||
// @AuthorizationControl(allowedRoles={Role.CATALOGUE_MANAGER}, exception=NotAuthorizedException.class)
|
// @AuthorizationControl(allowedRoles={Role.CATALOGUE_MANAGER}, exception=NotAuthorizedException.class)
|
||||||
public Response create(String json) throws WebServiceException {
|
public Response create(String json) throws WebServiceException {
|
||||||
try {
|
try {
|
||||||
ServiceCatalogueConfiguration catalogueConfiguration = ServiceCatalogueConfiguration.getServiceCatalogueConfiguration(json);
|
ServiceCatalogueConfiguration catalogueConfiguration = ServiceCatalogueConfiguration.getServiceCatalogueConfiguration(json, ServiceCatalogueConfiguration.class);
|
||||||
checkContext(CURRENT_CONTEXT_PATH_PARAMETER, catalogueConfiguration);
|
checkContext(CURRENT_CONTEXT_PATH_PARAMETER, catalogueConfiguration);
|
||||||
String ret = createOrUpdate(catalogueConfiguration);
|
String ret = createOrUpdate(catalogueConfiguration);
|
||||||
ResponseBuilder responseBuilder = Response.status(Status.CREATED);
|
ResponseBuilder responseBuilder = Response.status(Status.CREATED);
|
||||||
|
@ -352,7 +352,7 @@ public class Configuration extends BaseREST implements org.gcube.gcat.api.interf
|
||||||
@OperationId("Create or Update")
|
@OperationId("Create or Update")
|
||||||
public String createOrUpdate(@PathParam(CONTEXT_FULLNAME_PARAMETER) String context, String json) throws WebServiceException {
|
public String createOrUpdate(@PathParam(CONTEXT_FULLNAME_PARAMETER) String context, String json) throws WebServiceException {
|
||||||
try {
|
try {
|
||||||
ServiceCatalogueConfiguration catalogueConfiguration = ServiceCatalogueConfiguration.getServiceCatalogueConfiguration(json);
|
ServiceCatalogueConfiguration catalogueConfiguration = ServiceCatalogueConfiguration.getServiceCatalogueConfiguration(json, ServiceCatalogueConfiguration.class);
|
||||||
checkContext(context, catalogueConfiguration);
|
checkContext(context, catalogueConfiguration);
|
||||||
return createOrUpdate(catalogueConfiguration);
|
return createOrUpdate(catalogueConfiguration);
|
||||||
}catch (WebApplicationException e) {
|
}catch (WebApplicationException e) {
|
||||||
|
@ -365,7 +365,7 @@ public class Configuration extends BaseREST implements org.gcube.gcat.api.interf
|
||||||
@Override
|
@Override
|
||||||
public Response update(String json) throws WebServiceException {
|
public Response update(String json) throws WebServiceException {
|
||||||
try {
|
try {
|
||||||
ServiceCatalogueConfiguration catalogueConfiguration = ServiceCatalogueConfiguration.getServiceCatalogueConfiguration(json);
|
ServiceCatalogueConfiguration catalogueConfiguration = ServiceCatalogueConfiguration.getServiceCatalogueConfiguration(json, ServiceCatalogueConfiguration.class);
|
||||||
checkContext(CURRENT_CONTEXT_PATH_PARAMETER);
|
checkContext(CURRENT_CONTEXT_PATH_PARAMETER);
|
||||||
catalogueConfiguration = CatalogueConfigurationFactory.createOrUpdate(catalogueConfiguration);
|
catalogueConfiguration = CatalogueConfigurationFactory.createOrUpdate(catalogueConfiguration);
|
||||||
String configuration = catalogueConfiguration.toJsonString();
|
String configuration = catalogueConfiguration.toJsonString();
|
||||||
|
@ -451,7 +451,7 @@ public class Configuration extends BaseREST implements org.gcube.gcat.api.interf
|
||||||
configuration.set(fieldName, node.get(fieldName));
|
configuration.set(fieldName, node.get(fieldName));
|
||||||
}
|
}
|
||||||
|
|
||||||
ServiceCatalogueConfiguration newCatalogueConfiguration = ServiceCatalogueConfiguration.getServiceCatalogueConfiguration(configuration);
|
ServiceCatalogueConfiguration newCatalogueConfiguration = ServiceCatalogueConfiguration.getServiceCatalogueConfiguration(configuration, ServiceCatalogueConfiguration.class);
|
||||||
newCatalogueConfiguration = CatalogueConfigurationFactory.createOrUpdate(newCatalogueConfiguration);
|
newCatalogueConfiguration = CatalogueConfigurationFactory.createOrUpdate(newCatalogueConfiguration);
|
||||||
String ret = newCatalogueConfiguration.toJsonString();
|
String ret = newCatalogueConfiguration.toJsonString();
|
||||||
logger.debug("Configuration in context {} has been patched to {}", catalogueConfiguration.getContext(), ret);
|
logger.debug("Configuration in context {} has been patched to {}", catalogueConfiguration.getContext(), ret);
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class GCoreISConfigurationProxyTest extends ContextTest {
|
||||||
String context = SecretManagerProvider.instance.get().getContext();
|
String context = SecretManagerProvider.instance.get().getContext();
|
||||||
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(DEVVRE_CONFIG_JSON);
|
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(DEVVRE_CONFIG_JSON);
|
||||||
String json = new BufferedReader(new InputStreamReader(inputStream)).lines().collect(Collectors.joining("\n"));
|
String json = new BufferedReader(new InputStreamReader(inputStream)).lines().collect(Collectors.joining("\n"));
|
||||||
ServiceCatalogueConfiguration catalogueConfiguration = ServiceCatalogueConfiguration.getServiceCatalogueConfiguration(json);
|
ServiceCatalogueConfiguration catalogueConfiguration = ServiceCatalogueConfiguration.getServiceCatalogueConfiguration(json, ServiceCatalogueConfiguration.class);
|
||||||
GCoreISConfigurationProxy gCoreISConfigurationProxy = new GCoreISConfigurationProxy(context);
|
GCoreISConfigurationProxy gCoreISConfigurationProxy = new GCoreISConfigurationProxy(context);
|
||||||
gCoreISConfigurationProxy.setCatalogueConfiguration(catalogueConfiguration);
|
gCoreISConfigurationProxy.setCatalogueConfiguration(catalogueConfiguration);
|
||||||
gCoreISConfigurationProxy.createOnIS();
|
gCoreISConfigurationProxy.createOnIS();
|
||||||
|
|
Loading…
Reference in New Issue