Merged from Branch
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/is-exporter-se-plugin@152669 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
20eb34ed77
commit
2c221bd88f
|
@ -22,7 +22,7 @@
|
|||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.7
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE xml>
|
||||
<ReleaseNotes>
|
||||
<Changeset component="org.gcube.informationsystem.is-exporter-se-plugin.1.0.0" date="${buildDate}">
|
||||
<Changeset component="org.gcube.informationsystem.is-exporter-se-plugin.1.1.0" date="${buildDate}">
|
||||
<Change>Removed List and Set usage as workaround fo OrientDB bug #9021</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.informationsystem.is-exporter-se-plugin.1.0.0" date="2017-06-07">
|
||||
<Change>First Release</Change>
|
||||
</Changeset>
|
||||
</ReleaseNotes>
|
68
pom.xml
68
pom.xml
|
@ -7,7 +7,7 @@
|
|||
</parent>
|
||||
<groupId>org.gcube.information-system</groupId>
|
||||
<artifactId>is-exporter-se-plugin</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<name>IS Exporter</name>
|
||||
<description>Exports GenericReosurce and ServiceEndpoint from gCoreIS to Resource Registry</description>
|
||||
<properties>
|
||||
|
@ -55,12 +55,6 @@
|
|||
<version>[1.5.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-scope</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.resources</groupId>
|
||||
<artifactId>common-gcore-resources</artifactId>
|
||||
|
@ -76,7 +70,21 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>authorization-client</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-encryption</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-scope-maps</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.information-system</groupId>
|
||||
<artifactId>information-system-model</artifactId>
|
||||
|
@ -96,6 +104,27 @@
|
|||
<artifactId>resource-registry-publisher</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>home-library-jcr</artifactId>
|
||||
|
@ -113,8 +142,28 @@
|
|||
<artifactId>home-library</artifactId>
|
||||
<version>[2.0.0-SNAPSHOT,3.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
-->
|
||||
|
||||
<!-- dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-scope</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency -->
|
||||
|
||||
|
||||
<!-- dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>common-authorization</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency -->
|
||||
|
||||
<!-- dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-gcore-stubs</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency -->
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
<artifactId>json</artifactId>
|
||||
|
@ -129,6 +178,7 @@
|
|||
</dependency>
|
||||
|
||||
<!-- Test dependencies -->
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
|
@ -142,11 +192,7 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
|
|
|
@ -21,6 +21,9 @@ public class ISExporterPlugin extends Plugin<ISExporterPluginDeclaration> {
|
|||
*/
|
||||
private static Logger logger = LoggerFactory.getLogger(ISExporterPlugin.class);
|
||||
|
||||
public static final String FILTERED_REPORT = "FILTERED_REPORT";
|
||||
|
||||
|
||||
public ISExporterPlugin(ISExporterPluginDeclaration pluginDeclaration) {
|
||||
super(pluginDeclaration);
|
||||
logger.debug("contructor");
|
||||
|
@ -32,16 +35,26 @@ public class ISExporterPlugin extends Plugin<ISExporterPluginDeclaration> {
|
|||
String token = SecurityTokenProvider.instance.get();
|
||||
AuthorizationEntry authorizationEntry = Constants.authorizationService().get(token);
|
||||
String scope = authorizationEntry.getContext();
|
||||
logger.debug("Launching {} execution on scope {}",
|
||||
logger.info("Launching {} execution on scope {}",
|
||||
ISExporterPluginDeclaration.NAME, scope);
|
||||
|
||||
GenericResourceExporter genericResourceExporter = new GenericResourceExporter();
|
||||
boolean filteredReport = false;
|
||||
|
||||
try {
|
||||
filteredReport = (boolean) inputs.getOrDefault(FILTERED_REPORT, false);
|
||||
}catch (Exception e) {
|
||||
filteredReport = false;
|
||||
}
|
||||
|
||||
logger.debug("Failure Report are filtered (e.g. Failing UUID are not shown to avoid to produce to much uneeded reports)");
|
||||
|
||||
GenericResourceExporter genericResourceExporter = new GenericResourceExporter(filteredReport);
|
||||
genericResourceExporter.export();
|
||||
|
||||
ServiceEndpointExporter serviceEndpointExporter = new ServiceEndpointExporter();
|
||||
ServiceEndpointExporter serviceEndpointExporter = new ServiceEndpointExporter(filteredReport);
|
||||
serviceEndpointExporter.export();
|
||||
|
||||
logger.debug("{} execution finished", ISExporterPluginDeclaration.NAME);
|
||||
logger.info("{} execution finished", ISExporterPluginDeclaration.NAME);
|
||||
}
|
||||
|
||||
/**{@inheritDoc}*/
|
||||
|
|
|
@ -2,7 +2,6 @@ package org.gcube.informationsystem.exporter.mapper;
|
|||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
|
@ -17,16 +16,7 @@ import java.util.UUID;
|
|||
import org.gcube.common.authorization.client.Constants;
|
||||
import org.gcube.common.authorization.library.AuthorizationEntry;
|
||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||
import org.gcube.common.homelibrary.home.Home;
|
||||
import org.gcube.common.homelibrary.home.HomeLibrary;
|
||||
import org.gcube.common.homelibrary.home.HomeManager;
|
||||
import org.gcube.common.homelibrary.home.HomeManagerFactory;
|
||||
import org.gcube.common.homelibrary.home.workspace.Workspace;
|
||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder;
|
||||
import org.gcube.common.homelibrary.home.workspace.folder.FolderItem;
|
||||
import org.gcube.common.homelibrary.util.WorkspaceUtil;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.informationsystem.exporter.ISExporterPluginDeclaration;
|
||||
import org.gcube.informationsystem.exporter.mapper.exception.CreateException;
|
||||
import org.gcube.informationsystem.exporter.mapper.exception.UpdateException;
|
||||
import org.gcube.informationsystem.impl.utils.ISMapper;
|
||||
|
@ -52,35 +42,36 @@ import com.fasterxml.jackson.databind.node.ArrayNode;
|
|||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
|
||||
public abstract class GCoreResourceMapper<GR extends org.gcube.common.resources.gcore.Resource, R extends Resource> {
|
||||
|
||||
|
||||
/**
|
||||
* Logger
|
||||
*/
|
||||
private static Logger logger = LoggerFactory.getLogger(GCoreResourceMapper.class);
|
||||
|
||||
|
||||
public static final String EXPORTED = "EXPORTED";
|
||||
public static final String EXPORTED_FROM_OLD_GCORE_IS = "EXPORTED_FROM_OLD_GCORE_IS";
|
||||
|
||||
|
||||
public static final String MAPPING_ERROR = "mapping";
|
||||
public static final String PUBLISHING_ERROR = "publishing";
|
||||
public static final String TYPE = "type";
|
||||
public static final String ID = "id";
|
||||
public static final String ERROR = "error";
|
||||
public static final String DATE = "date";
|
||||
|
||||
|
||||
public static final String EXCEPTION_TYPE = "exceptionType";
|
||||
public static final String CREATE = "create";
|
||||
public static final String UPDATE = "update";
|
||||
|
||||
protected Class<GR> grClass;
|
||||
protected Class<R> rClass;
|
||||
|
||||
|
||||
protected final Class<GR> grClass;
|
||||
protected final Class<R> rClass;
|
||||
protected final boolean filteredReport;
|
||||
|
||||
public static final String UTF8 = "UTF-8";
|
||||
|
||||
protected ResourceRegistryPublisher resourceRegistryPublisher;
|
||||
protected ResourceRegistryClient resourceRegistryClient;
|
||||
|
||||
public static String getCurrentContextName(){
|
||||
public static String getCurrentContextName() {
|
||||
String token = SecurityTokenProvider.instance.get();
|
||||
AuthorizationEntry authorizationEntry = null;
|
||||
try {
|
||||
|
@ -90,22 +81,24 @@ public abstract class GCoreResourceMapper<GR extends org.gcube.common.resources.
|
|||
}
|
||||
return authorizationEntry.getContext();
|
||||
}
|
||||
|
||||
public static String getDateString(Calendar calendar){
|
||||
Date date = calendar.getTime();
|
||||
|
||||
public static String getDateString(Calendar calendar) {
|
||||
Date date = calendar.getTime();
|
||||
SimpleDateFormat format = new SimpleDateFormat(ISConstants.DATETIME_PATTERN);
|
||||
return format.format(date);
|
||||
return format.format(date);
|
||||
}
|
||||
|
||||
public File getFile(Class<?> grClass, String contextFullName, String dateString){
|
||||
return new File(contextFullName.replace("/", "_") + "-" + grClass.getSimpleName() + "-" + dateString + "-exporter.json");
|
||||
|
||||
public File getFile(Class<?> grClass, String contextFullName, String dateString) {
|
||||
return new File(contextFullName.replace("/", "_") + "-" + grClass.getSimpleName() + "-" + dateString
|
||||
+ "-exporter.json");
|
||||
}
|
||||
|
||||
protected GCoreResourceMapper(Class<GR> grClass, Class<R> rClass){
|
||||
|
||||
protected GCoreResourceMapper(Class<GR> grClass, Class<R> rClass, boolean filteredReport) {
|
||||
this.grClass = grClass;
|
||||
this.rClass = rClass;
|
||||
this.resourceRegistryPublisher = ResourceRegistryPublisherFactory.create();
|
||||
this.resourceRegistryClient = ResourceRegistryClientFactory.create();
|
||||
this.filteredReport = filteredReport;
|
||||
}
|
||||
|
||||
protected List<GR> getAll() {
|
||||
|
@ -113,62 +106,64 @@ public abstract class GCoreResourceMapper<GR extends org.gcube.common.resources.
|
|||
DiscoveryClient<GR> client = ICFactory.clientFor(grClass);
|
||||
return client.submit(query);
|
||||
}
|
||||
|
||||
protected String getStringAsUTF8(String s) throws UnsupportedEncodingException{
|
||||
|
||||
protected String getStringAsUTF8(String s) throws UnsupportedEncodingException {
|
||||
byte bytes[] = s.getBytes("ISO-8859-1");
|
||||
return new String(bytes, UTF8);
|
||||
return new String(bytes, UTF8);
|
||||
}
|
||||
|
||||
|
||||
protected R create(R r) throws ResourceRegistryException {
|
||||
return resourceRegistryPublisher.createResource(rClass, r);
|
||||
}
|
||||
|
||||
|
||||
protected R update(R r) throws ResourceRegistryException {
|
||||
return resourceRegistryPublisher.updateResource(rClass, r);
|
||||
}
|
||||
|
||||
|
||||
protected R read(UUID uuid) throws ResourceRegistryException {
|
||||
return resourceRegistryClient.getInstance(rClass, uuid);
|
||||
}
|
||||
|
||||
|
||||
protected R createOrUpdate(R r) throws ResourceRegistryException {
|
||||
|
||||
|
||||
UUID uuid = r.getHeader().getUUID();
|
||||
boolean update = false;
|
||||
|
||||
boolean update = false;
|
||||
|
||||
try {
|
||||
resourceRegistryClient.exists(rClass, uuid);
|
||||
update = true;
|
||||
}catch (ResourceNotFoundException e) {
|
||||
} catch (ResourceNotFoundException e) {
|
||||
update = false;
|
||||
} catch (ResourceAvailableInAnotherContextException e) {
|
||||
// This code should never be reached because this should be fixed in map function
|
||||
// This code should never be reached because this should be fixed in
|
||||
// map function
|
||||
resourceRegistryPublisher.addResourceToContext(uuid);
|
||||
try{
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
}catch (Exception ee) {}
|
||||
update= true;
|
||||
} catch (Exception ee) {
|
||||
}
|
||||
update = true;
|
||||
}
|
||||
|
||||
if(update){
|
||||
|
||||
if (update) {
|
||||
logger.debug("Resource with UUID {} exist. It will be updated", uuid);
|
||||
try{
|
||||
try {
|
||||
return update(r);
|
||||
}catch (ResourceRegistryException e) {
|
||||
} catch (ResourceRegistryException e) {
|
||||
throw new UpdateException(e);
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
logger.debug("Resource with UUID {} does not exist. It will be created", uuid);
|
||||
try{
|
||||
try {
|
||||
return create(r);
|
||||
}catch (ResourceRegistryException e) {
|
||||
} catch (ResourceRegistryException e) {
|
||||
throw new CreateException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private ObjectNode addNodeToArray(ArrayNode arrayNode, ObjectMapper objectMapper, GR gr, Exception e){
|
||||
|
||||
private ObjectNode addNodeToArray(ArrayNode arrayNode, ObjectMapper objectMapper, GR gr, Exception e) {
|
||||
ObjectNode objectNode = objectMapper.createObjectNode();
|
||||
objectNode.put(TYPE, grClass.getSimpleName());
|
||||
objectNode.put(ID, gr.id());
|
||||
|
@ -176,192 +171,202 @@ public abstract class GCoreResourceMapper<GR extends org.gcube.common.resources.
|
|||
arrayNode.add(objectNode);
|
||||
return objectNode;
|
||||
}
|
||||
|
||||
|
||||
protected String getUsername() throws Exception {
|
||||
String token = SecurityTokenProvider.instance.get();
|
||||
return Constants.authorizationService().get(token).getClientInfo().getId();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected Home getHome(HomeManager manager) throws Exception{
|
||||
Home home = null;
|
||||
String scope = ScopeProvider.instance.get();
|
||||
if(scope!=null){
|
||||
home = manager.getHome(getUsername());
|
||||
}else{
|
||||
home = manager.getHome();
|
||||
}
|
||||
return home;
|
||||
}
|
||||
|
||||
protected WorkspaceFolder getExporterFolder(Workspace ws) throws Exception {
|
||||
WorkspaceFolder root = ws.getRoot();
|
||||
|
||||
WorkspaceFolder exporterFolder = null;
|
||||
if(!ws.exists(ISExporterPluginDeclaration.NAME, root.getId())){
|
||||
String folderDescription = String.format("The folder is used by %s plugin to store informations regarding failures exporting old GCore Resource to new Resource Registry", ISExporterPluginDeclaration.NAME);
|
||||
exporterFolder = ws.createFolder(ISExporterPluginDeclaration.NAME, folderDescription, root.getId());
|
||||
}else{
|
||||
exporterFolder = (WorkspaceFolder) ws.find(ISExporterPluginDeclaration.NAME, root.getId());
|
||||
}
|
||||
return exporterFolder;
|
||||
}
|
||||
|
||||
public static final String APPLICATION_JSON_MIMETYPE = "application/json";
|
||||
|
||||
private static final String FOLDER_DESCRIPTION = "Failures Report Folder for " + ISExporterPluginDeclaration.NAME;
|
||||
|
||||
protected FolderItem publishFileToWorkspace(File file) throws Exception {
|
||||
HomeManagerFactory factory = HomeLibrary.getHomeManagerFactory();
|
||||
HomeManager manager = factory.getHomeManager();
|
||||
Home home = getHome(manager);
|
||||
Workspace ws = home.getWorkspace();
|
||||
WorkspaceFolder exporterFolder = getExporterFolder(ws);
|
||||
FileInputStream fileInputStream = new FileInputStream(file);
|
||||
|
||||
FolderItem folderItem = WorkspaceUtil.createExternalFile(
|
||||
exporterFolder, file.getName(),
|
||||
FOLDER_DESCRIPTION,
|
||||
APPLICATION_JSON_MIMETYPE,
|
||||
fileInputStream);
|
||||
return folderItem;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* @SuppressWarnings("deprecation") protected Home getHome(HomeManager
|
||||
* manager) throws Exception{ Home home = null; String scope =
|
||||
* ScopeProvider.instance.get(); if(scope!=null){ home =
|
||||
* manager.getHome(getUsername()); }else{ home = manager.getHome(); } return
|
||||
* home; }
|
||||
*
|
||||
* protected WorkspaceFolder getExporterFolder(Workspace ws) throws
|
||||
* Exception { WorkspaceFolder root = ws.getRoot();
|
||||
*
|
||||
* WorkspaceFolder exporterFolder = null;
|
||||
* if(!ws.exists(ISExporterPluginDeclaration.NAME, root.getId())){ String
|
||||
* folderDescription = String.
|
||||
* format("The folder is used by %s plugin to store informations regarding failures exporting old GCore Resource to new Resource Registry"
|
||||
* , ISExporterPluginDeclaration.NAME); exporterFolder =
|
||||
* ws.createFolder(ISExporterPluginDeclaration.NAME, folderDescription,
|
||||
* root.getId()); }else{ exporterFolder = (WorkspaceFolder)
|
||||
* ws.find(ISExporterPluginDeclaration.NAME, root.getId()); } return
|
||||
* exporterFolder; }
|
||||
*
|
||||
* public static final String APPLICATION_JSON_MIMETYPE =
|
||||
* "application/json";
|
||||
*
|
||||
* private static final String FOLDER_DESCRIPTION =
|
||||
* "Failures Report Folder for " + ISExporterPluginDeclaration.NAME;
|
||||
*
|
||||
* protected FolderItem publishFileToWorkspace(File file) throws Exception {
|
||||
* HomeManagerFactory factory = HomeLibrary.getHomeManagerFactory();
|
||||
* HomeManager manager = factory.getHomeManager(); Home home =
|
||||
* getHome(manager); Workspace ws = home.getWorkspace(); WorkspaceFolder
|
||||
* exporterFolder = getExporterFolder(ws); FileInputStream fileInputStream =
|
||||
* new FileInputStream(file);
|
||||
*
|
||||
* FolderItem folderItem = WorkspaceUtil.createExternalFile( exporterFolder,
|
||||
* file.getName(), FOLDER_DESCRIPTION, APPLICATION_JSON_MIMETYPE,
|
||||
* fileInputStream); return folderItem; }
|
||||
*/
|
||||
|
||||
protected abstract R map(GR gr) throws Exception;
|
||||
|
||||
protected void notifyFailures(int allSize, List<GR> failed){
|
||||
|
||||
protected void notifyFailures(int allSize, List<GR> failed) {
|
||||
String contextName = getCurrentContextName();
|
||||
|
||||
if(failed.size()==0){
|
||||
logger.debug("No needs to create an empty report besause there were no exporting failures on {}", contextName);
|
||||
|
||||
if (failed.size() == 0) {
|
||||
logger.debug("No needs to create an empty report besause there were no exporting failures on {}",
|
||||
contextName);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
logger.warn("-------------------------------------------------------");
|
||||
logger.warn("{} : {} of {} ({} failures) {}s were exported as {}s", contextName,
|
||||
allSize-failed.size(), allSize, failed.size(), grClass.getSimpleName(), rClass.getSimpleName());
|
||||
logger.warn("{} : {} of {} ({} failures) {}s were exported as {}s", contextName, allSize - failed.size(),
|
||||
allSize, failed.size(), grClass.getSimpleName(), rClass.getSimpleName());
|
||||
logger.warn("-------------------------------------------------------\n\n");
|
||||
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
|
||||
ObjectNode objectNode = objectMapper.createObjectNode();
|
||||
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
String dateString = getDateString(calendar);
|
||||
objectNode.put(DATE, dateString);
|
||||
ObjectNode context = objectNode.putObject(contextName);
|
||||
ArrayNode mappingArrayNode = context.putArray(MAPPING_ERROR);
|
||||
ArrayNode publishingArrayNode = context.putArray(PUBLISHING_ERROR);
|
||||
|
||||
for(GR gr : failed){
|
||||
|
||||
for (GR gr : failed) {
|
||||
logger.trace("-------------------------------------------------------");
|
||||
|
||||
if (filteredReport) {
|
||||
try {
|
||||
UUID.fromString(gr.id());
|
||||
} catch (Exception e) {
|
||||
logger.debug(
|
||||
"{} with has id {} which is not a valid UUID. The reports are filtered and such an error is not reported.",
|
||||
gr.getClass().getSimpleName(), gr.id());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
R r = null;
|
||||
try {
|
||||
r = map(gr);
|
||||
} catch (Exception e) {
|
||||
addNodeToArray(mappingArrayNode, objectMapper, gr, e);
|
||||
logger.trace("Error exporting {}. The problem was on mapping {} with UUID {}", gr, grClass.getSimpleName(), gr.id());
|
||||
logger.trace("Error exporting {}. The problem was on mapping {} with UUID {}", gr,
|
||||
grClass.getSimpleName(), gr.id());
|
||||
logger.trace("-------------------------------------------------------\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
createOrUpdate(r);
|
||||
}catch (Exception e) {
|
||||
if(e.getCause() instanceof NullPointerException){
|
||||
} catch (Exception e) {
|
||||
if (e.getCause() instanceof NullPointerException) {
|
||||
logger.error("This MUST BE A BUG. Please Investigate");
|
||||
}
|
||||
|
||||
if(e.getMessage().contains("com.orientechnologies.orient.server.distributed.task.ODistributedOperationException")){
|
||||
|
||||
if (e.getMessage().contains(
|
||||
"com.orientechnologies.orient.server.distributed.task.ODistributedOperationException")) {
|
||||
logger.error("This is an OrientDB distributed Issue");
|
||||
}
|
||||
|
||||
|
||||
ObjectNode node = addNodeToArray(publishingArrayNode, objectMapper, gr, e);
|
||||
if(e instanceof CreateException) {
|
||||
if (e instanceof CreateException) {
|
||||
node.put(EXCEPTION_TYPE, CREATE);
|
||||
}
|
||||
|
||||
if(e instanceof UpdateException){
|
||||
|
||||
if (e instanceof UpdateException) {
|
||||
node.put(EXCEPTION_TYPE, UPDATE);
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
logger.trace("Error exporting {}. The problem was on publishing {} as {}", gr, rClass.getSimpleName(), ISMapper.marshal(r));
|
||||
logger.trace("Error exporting {}. The problem was on publishing {} as {}", gr,
|
||||
rClass.getSimpleName(), ISMapper.marshal(r));
|
||||
} catch (JsonProcessingException e1) {
|
||||
logger.trace("", e1);
|
||||
}
|
||||
}
|
||||
logger.trace("-------------------------------------------------------\n");
|
||||
}
|
||||
|
||||
if(filteredReport){
|
||||
if(mappingArrayNode.size()==0 && publishingArrayNode.size()==0){
|
||||
logger.debug("No need to produce JSON reports because alla the errors where filtered as requested by the input parameters.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
String json = objectMapper.writeValueAsString(objectNode);
|
||||
|
||||
|
||||
File file = getFile(rClass, contextName, dateString);
|
||||
synchronized (file) {
|
||||
try(FileWriter fw = new FileWriter(file, true);
|
||||
BufferedWriter bw = new BufferedWriter(fw);
|
||||
PrintWriter out = new PrintWriter(bw)){
|
||||
out.println(json);
|
||||
out.flush();
|
||||
} catch( IOException e ){
|
||||
throw e;
|
||||
try (FileWriter fw = new FileWriter(file, true);
|
||||
BufferedWriter bw = new BufferedWriter(fw);
|
||||
PrintWriter out = new PrintWriter(bw)) {
|
||||
out.println(json);
|
||||
out.flush();
|
||||
} catch (IOException e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
publishFileToWorkspace(file);
|
||||
file.delete();
|
||||
}catch (Exception e) {
|
||||
logger.error("Error while saving file {} on Workspace", file.getName(), e);
|
||||
// TODO Use the Social Notification
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* try { publishFileToWorkspace(file); file.delete(); }catch
|
||||
* (Exception e) {
|
||||
* logger.error("Error while saving file {} on Workspace",
|
||||
* file.getName(), e); // TODO Use the Social Notification }
|
||||
*/
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Error exporting JSON error result", e);
|
||||
}
|
||||
|
||||
|
||||
logger.trace("-------------------------------------------------------\n\n\n\n\n");
|
||||
}
|
||||
|
||||
|
||||
protected R mapAndPublish(GR gr) throws Exception {
|
||||
R r = map(gr);
|
||||
|
||||
|
||||
List<? extends Facet> facets = r.getIdentificationFacets();
|
||||
for(Facet f : facets){
|
||||
for (Facet f : facets) {
|
||||
f.setAdditionalProperty(EXPORTED, EXPORTED_FROM_OLD_GCORE_IS);
|
||||
}
|
||||
|
||||
|
||||
return createOrUpdate(r);
|
||||
}
|
||||
|
||||
|
||||
public void export() {
|
||||
|
||||
|
||||
List<GR> all = getAll();
|
||||
|
||||
|
||||
logger.debug("-------------------------------------------------------");
|
||||
logger.debug("Going to export {} {}s as {}s",
|
||||
all.size(), grClass.getSimpleName(), rClass.getSimpleName());
|
||||
logger.debug("Going to export {} {}s as {}s", all.size(), grClass.getSimpleName(), rClass.getSimpleName());
|
||||
logger.debug("-------------------------------------------------------");
|
||||
|
||||
|
||||
|
||||
List<GR> failed = new ArrayList<>();
|
||||
|
||||
for(GR gr : all){
|
||||
|
||||
for (GR gr : all) {
|
||||
try {
|
||||
Thread.sleep(300);
|
||||
mapAndPublish(gr);
|
||||
}catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
failed.add(gr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
notifyFailures(all.size(), failed);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -29,8 +29,8 @@ public class GenericResourceExporter extends GCoreResourceMapper<GenericResource
|
|||
public static final String FIXED_VERSION = "1.0.0";
|
||||
public static final String FULL_BODY = "FULL_BODY";
|
||||
|
||||
public GenericResourceExporter(){
|
||||
super(GenericResource.class, Configuration.class);
|
||||
public GenericResourceExporter(Boolean filteredReport){
|
||||
super(GenericResource.class, Configuration.class, filteredReport);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.gcube.informationsystem.exporter.mapper;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -21,6 +20,7 @@ import org.gcube.informationsystem.impl.entity.facet.SoftwareFacetImpl;
|
|||
import org.gcube.informationsystem.impl.entity.resource.EServiceImpl;
|
||||
import org.gcube.informationsystem.impl.relation.ConsistsOfImpl;
|
||||
import org.gcube.informationsystem.impl.relation.IsIdentifiedByImpl;
|
||||
import org.gcube.informationsystem.impl.utils.ISMapper;
|
||||
import org.gcube.informationsystem.model.embedded.Header;
|
||||
import org.gcube.informationsystem.model.embedded.ValueSchema;
|
||||
import org.gcube.informationsystem.model.entity.Facet;
|
||||
|
@ -37,6 +37,9 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resour
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
|
||||
public class ServiceEndpointExporter extends GCoreResourceMapper<ServiceEndpoint, EService> {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(ServiceEndpointExporter.class);
|
||||
|
@ -51,25 +54,23 @@ public class ServiceEndpointExporter extends GCoreResourceMapper<ServiceEndpoint
|
|||
public static final String USERNAME = "USERNAME";
|
||||
public static final String PASSWORD = "PASSWORD";
|
||||
public static final String USERNAME_PASSWORD_SCHEMA_STRING;
|
||||
//public static final URI USERNAME_PASSWORD_SCHEMA;
|
||||
|
||||
public static final String NAME = "NAME";
|
||||
public static final String ENCRYPTED = "ENCRYPTED";
|
||||
public static final String VALUE = "VALUE";
|
||||
public static final String PROPERTY_SCHEMA_STRING;
|
||||
public static final URI PROPERTY_SCHEMA;
|
||||
public static final String NAME = "name";
|
||||
public static final String VALUE = "value";
|
||||
public static final String ENCRYPTED = "encrypted";
|
||||
|
||||
public static final String ARRAY = "ARRAY";
|
||||
public static final String PROPERTIES = "PROPERTIES";
|
||||
|
||||
|
||||
public static final String NOT_URI_ENDPOINT = "NOT_URI_ENDPOINT";
|
||||
|
||||
static {
|
||||
USERNAME_PASSWORD_SCHEMA_STRING = String.format("%s:%s", USERNAME, PASSWORD);
|
||||
//USERNAME_PASSWORD_SCHEMA = URI.create(USERNAME_PASSWORD_SCHEMA_STRING);
|
||||
PROPERTY_SCHEMA_STRING = String.format("%s:%s:%s", NAME, ENCRYPTED, VALUE);
|
||||
PROPERTY_SCHEMA = URI.create(PROPERTY_SCHEMA_STRING);
|
||||
}
|
||||
|
||||
public ServiceEndpointExporter(){
|
||||
super(ServiceEndpoint.class, EService.class);
|
||||
public ServiceEndpointExporter(boolean filteredReport){
|
||||
super(ServiceEndpoint.class, EService.class, filteredReport);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -274,23 +275,22 @@ public class ServiceEndpointExporter extends GCoreResourceMapper<ServiceEndpoint
|
|||
}
|
||||
/* ----- */
|
||||
|
||||
Group<Property> properties = accessPoint.properties();
|
||||
if(properties!=null && properties.size()>0){
|
||||
ObjectNode propertiesObjectNode = ISMapper.getObjectMapper().createObjectNode();
|
||||
ArrayNode arrayNode = propertiesObjectNode.putArray(ARRAY);
|
||||
|
||||
for(Property property : properties){
|
||||
ObjectNode objectNode = ISMapper.getObjectMapper().createObjectNode();
|
||||
objectNode.put(NAME, property.name());
|
||||
objectNode.put(VALUE, property.value());
|
||||
objectNode.put(ENCRYPTED, Boolean.toString(property.isEncrypted()));
|
||||
|
||||
List<ValueSchema> properties = new ArrayList<>();
|
||||
|
||||
for(Property property : accessPoint.properties()){
|
||||
ValueSchema valueSchema = new ValueSchemaImpl();
|
||||
String propertyValue = PROPERTY_SCHEMA.toString();
|
||||
propertyValue = propertyValue.replace(NAME, property.name());
|
||||
propertyValue = propertyValue.replace(ENCRYPTED, Boolean.toString(property.isEncrypted()));
|
||||
propertyValue = propertyValue.replace(VALUE, property.value());
|
||||
|
||||
valueSchema.setValue(propertyValue);
|
||||
valueSchema.setSchema(PROPERTY_SCHEMA);
|
||||
|
||||
properties.add(valueSchema);
|
||||
arrayNode.add(objectNode);
|
||||
}
|
||||
|
||||
accessPointFacets[i].setAdditionalProperty(PROPERTIES, propertiesObjectNode);
|
||||
}
|
||||
//accessPointFacets[i].setProperties(properties);
|
||||
|
||||
i++;
|
||||
}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
org.gcube.informationsystem.exporter.ISExporterPluginDeclaration
|
|
@ -1,5 +1,8 @@
|
|||
package org.gcube.informationsystem.exporter;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.common.authorization.client.exceptions.ObjectNotFound;
|
||||
import org.gcube.informationsystem.exporter.mapper.GenericResourceExporterTest;
|
||||
import org.gcube.informationsystem.exporter.mapper.ServiceEndpointExporterTest;
|
||||
|
@ -25,13 +28,15 @@ public class ISExporterPluginTest {
|
|||
logger.info("\n\n\n-------------------------------------------------------------------------");
|
||||
ScopedTest.setContext(token);
|
||||
ISExporterPlugin isExporterPlugin = new ISExporterPlugin(new ISExporterPluginDeclaration());
|
||||
isExporterPlugin.launch(null);
|
||||
Map<String, Object> inputs = new HashMap<String, Object>();
|
||||
inputs.put(ISExporterPlugin.FILTERED_REPORT, true);
|
||||
isExporterPlugin.launch(inputs);
|
||||
logger.info("\n\n\n");
|
||||
}
|
||||
}
|
||||
|
||||
//@Test
|
||||
public void delAllExported() throws ObjectNotFound, Exception{
|
||||
public void removeExported() throws ObjectNotFound, Exception{
|
||||
String[] tokens = {
|
||||
ScopedTest.GCUBE,
|
||||
ScopedTest.GCUBE_DEVSEC,
|
||||
|
@ -44,10 +49,10 @@ public class ISExporterPluginTest {
|
|||
ScopedTest.setContext(token);
|
||||
|
||||
GenericResourceExporterTest genericResourceExporterTest = new GenericResourceExporterTest();
|
||||
genericResourceExporterTest.del();
|
||||
genericResourceExporterTest.removeExported();
|
||||
|
||||
ServiceEndpointExporterTest serviceEndpointExporterTest = new ServiceEndpointExporterTest();
|
||||
serviceEndpointExporterTest.del();
|
||||
serviceEndpointExporterTest.removeExported();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,11 +47,14 @@ public class GCoreResourceMapperTest extends ScopedTest {
|
|||
for(String token : tokens){
|
||||
logger.info("\n\n\n-------------------------------------------------------------------------");
|
||||
ScopedTest.setContext(token);
|
||||
GenericResourceExporter gre = new GenericResourceExporter();
|
||||
GenericResourceExporter gre = new GenericResourceExporter(false);
|
||||
File file = getFile(gre);
|
||||
logger.info("\n\n\n {}", file);
|
||||
/*
|
||||
gre.publishFileToWorkspace(file);
|
||||
logger.info("\n\n\n");
|
||||
file.delete();
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,11 +4,11 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.gcube.common.authorization.client.exceptions.ObjectNotFound;
|
||||
import org.gcube.common.resources.gcore.GenericResource;
|
||||
import org.gcube.informationsystem.exporter.ScopedTest;
|
||||
import org.gcube.informationsystem.model.entity.Facet;
|
||||
import org.gcube.informationsystem.model.entity.resource.Configuration;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClient;
|
||||
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClientFactory;
|
||||
import org.gcube.informationsystem.resourceregistry.publisher.ResourceRegistryPublisher;
|
||||
|
@ -23,89 +23,68 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
public class GenericResourceExporterTest extends ScopedTest{
|
||||
|
||||
public class GenericResourceExporterTest extends ScopedTest {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(GenericResourceExporterTest.class);
|
||||
|
||||
|
||||
@Test
|
||||
public void export(){
|
||||
GenericResourceExporter gre = new GenericResourceExporter();
|
||||
public void export() {
|
||||
GenericResourceExporter gre = new GenericResourceExporter(false);
|
||||
gre.export();
|
||||
}
|
||||
|
||||
|
||||
public void del() throws ResourceRegistryException{
|
||||
|
||||
public void removeExported() throws ObjectNotFound, Exception {
|
||||
ResourceRegistryClient client = ResourceRegistryClientFactory.create();
|
||||
ResourceRegistryPublisher publisher = ResourceRegistryPublisherFactory.create();
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Configuration> configurations = (List<Configuration>) client.getInstances(Configuration.NAME, false);
|
||||
List<Configuration> failed = new ArrayList<>();
|
||||
|
||||
logger.debug("Going to delete {} {}s",
|
||||
configurations.size(), Configuration.NAME);
|
||||
|
||||
|
||||
logger.debug("Going to delete {} {}s", configurations.size(), Configuration.NAME);
|
||||
|
||||
int excluded = 0;
|
||||
|
||||
for(Configuration configuration : configurations){
|
||||
|
||||
for (Configuration configuration : configurations) {
|
||||
try {
|
||||
Facet facet = configuration.getIdentificationFacets().get(0);
|
||||
String string = (String) facet.getAdditionalProperty(GCoreResourceMapper.EXPORTED);
|
||||
publisher.deleteResource(configuration);
|
||||
if(string!=null && string.compareTo(GCoreResourceMapper.EXPORTED_FROM_OLD_GCORE_IS)==0){
|
||||
if (string != null && string.compareTo(GCoreResourceMapper.EXPORTED_FROM_OLD_GCORE_IS) == 0) {
|
||||
publisher.deleteResource(configuration);
|
||||
}else{
|
||||
} else {
|
||||
excluded++;
|
||||
}
|
||||
}catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
failed.add(configuration);
|
||||
}
|
||||
}
|
||||
|
||||
logger.debug("{} of {} ({} failures) {}s were deleted. {} {}s were excluded because there was not exported from gCore IS.",
|
||||
configurations.size()-failed.size()-excluded, configurations.size(), failed.size(), Configuration.NAME, excluded, Configuration.NAME);
|
||||
|
||||
logger.debug(
|
||||
"{} of {} ({} failures) {}s were deleted. {} {}s were excluded because there was not exported from gCore IS.",
|
||||
configurations.size() - failed.size() - excluded, configurations.size(), failed.size(),
|
||||
Configuration.NAME, excluded, Configuration.NAME);
|
||||
}
|
||||
|
||||
//@Test
|
||||
|
||||
// @Test
|
||||
public void investigateSingleResource() throws Exception {
|
||||
ScopedTest.setContext(ScopedTest.GCUBE);
|
||||
|
||||
//ScopedTest.setContext(ScopedTest.GCUBE_DEVSEC);
|
||||
|
||||
UUID uuid = UUID.fromString("");
|
||||
|
||||
|
||||
//ResourceRegistryPublisher publisher = ResourceRegistryPublisherFactory.create();
|
||||
//publisher.deleteResource(uuid);
|
||||
|
||||
//ResourceRegistryClient resourceRegistryClient = ResourceRegistryClientFactory.create();
|
||||
|
||||
|
||||
// ResourceRegistryClient resourceRegistryClient = ResourceRegistryClientFactory.create();
|
||||
|
||||
SimpleQuery query = ICFactory.queryFor(GenericResource.class)
|
||||
.addCondition(String.format("$resource/ID/text() eq '%1s'", uuid.toString()));
|
||||
DiscoveryClient<GenericResource> client = ICFactory.clientFor(GenericResource.class);
|
||||
List<GenericResource> seList = client.submit(query);
|
||||
|
||||
GenericResourceExporter see = new GenericResourceExporter();
|
||||
|
||||
GenericResourceExporter see = new GenericResourceExporter(false);
|
||||
see.mapAndPublish(seList.get(0));
|
||||
|
||||
|
||||
}
|
||||
|
||||
//@Test
|
||||
public void addToAllScopes() throws Exception {
|
||||
|
||||
UUID uuid = UUID.fromString("");
|
||||
ResourceRegistryPublisher publisher = ResourceRegistryPublisherFactory.create();
|
||||
|
||||
String[] tokens = {
|
||||
ScopedTest.GCUBE,
|
||||
ScopedTest.GCUBE_DEVSEC,
|
||||
ScopedTest.GCUBE_DEVSEC_DEVVRE,
|
||||
ScopedTest.GCUBE_DEVNEXT,
|
||||
ScopedTest.GCUBE_DEVNEXT_NEXTNEXT
|
||||
};
|
||||
|
||||
for(String token : tokens){
|
||||
ScopedTest.setContext(token);
|
||||
publisher.addResourceToContext(uuid);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -4,11 +4,11 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.gcube.common.authorization.client.exceptions.ObjectNotFound;
|
||||
import org.gcube.common.resources.gcore.ServiceEndpoint;
|
||||
import org.gcube.informationsystem.exporter.ScopedTest;
|
||||
import org.gcube.informationsystem.model.entity.Facet;
|
||||
import org.gcube.informationsystem.model.entity.resource.EService;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClient;
|
||||
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClientFactory;
|
||||
import org.gcube.informationsystem.resourceregistry.publisher.ResourceRegistryPublisher;
|
||||
|
@ -29,15 +29,14 @@ public class ServiceEndpointExporterTest extends ScopedTest{
|
|||
|
||||
@Test
|
||||
public void export(){
|
||||
ServiceEndpointExporter see = new ServiceEndpointExporter();
|
||||
ServiceEndpointExporter see = new ServiceEndpointExporter(false);
|
||||
see.export();
|
||||
}
|
||||
|
||||
public void del() throws ResourceRegistryException{
|
||||
|
||||
public void removeExported() throws ObjectNotFound, Exception{
|
||||
ResourceRegistryClient client = ResourceRegistryClientFactory.create();
|
||||
ResourceRegistryPublisher publisher = ResourceRegistryPublisherFactory.create();
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<EService> eServices = (List<EService>) client.getInstances(EService.NAME, false);
|
||||
List<EService> failed = new ArrayList<>();
|
||||
|
@ -65,11 +64,13 @@ public class ServiceEndpointExporterTest extends ScopedTest{
|
|||
eServices.size()-failed.size()-excluded, eServices.size(), failed.size(), EService.NAME, excluded, EService.NAME);
|
||||
}
|
||||
|
||||
@Test
|
||||
// @Test
|
||||
public void investigateSingleResource() throws Exception {
|
||||
UUID uuid = UUID.fromString("66a674a2-8319-43b4-86c1-bd092bc7c490");
|
||||
ResourceRegistryPublisher publisher = ResourceRegistryPublisherFactory.create();
|
||||
publisher.addResourceToContext(uuid);
|
||||
// ScopedTest.setContext(GCUBE);
|
||||
|
||||
UUID uuid = UUID.fromString("");
|
||||
//ResourceRegistryPublisher publisher = ResourceRegistryPublisherFactory.create();
|
||||
//publisher.deleteResource(uuid);
|
||||
//ResourceRegistryClient resourceRegistryClient = ResourceRegistryClientFactory.create();
|
||||
|
||||
|
||||
|
@ -78,7 +79,7 @@ public class ServiceEndpointExporterTest extends ScopedTest{
|
|||
DiscoveryClient<ServiceEndpoint> client = ICFactory.clientFor(ServiceEndpoint.class);
|
||||
List<ServiceEndpoint> seList = client.submit(query);
|
||||
|
||||
ServiceEndpointExporter see = new ServiceEndpointExporter();
|
||||
ServiceEndpointExporter see = new ServiceEndpointExporter(false);
|
||||
see.notifyFailures(seList.size(), seList);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue