test on ASL Logger

pom was updated.. removed scope runtime for log4j

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/speciesdiscovery@84967 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2013-11-05 14:16:29 +00:00
parent 6c1415f514
commit 81ae848f99
3 changed files with 141 additions and 2 deletions

View File

@ -274,7 +274,6 @@
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
@ -330,7 +329,7 @@
<!-- Plugin configuration. There are many available options, see gwt-maven-plugin
documentation at codehaus.org -->
<configuration>
<runTarget>WorkspacePortlet.html</runTarget>
<runTarget>SpeciesDiscovery.html</runTarget>
<hostedWebapp>${webappDirectory}</hostedWebapp>
</configuration>
</plugin>

View File

@ -0,0 +1,94 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client;
import org.gcube.application.framework.accesslogger.library.impl.AccessLogger;
import org.gcube.application.framework.accesslogger.model.LoginToVreAccessLogEntry;
import org.gcube.application.framework.accesslogger.model.SimpleSearchAccessLogEntry;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* @Nov 4, 2013
*
*/
public class ASLLogger {
static AccessLogger log = AccessLogger.getAccessLogger();
static LoginToVreAccessLogEntry loginEntry = new LoginToVreAccessLogEntry();
static String user = "test.user";
static String scope = "/gcube/devsec/devVRE";
static final String SPECIES = "SPECIES";
static final String DATASOURCE_SEARCHING = "DATASOURCE SEARCHING";
static final String DATASOURCE_DOWLOADED = "DATASOURCE DOWLOADED";
static final String TAXA_QUERY = "TAXA QUERY";
static final String OCCURRENCE_QUERY = "OCCURRENCE QUERY";
public static void main(String[] args) {
/*
* The first argument is the username of the user that performs the action
* The second argument is the name of the working VO/VRE
*/
log.logEntry(user, scope, loginEntry);
// String collections[][] = new String[2][2];
// collections[0][0] = "Earth images";
// collections[0][1] = "12345";
// collections[1][0] = "Landsat 7";
// collections[1][1] = "54321";
//
//
// SimpleSearchAccessLogEntry simpleEntry = new SimpleSearchAccessLogEntry(collections, "satellite, sea");
// /*
// * The first argument is the username of the user that performs the action
// * The second argument is the name of the working VO/VRE
// */
// log.logEntry(user, scope, simpleEntry);
//
//DATA SOURCE
String dataSources[][] = new String[1][2];
dataSources[0][0] = "GBIF";
dataSources[0][1] = SPDAccessLoggerType.DATASOURCE_SEARCHING.getId();
SimpleSearchAccessLogEntry simpleEntry = new SimpleSearchAccessLogEntry(dataSources, "GBIF");
log.logEntry(user, scope, simpleEntry);
//species
String species[][] = new String[1][2];
species[0][0] = "Sarda sarda";
species[0][1] = SPDAccessLoggerType.SPECIES.getId();
simpleEntry = new SimpleSearchAccessLogEntry(species, "Sarda sarda");
log.logEntry(user, scope, simpleEntry);
//species
String query[][] = new String[1][2];
query[0][0] = "Taxa Query bla bla";
query[0][1] = SPDAccessLoggerType.TAXA_QUERY.getId();
simpleEntry = new SimpleSearchAccessLogEntry(query, "Taxa Query bla bla");
log.logEntry(user, scope, simpleEntry);
System.out.println("completed");
}
}

View File

@ -0,0 +1,46 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* @Nov 4, 2013
*
*/
public enum SPDAccessLoggerType {
SPECIES("SPECIES", "SPECIES"),
DATASOURCE_SEARCHING("DATASOURCE_SEARCHING", "DATASOURCE SEARCHING"),
DATASOURCE_DOWLOADED("DATASOURCE_DOWLOADED", "DATASOURCE DOWLOADED"),
TAXA_QUERY("TAXA_QUERY", "TAXA QUERY"),
OCCURRENCE_QUERY("OCCURRENCE_QUERY", "OCCURRENCE QUERY"),
MAP_GENERATION("MAP_GENERATION", "MAP GENERATION");
private String name;
private String id;
/**
*
*/
private SPDAccessLoggerType(String id, String name) {
this.id = id;
this.name = name;
}
protected String getName() {
return name;
}
protected void setName(String name) {
this.name = name;
}
protected String getId() {
return id;
}
protected void setId(String id) {
this.id = id;
}
}