commit 50d40af0ad6cafccc36ba7c7bf3bc67a3a3c3f2f Author: Alessandro Pieve Date: Wed Apr 26 13:05:57 2017 +0000 first release git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-insert-rstudio-se-plugin@147148 82a268e6-3cf1-43bd-a215-b396298e98cf diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..dcb2dc5 --- /dev/null +++ b/.classpath @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..aa8f5d2 --- /dev/null +++ b/.project @@ -0,0 +1,23 @@ + + + accounting-insert-rstudio-se-plugin + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..29abf99 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/test/java=UTF-8 +encoding//src/test/resources=UTF-8 +encoding/=UTF-8 diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..ec4300d --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +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.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/accounting-insert-rstudio-se-plugin-1.0.0-SNAPSHOT.jar b/accounting-insert-rstudio-se-plugin-1.0.0-SNAPSHOT.jar new file mode 100644 index 0000000..a8d31f5 Binary files /dev/null and b/accounting-insert-rstudio-se-plugin-1.0.0-SNAPSHOT.jar differ diff --git a/distro/LICENSE b/distro/LICENSE new file mode 100644 index 0000000..cdf50bd --- /dev/null +++ b/distro/LICENSE @@ -0,0 +1,4 @@ +gCube System - License +------------------------------------------------------------ + +${gcube.license} \ No newline at end of file diff --git a/distro/README b/distro/README new file mode 100644 index 0000000..a941085 --- /dev/null +++ b/distro/README @@ -0,0 +1,65 @@ +The gCube System - ${name} +-------------------------------------------------- + +${description} + + +${gcube.description} + +${gcube.funding} + + +Version +-------------------------------------------------- + +${version} (${buildDate}) + +Please see the file named "changelog.xml" in this directory for the release notes. + + +Authors +-------------------------------------------------- + +* Alessandro Pieve (alessandro.pieve-AT-isti.cnr.it), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy). + +Maintainers +----------- + +* Alessandro Pieve (alessandro.pieve-AT-isti.cnr.it), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy). + + +Download information +-------------------------------------------------- + +Source code is available from SVN: + ${scm.url} + +Binaries can be downloaded from the gCube website: + ${gcube.website} + + +Installation +-------------------------------------------------- + +Installation documentation is available on-line in the gCube Wiki: + ${gcube.wikiRoot}/SmartExecutor + + +Documentation +-------------------------------------------------- + +Documentation is available on-line in the gCube Wiki: + ${gcube.wikiRoot}/SmartExecutor + + +Support +-------------------------------------------------- + +Bugs and support requests can be reported in the gCube issue tracking tool: + ${gcube.issueTracking} + + +Licensing +-------------------------------------------------- + +This software is licensed under the terms you may find in the file named "LICENSE" in this directory. diff --git a/distro/changelog.xml b/distro/changelog.xml new file mode 100644 index 0000000..c13315d --- /dev/null +++ b/distro/changelog.xml @@ -0,0 +1,5 @@ + + + First Release + + \ No newline at end of file diff --git a/distro/descriptor.xml b/distro/descriptor.xml new file mode 100644 index 0000000..089683d --- /dev/null +++ b/distro/descriptor.xml @@ -0,0 +1,31 @@ + + servicearchive + + tar.gz + + / + + + ${distroDirectory} + / + true + + README + LICENSE + changelog.xml + profile.xml + + 755 + true + + + + + target/${build.finalName}.jar + /${artifactId} + + + \ No newline at end of file diff --git a/distro/profile.xml b/distro/profile.xml new file mode 100644 index 0000000..940b176 --- /dev/null +++ b/distro/profile.xml @@ -0,0 +1,27 @@ + + + + Plugin + + {description} + ${serviceClass} + ${artifactId} + 1.0.0 + + + {description} + ${artifactId} + ${version} + + ${groupId} + ${artifactId} + ${version} + + Plugin + + ${build.finalName}.jar + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..234b1e3 --- /dev/null +++ b/pom.xml @@ -0,0 +1,164 @@ + + 4.0.0 + + org.gcube.tools + maven-parent + 1.0.0 + + org.gcube.accounting + accounting-insert-rstudio-se-plugin + 1.0.0-SNAPSHOT + Accounting Insert RStudio + Accounting Insert RStudio + + + UTF-8 + distro + Accounting + + + + scm:https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/${project.artifactId} + scm:https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/${project.artifactId} + https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/${project.artifactId} + + + + + org.gcube.distribution + maven-smartgears-bom + LATEST + pom + import + + + + + + + org.gcube.vremanagement + smart-executor-api + [1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT) + provided + + + + + + org.gcube.common + common-authorization + + + + + org.gcube.common + authorization-client + + + + + org.gcube.core + common-scope + provided + + + + + org.gcube.common + common-authorization + + + + org.gcube.common + authorization-client + provided + + + + org.slf4j + slf4j-api + provided + + + + + com.couchbase.client + java-client + 2.2.3 + + + com.couchbase.client + core-io + [1.2.3,2.0.0) + compile + + + + + org.gcube.data.publishing + document-store-lib-couchbase + [1.0.1-SNAPSHOT, 2.0.0-SNAPSHOT) + + + org.gcube.data.publishing + document-store-lib + provided + + + + org.gcube.accounting + accounting-lib + provided + + + + + junit + junit + 4.11 + test + + + ch.qos.logback + logback-classic + 1.0.13 + test + + + org.gcube.core + common-encryption + test + + + org.gcube.vremanagement + smart-executor-client + 1.3.0-4.1.0-132087 + test + + + + + + + + + org.apache.maven.plugins + maven-assembly-plugin + + + jar-with-dependencies + + + + + package + + single + + + + + + + \ No newline at end of file diff --git a/src/main/java/org/gcube/accounting/insert/rstudio/persistence/AggregatorPersistenceBackendQuery.java b/src/main/java/org/gcube/accounting/insert/rstudio/persistence/AggregatorPersistenceBackendQuery.java new file mode 100644 index 0000000..79f50cf --- /dev/null +++ b/src/main/java/org/gcube/accounting/insert/rstudio/persistence/AggregatorPersistenceBackendQuery.java @@ -0,0 +1,17 @@ +package org.gcube.accounting.insert.rstudio.persistence; + + + +/** + * @author Alessandro Pieve (ISTI - CNR) + * + */ +public interface AggregatorPersistenceBackendQuery { + + public static final int KEY_VALUES_LIMIT = 25; + + public void prepareConnection( + AggregatorPersistenceBackendQueryConfiguration configuration) + throws Exception; + +} diff --git a/src/main/java/org/gcube/accounting/insert/rstudio/persistence/AggregatorPersistenceBackendQueryConfiguration.java b/src/main/java/org/gcube/accounting/insert/rstudio/persistence/AggregatorPersistenceBackendQueryConfiguration.java new file mode 100644 index 0000000..810ffaa --- /dev/null +++ b/src/main/java/org/gcube/accounting/insert/rstudio/persistence/AggregatorPersistenceBackendQueryConfiguration.java @@ -0,0 +1,30 @@ +package org.gcube.accounting.insert.rstudio.persistence; + + +import org.gcube.accounting.persistence.AccountingPersistenceConfiguration; + +/** + * @author Alessandro Pieve (ISTI - CNR) + * + */ +public class AggregatorPersistenceBackendQueryConfiguration extends AccountingPersistenceConfiguration { + + /** + * Default Constructor + */ + public AggregatorPersistenceBackendQueryConfiguration(){ + super(); + } + + /** + * @param class1 The class of the persistence to instantiate + * @throws Exception if fails + */ + @SuppressWarnings({ "unchecked", "rawtypes" }) + public AggregatorPersistenceBackendQueryConfiguration(Class persistence) throws Exception{ + super((Class) persistence); + } + + + +} \ No newline at end of file diff --git a/src/main/java/org/gcube/accounting/insert/rstudio/plugin/AccountingInsertRstudioPlugin.java b/src/main/java/org/gcube/accounting/insert/rstudio/plugin/AccountingInsertRstudioPlugin.java new file mode 100644 index 0000000..9ac32cf --- /dev/null +++ b/src/main/java/org/gcube/accounting/insert/rstudio/plugin/AccountingInsertRstudioPlugin.java @@ -0,0 +1,210 @@ +package org.gcube.accounting.insert.rstudio.plugin; + + + +import java.io.BufferedReader; +import java.io.FileReader; +import java.net.InetAddress; +import java.util.Map; +import java.util.UUID; + +import org.gcube.accounting.insert.rstudio.persistence.AggregatorPersistenceBackendQueryConfiguration; +import org.gcube.accounting.insert.rstudio.utils.ConfigurationServiceEndpoint; +import org.gcube.accounting.insert.rstudio.utils.Constant; +import org.gcube.common.scope.api.ScopeProvider; +import org.gcube.documentstore.persistence.PersistenceCouchBase; +import org.gcube.vremanagement.executor.plugin.Plugin; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.couchbase.client.java.Bucket; +import com.couchbase.client.java.Cluster; +import com.couchbase.client.java.CouchbaseCluster; +import com.couchbase.client.java.document.JsonDocument; +import com.couchbase.client.java.document.json.JsonObject; +import com.couchbase.client.java.env.CouchbaseEnvironment; +import com.couchbase.client.java.env.DefaultCouchbaseEnvironment; + + + +/** + * @author Alessandro Pieve (ISTI - CNR) + * + */ +public class AccountingInsertRstudioPlugin extends Plugin { + + private static Logger logger = LoggerFactory.getLogger(AccountingInsertRstudioPlugin.class); + + + + public AccountingInsertRstudioPlugin(AccountingInsertRstudioPluginDeclaration pluginDeclaration) { + super(pluginDeclaration); + } + + /* The environment configuration */ + protected static final CouchbaseEnvironment ENV = + DefaultCouchbaseEnvironment.builder() + .connectTimeout(Constant.CONNECTION_TIMEOUT * 1000) + .maxRequestLifetime(Constant.MAX_REQUEST_LIFE_TIME * 1000) + .queryTimeout(Constant.CONNECTION_TIMEOUT * 1000) //15 Seconds in milliseconds + .viewTimeout(Constant.VIEW_TIMEOUT_BUCKET * 1000)//120 Seconds in milliseconds + .keepAliveInterval(3600 * 1000) // 3600 Seconds in milliseconds + .kvTimeout(5000) //in ms + .build(); + + /**{@inheritDoc}*/ + @Override + public void launch(Map inputs) throws Exception { + + String context=ScopeProvider.instance.get(); + logger.debug("AccountingInsertRstudioPlugin launch on context:{}",context); + String url=null; + String password =null; + String bucket=null; + AggregatorPersistenceBackendQueryConfiguration configuration; + try{ + configuration = new AggregatorPersistenceBackendQueryConfiguration(PersistenceCouchBase.class); + url = configuration.getProperty(ConfigurationServiceEndpoint.URL_PROPERTY_KEY); + password = configuration.getProperty(ConfigurationServiceEndpoint.PASSWORD_PROPERTY_KEY); + bucket=configuration.getProperty(ConfigurationServiceEndpoint.BUCKET_STORAGE_NAME_PROPERTY_KEY); + + } + catch (Exception e) { + logger.error("AccountingInsertRstudioPlugin launch",e.getLocalizedMessage()); + throw e; + } + + logger.debug("AccountingInsertRstudioPlugin open cluster:{}",context); + Cluster cluster = CouchbaseCluster.create(ENV, url); + Bucket accountingBucket = cluster.openBucket(bucket,password); + + String dataServiceClass="content-management"; + if (inputs.containsKey("dataServiceClass")) + dataServiceClass=(String) inputs.get("dataServiceClass"); + + String dataServiceName="storage-manager"; + if (inputs.containsKey("dataServiceName")) + dataServiceName=(String) inputs.get("dataServiceName"); + + String dataServiceId=""; + + String uri="RStudio"; + if (inputs.containsKey("uri")) + uri=(String) inputs.get("uri"); + + String dataType="STORAGE"; + if (inputs.containsKey("dataType")) + dataType=(String) inputs.get("dataType"); + + Integer timeWait=1000; + if (inputs.containsKey("timeWait")) + timeWait=(Integer) inputs.get("timeWait"); + + String pathFile=null; + if (inputs.containsKey("pathFile")) + pathFile=(String) inputs.get("pathFile"); + + if (pathFile==null){ + throw new IllegalArgumentException( + "Path File is null!!"); + } + + JsonDocument document=null; + JsonObject content=null; + + BufferedReader reader = new BufferedReader(new FileReader(pathFile)); + String line; + while ((line = reader.readLine()) != null) + { + line=line.trim(); + logger.debug("AccountingInsertRstudioPlugin line :{}",line); + + String[] infoUser=line.split("\\s+"); + String user=infoUser[1]; + Long dataVolume= Long.parseLong(infoUser[0]); + if (inputs.containsKey("unitVolume")){ + + switch ((String) inputs.get("unitVolume")) { + case "Kilobyte": + dataVolume=kilToByte(dataVolume); + break; + case "Megabyte": + dataVolume=megaToByte(dataVolume); + break; + + } + } + + try{ + String docId=UUID.randomUUID().toString(); + logger.debug("AccountingInsertRstudioPlugin User:{} dataVolume:{} KB",user,bytesToKil(dataVolume)); + logger.debug("AccountingInsertRstudioPlugin User:{} dataVolume:{} bytes",user,dataVolume); + dataServiceId=InetAddress.getLocalHost().getHostName(); + Long dataCount=0l; + Long timeStamp= System.currentTimeMillis(); + content = JsonObject.empty().put("scope", context); + content.put("operationCount", 1); + content.put("dataCount", dataCount); + content.put("endTime", timeStamp); + content.put("consumerId", user); + content.put("startTime", timeStamp); + content.put("id", docId); + content.put("dataVolume", dataVolume); + content.put("dataType", dataType); + content.put("operationResult", "SUCCESS"); + content.put("dataServiceClass", dataServiceClass); + content.put("dataServiceName", dataServiceName); + content.put("dataServiceId", dataServiceId); + content.put("aggregated", true); + content.put("providerId", uri); + content.put("creationTime", timeStamp); + content.put("recordType", "StorageStatusRecord"); + document = JsonDocument.create("docId", content); + + JsonDocument doc = JsonDocument.create(docId, content); + JsonDocument response = accountingBucket.upsert(doc); + logger.debug("upsert doc:{}",doc.toString()); + Thread.sleep(timeWait); + } + catch(Exception e){ + logger.error("doc:{} not insert ({}), problem with exist bucket",document.id(),document.toString(),e); + logger.error("force insert into list for insert"); + } + + } + logger.trace("AccountingInsertRstudioPlugin close"); + reader.close(); + cluster.disconnect(); + } + + + + /**{@inheritDoc}*/ + @Override + protected void onStop() throws Exception { + logger.trace("{} onStop() function", this.getClass().getSimpleName()); + Thread.currentThread().interrupt(); + } + + private static long bytesToMeg(long bytes) { + return bytes / Constant.MEGABYTE; + } + + private static long bytesToKil(long bytes) { + return bytes / Constant.KILOBYTE ; + } + + private static long kilToByte(long kilobytes) { + return kilobytes * Constant.KILOBYTE; + } + + private Long megaToByte(Long megaToByte) { + return megaToByte * Constant.MEGABYTE; + } + + + +} + + + diff --git a/src/main/java/org/gcube/accounting/insert/rstudio/plugin/AccountingInsertRstudioPluginDeclaration.java b/src/main/java/org/gcube/accounting/insert/rstudio/plugin/AccountingInsertRstudioPluginDeclaration.java new file mode 100644 index 0000000..6a9941a --- /dev/null +++ b/src/main/java/org/gcube/accounting/insert/rstudio/plugin/AccountingInsertRstudioPluginDeclaration.java @@ -0,0 +1,80 @@ +/** + * + */ +package org.gcube.accounting.insert.rstudio.plugin; + +import java.util.HashMap; +import java.util.Map; + +import org.gcube.vremanagement.executor.plugin.Plugin; +import org.gcube.vremanagement.executor.plugin.PluginDeclaration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author Alessandro Pieve (ISTI - CNR) + * + */ +public class AccountingInsertRstudioPluginDeclaration implements PluginDeclaration { + /** + * Logger + */ + private static Logger logger = LoggerFactory.getLogger(AccountingInsertRstudioPlugin.class); + + /** + * Plugin name used by the Executor to retrieve this class + */ + public static final String NAME = "Accounting-Insert-RStudio"; + + public static final String DESCRIPTION = "This plugin is used to insert RStudio storage record"; + + public static final String VERSION = "1.0.0"; + + /**{@inheritDoc}*/ + @Override + public void init() { + logger.debug(String.format("%s initialized", AccountingInsertRstudioPlugin.class.getSimpleName())); + } + + /**{@inheritDoc}*/ + @Override + public String getName() { + return NAME; + } + + /**{@inheritDoc}*/ + @Override + public String getDescription() { + return DESCRIPTION; + } + + /**{@inheritDoc}*/ + @Override + public String getVersion() { + return VERSION; + } + + /**{@inheritDoc}*/ + @Override + public Map getSupportedCapabilities() { + Map discoveredCapabilities = new HashMap(); + return discoveredCapabilities; + } + + /**{@inheritDoc}*/ + @Override + public Class> getPluginImplementation() { + return AccountingInsertRstudioPlugin.class; + } + + @Override + public String toString() { + return "AccountingInsertRstudioPluginDeclaration [getName()=" + getName() + + ", getDescription()=" + getDescription() + ", getVersion()=" + + getVersion() + ", getSupportedCapabilities()=" + + getSupportedCapabilities() + ", getPluginImplementation()=" + + getPluginImplementation() + "]"; + } + + +} diff --git a/src/main/java/org/gcube/accounting/insert/rstudio/plugin/Utility.java b/src/main/java/org/gcube/accounting/insert/rstudio/plugin/Utility.java new file mode 100644 index 0000000..7c8c99c --- /dev/null +++ b/src/main/java/org/gcube/accounting/insert/rstudio/plugin/Utility.java @@ -0,0 +1,44 @@ +package org.gcube.accounting.insert.rstudio.plugin; + +import com.couchbase.client.java.document.json.JsonArray; +import com.couchbase.client.java.document.json.JsonObject; + +/** + * @author Alessandro Pieve (ISTI - CNR) + * + */ + +public class Utility { + /** + * Generate a key for map-reduce + * @param key + * @return + */ + protected static JsonArray generateKey(String scope,String key){ + JsonArray generateKey = JsonArray.create(); + if (scope!=null){ + generateKey.add(scope); + } + for (String value: key.split(",")){ + if (!value.toString().isEmpty()) + generateKey.add(Integer.parseInt(value)); + } + return generateKey; + + } + /** + * Verify a record aggregated for insert into bucket + * @param item + * @return + */ + public static boolean checkType(Object item) { + return item == null + || item instanceof String + || item instanceof Integer + || item instanceof Long + || item instanceof Double + || item instanceof Boolean + || item instanceof JsonObject + || item instanceof JsonArray; + } +} diff --git a/src/main/java/org/gcube/accounting/insert/rstudio/utils/ConfigurationServiceEndpoint.java b/src/main/java/org/gcube/accounting/insert/rstudio/utils/ConfigurationServiceEndpoint.java new file mode 100644 index 0000000..0ab7e4b --- /dev/null +++ b/src/main/java/org/gcube/accounting/insert/rstudio/utils/ConfigurationServiceEndpoint.java @@ -0,0 +1,17 @@ +package org.gcube.accounting.insert.rstudio.utils; + +/** + * @author Alessandro Pieve (ISTI - CNR) + * + */ + +public class ConfigurationServiceEndpoint { + + //Static Key for Configuration from service end point + public static final String URL_PROPERTY_KEY = "URL"; + public static final String PASSWORD_PROPERTY_KEY = "password"; + public static final String BUCKET_NAME_PROPERTY_KEY = "bucketName"; + public static final String BUCKET_STORAGE_NAME_PROPERTY_KEY="AggregatedStorageStatusRecord"; + public static final String BUCKET_STORAGE_TYPE="StorageStatusRecord"; + +} diff --git a/src/main/java/org/gcube/accounting/insert/rstudio/utils/Constant.java b/src/main/java/org/gcube/accounting/insert/rstudio/utils/Constant.java new file mode 100644 index 0000000..285a4fc --- /dev/null +++ b/src/main/java/org/gcube/accounting/insert/rstudio/utils/Constant.java @@ -0,0 +1,16 @@ +package org.gcube.accounting.insert.rstudio.utils; +public class Constant { + + //CONSTANT for connection Db + public static final Integer CONNECTION_TIMEOUT=15; + public static final Integer NUM_RETRY=6; + public static final Integer CONNECTION_TIMEOUT_BUCKET=15; + public static final Integer VIEW_TIMEOUT_BUCKET=120; + public static final Integer MAX_REQUEST_LIFE_TIME=120; + + + + public static final long GIGABYTE = 1024L * 1024L * 1024L; + public static final long MEGABYTE = 1024L * 1024L; + public static final long KILOBYTE = 1024L; +} \ No newline at end of file diff --git a/src/main/resources/META-INF/services/org.gcube.vremanagement.executor.plugin.PluginDeclaration b/src/main/resources/META-INF/services/org.gcube.vremanagement.executor.plugin.PluginDeclaration new file mode 100644 index 0000000..cb8bd52 --- /dev/null +++ b/src/main/resources/META-INF/services/org.gcube.vremanagement.executor.plugin.PluginDeclaration @@ -0,0 +1 @@ +org.gcube.accounting.insert.rstudio.plugin.AccountingInsertRstudioPluginDeclaration \ No newline at end of file diff --git a/src/test/java/org/gcube/accounting/insert/rstudio/plugin/Tests.java b/src/test/java/org/gcube/accounting/insert/rstudio/plugin/Tests.java new file mode 100644 index 0000000..9b11af0 --- /dev/null +++ b/src/test/java/org/gcube/accounting/insert/rstudio/plugin/Tests.java @@ -0,0 +1,62 @@ +package org.gcube.accounting.insert.rstudio.plugin; + +import java.util.HashMap; +import java.util.Map; + +import org.gcube.accounting.insert.rstudio.plugin.AccountingInsertRstudioPlugin; +import org.gcube.common.authorization.library.provider.SecurityTokenProvider; +import org.gcube.common.scope.api.ScopeProvider; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +public class Tests { + + /** + * Logger + */ + private static Logger logger = LoggerFactory.getLogger(Tests.class); + + @Before + public void beforeTest(){ + + } + + @Test + public void testLaunch() throws Exception { + + //SecurityTokenProvider.instance.set("36501a0d-a205-4bf1-87ad-4c7185faa0d6-98187548"); + SecurityTokenProvider.instance.set("3acdde42-6883-4564-b3ba-69f6486f6fe0-98187548"); + + //FOR DEBUG + String scopeDebug="/gcube"; + ScopeProvider.instance.set(scopeDebug); + // END FOR DEBUG + + Map inputs = new HashMap(); + //type aggregation + + /*optional*/ + //inputs.put("urlService","http://socialnetworking-d-d4s.d4science.org/social-networking-library-ws/rest/"); + inputs.put("dataServiceClass","content-management"); + inputs.put("dataServiceName","storage-manager"); + inputs.put("dataServiceId","identifier"); + inputs.put("uri","Rstudio"); + inputs.put("dataType","STORAGE"); + inputs.put("unitVolume","Kilobyte"); + inputs.put("pathFile","/home/pieve/home_disk_space"); + + + + AccountingInsertRstudioPlugin plugin = new AccountingInsertRstudioPlugin(null); + plugin.launch(inputs); + logger.debug("-------------- launch test finished"); + + } + + @After + public void after(){ + + } +}