Commit cb9b1545 authored by Yann Mombrun's avatar Yann Mombrun

WEBLAB-1372 - New version 2.2.0-SNAP relying on parent 1.2.8-SNAP.

Add a very simple test case.
Remove dependency to deprecated library rdf-helper-jena-selection.
Update headers and remove a lot of warnings.
Externalise (in the constructor defined in spring configuration) the various sparql requests in use inside the project.

git-svn-id: svn://svn.forge.objectweb.org/svnroot/weblab/trunk/WebLabServices/Portlets/metadata-portlet@4063 a803c184-d8de-4a0e-a52b-d3eef88212b6
parent 793dac74
......@@ -4,17 +4,29 @@
<parent>
<groupId>org.ow2.weblab.portlets</groupId>
<artifactId>parent</artifactId>
<version>1.2.6</version>
<version>1.2.8-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
<groupId>org.ow2.weblab.portlets</groupId>
<artifactId>weblab-metaview</artifactId>
<version>2.1.4</version>
<version>2.2.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>WebLab Metaview</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<weblab.snapshot.repositoryId>weblab.snapshot</weblab.snapshot.repositoryId>
<weblab.release.repositoryId>weblab.release</weblab.release.repositoryId>
<weblab.snapshot.url>scp://weblab-project.org/home/ipccproj/public_html/maven-snapshot</weblab.snapshot.url>
<weblab.release.url>scp://weblab-project.org/home/ipccproj/public_html/maven</weblab.release.url>
<weblab.repositoryId>${weblab.snapshot.repositoryId}</weblab.repositoryId>
<weblab.url>${weblab.snapshot.url}</weblab.url>
</properties>
<dependencies>
<dependency>
<groupId>org.ow2.weblab.core.helpers</groupId>
......@@ -22,44 +34,16 @@
</dependency>
<dependency>
<groupId>org.ow2.weblab.core.helpers</groupId>
<artifactId>rdf-helper-jena-selection</artifactId>
</dependency>
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc-portlet</artifactId>
</dependency>
<dependency>
<groupId>org.ow2.weblab.components</groupId>
<artifactId>weblab-client</artifactId>
</dependency>
<dependency>
<groupId>org.ow2.weblab.portlets</groupId>
<artifactId>weblab-portlet-filters</artifactId>
<artifactId>rdf-helper-jena-structure</artifactId>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<groupId>org.apache.jena</groupId>
<artifactId>jena-arq</artifactId>
</dependency>
<dependency>
<groupId>org.ow2.weblab.components</groupId>
<artifactId>weblab-taglib</artifactId>
</dependency>
<dependency>
<groupId>org.ow2.weblab.core</groupId>
<artifactId>annotator</artifactId>
</dependency>
<dependency>
<groupId>org.ow2.weblab.core.helpers</groupId>
<artifactId>rdf-helper-jena-structure</artifactId>
</dependency>
</dependencies>
<description>This portlet displays WebLab resources metadata.</description>
......@@ -68,25 +52,4 @@
<finalName>${project.artifactId}</finalName>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.ow2.weblab.components</groupId>
<artifactId>weblab-taglib</artifactId>
<version>0.0.5</version>
</dependency>
<dependency>
<groupId>org.ow2.weblab.core</groupId>
<artifactId>annotator</artifactId>
<version>1.2.7</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc-portlet</artifactId>
<version>${spring.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
/**
* WEBLAB: Service oriented integration platform for media mining and intelligence applications
*
* Copyright (C) 2004 - 2014 Airbus Defence and Space
* Copyright (C) 2004 - 2015 Airbus Defence and Space
*
* This library is free software; you can redistribute it and/or modify it under the terms of
* the GNU Lesser General Public License as published by the Free Software Foundation; either
......@@ -32,13 +32,13 @@ public class DisplayMetaConfBean {
public DisplayMetaConfBean() {
properties = new TreeMap<String, Boolean>();
this.properties = new TreeMap<>();
}
public Map<String, Boolean> getProperties() {
return properties;
return this.properties;
}
......
/**
* WEBLAB: Service oriented integration platform for media mining and intelligence applications
*
* Copyright (C) 2004 - 2014 Airbus Defence and Space
* Copyright (C) 2004 - 2015 Airbus Defence and Space
*
* This library is free software; you can redistribute it and/or modify it under the terms of
* the GNU Lesser General Public License as published by the Free Software Foundation; either
......
/**
* WEBLAB: Service oriented integration platform for media mining and intelligence applications
*
* Copyright (C) 2004 - 2014 Airbus Defence and Space
* Copyright (C) 2004 - 2015 Airbus Defence and Space
*
* This library is free software; you can redistribute it and/or modify it under the terms of
* the GNU Lesser General Public License as published by the Free Software Foundation; either
......@@ -29,7 +29,7 @@ public class ServiceDescription {
private String uri,label;
public String getUri() {
return uri;
return this.uri;
}
public void setUri(String uri) {
......@@ -37,7 +37,7 @@ public class ServiceDescription {
}
public String getLabel() {
return label;
return this.label;
}
public void setLabel(String label) {
......
/**
* WEBLAB: Service oriented integration platform for media mining and intelligence applications
*
* Copyright (C) 2004 - 2014 Airbus Defence and Space
* Copyright (C) 2004 - 2015 Airbus Defence and Space
*
* This library is free software; you can redistribute it and/or modify it under the terms of
* the GNU Lesser General Public License as published by the Free Software Foundation; either
......@@ -18,21 +18,29 @@
package org.ow2.weblab.portlet.business.service;
import java.net.URI;
import java.util.Locale;
import java.util.Map;
import org.ow2.weblab.core.model.PieceOfKnowledge;
import org.ow2.weblab.core.model.Resource;
import org.ow2.weblab.core.services.ContentNotAvailableException;
import org.ow2.weblab.core.services.InvalidParameterException;
import org.ow2.weblab.core.services.UnexpectedException;
import org.ow2.weblab.portlet.business.bean.ServiceDescription;
public interface MetaViewBusinessServices {
public Resource getWLResource(String docURI, String remoteUser) throws ContentNotAvailableException;
public String getURIFromPoK(PieceOfKnowledge pok);
public Resource getWLResource(final String docURI) throws ContentNotAvailableException, InvalidParameterException, UnexpectedException;
public Map<String, ServiceDescription> getTranslations(Resource res, Locale prefered);
public PieceOfKnowledge getPoKForSelectedTranslation(String uri, String serviceURI, String lang);
public String getURIFromPoK(final PieceOfKnowledge pok);
public Map<String, ServiceDescription> getTranslations(final Resource res, final Locale prefered);
public PieceOfKnowledge getPoKForSelectedTranslation(final URI uri, final URI serviceURI, final String lang);
}
/**
* WEBLAB: Service oriented integration platform for media mining and intelligence applications
*
* Copyright (C) 2004 - 2014 Airbus Defence and Space
* Copyright (C) 2004 - 2015 Airbus Defence and Space
*
* This library is free software; you can redistribute it and/or modify it under the terms of
* the GNU Lesser General Public License as published by the Free Software Foundation; either
......@@ -19,7 +19,7 @@
package org.ow2.weblab.portlet.mvc.spring.controller;
import java.net.URL;
import java.net.URI;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -34,10 +34,11 @@ import javax.xml.namespace.QName;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.ow2.weblab.core.model.Document;
import org.ow2.weblab.core.model.PieceOfKnowledge;
import org.ow2.weblab.core.model.Resource;
import org.ow2.weblab.core.services.ContentNotAvailableException;
import org.ow2.weblab.core.services.InvalidParameterException;
import org.ow2.weblab.core.services.UnexpectedException;
import org.ow2.weblab.portlet.business.bean.DisplayMetaConfBean;
import org.ow2.weblab.portlet.business.bean.RDFPropertiesConfBean;
import org.ow2.weblab.portlet.business.service.MetaViewBusinessServices;
......@@ -72,7 +73,6 @@ public class MetaViewContoller {
// attributes
protected Log logger = LogFactory.getLog(this.getClass());
protected URL WSDL_REPO_URL;
@Autowired
@Qualifier("metaviewBusinessService")
......@@ -84,7 +84,7 @@ public class MetaViewContoller {
@ModelAttribute("metaDisplay")
public Map<String, Boolean> getDisplayMeta() {
return metaDisplayConf.getProperties();
return this.metaDisplayConf.getProperties();
}
@Autowired
......@@ -93,7 +93,7 @@ public class MetaViewContoller {
@ModelAttribute("rdfProperties")
public Map<String, String> getRDFProperties() {
return rdfProperties.getProperties();
return this.rdfProperties.getProperties();
}
//#############################################################################
......@@ -101,7 +101,7 @@ public class MetaViewContoller {
//#############################################################################
@ActionMapping(params="action=goToEntity")
public void goToEntity(ActionResponse response, ModelMap model) {
logger.debug("receiving action gotToEntity");
this.logger.debug("receiving action goToEntity");
response.setEvent(QName.valueOf("{http://weblab.ow2.org/portlet/metaview/action}sendUnloadedDocument"), (PieceOfKnowledge)model.get("resource"));
}
......@@ -109,18 +109,18 @@ public class MetaViewContoller {
@ActionMapping(params="action=selectTranslation")
public void selectTranslation(ActionRequest request, ActionResponse response, ModelMap model) {
String lang = request.getParameter("language");
String service = request.getParameter("service");
URI service = URI.create(request.getParameter("service"));
logger.debug("select translation for language :"+lang+" and service"+ service);
this.logger.debug("select translation for language :"+lang+" and service"+ service);
response.setEvent(QName.valueOf("{http://weblab.ow2.org/portlet/metaview/action}selectTranslatedVersion"),
metaviewBusinessService.getPoKForSelectedTranslation(((Resource)model.get("resource")).getUri(), service, lang));
this.metaviewBusinessService.getPoKForSelectedTranslation(URI.create(((Resource)model.get("resource")).getUri()),service, lang));
}
@ActionMapping(params="action=selectOriginalVersion")
public void selectOriginal(ActionRequest request, ActionResponse response, ModelMap model) {
logger.debug("select original version");
this.logger.debug("select original version");
response.setEvent(QName.valueOf("{http://weblab.ow2.org/portlet/metaview/action}selectOriginalVersion"), ((Resource)model.get("resource")).getUri());
}
......@@ -133,24 +133,24 @@ public class MetaViewContoller {
@EventMapping(value="{http://weblab.ow2.org/portlet/metaview/reaction}displayMeta")
public void processLoadedDocumentEvent(EventRequest request, EventResponse response, ModelMap model) {
// receive a event containing a document
logger.debug("receiving the event : {http://weblab.ow2.org/portlet/metaview/reaction}displayMeta");
this.logger.debug("receiving the event : {http://weblab.ow2.org/portlet/metaview/reaction}displayMeta");
model.addAttribute("resource", (Document) request.getEvent().getValue());
model.addAttribute("resource", request.getEvent().getValue());
model.addAttribute("resourceDesc", new HashMap<String, List<String>>());
model.addAttribute("isLoadedResource", false);
model.addAttribute("isEmptyModel", false);
model.addAttribute("isLoadedResource", Boolean.FALSE);
model.addAttribute("isEmptyModel", Boolean.FALSE);
}
@EventMapping(value="{http://weblab.ow2.org/portlet/metaview/reaction}loadDocumentAndDisplayMeta")
public void processNotLoadedDocumentEvent(EventRequest request, EventResponse response, ModelMap model) {
// receive a event containing an unloaded document
logger.debug("receiving the event : {http://weblab.ow2.org/portlet/metaview/reaction}loadDocumentAndDisplayMeta");
this.logger.debug("receiving the event : {http://weblab.ow2.org/portlet/metaview/reaction}loadDocumentAndDisplayMeta");
model.addAttribute("resource", (PieceOfKnowledge) request.getEvent().getValue());
model.addAttribute("resource", request.getEvent().getValue());
model.addAttribute("resourceDesc", new HashMap<String, List<String>>());
model.addAttribute("isLoadedResource", false);
model.addAttribute("isEmptyModel", false);
model.addAttribute("isLoadedResource", Boolean.FALSE);
model.addAttribute("isEmptyModel", Boolean.FALSE);
//response.setEvent(QName.valueOf("{http://weblab.ow2.org/portlet/metaview/action}sendUnloadedDocument"), (PieceOfKnowledge)model.get("resource"));
}
......@@ -160,7 +160,7 @@ public class MetaViewContoller {
// resource mapping methods #
//#############################################################################
@ResourceMapping("showMetadata")
public ModelAndView serveMetadata(ResourceRequest request, ResourceResponse response, ModelMap model) throws ContentNotAvailableException {
public ModelAndView serveMetadata(ResourceRequest request, ResourceResponse response, ModelMap model) throws ContentNotAvailableException, InvalidParameterException, UnexpectedException {
response.setContentType("text/html");
response.setCharacterEncoding("UTF-8");
......@@ -168,12 +168,12 @@ public class MetaViewContoller {
mav.setView("view_meta_ajax");
mav.addAllObjects(model);
Resource resource= (Resource) model.get("resource");
logger.debug("serving the metadata content table from resource :"+resource.getUri());
this.logger.debug("serving the metadata content table from resource: "+resource.getUri());
// loading map if needed
boolean isLoadedDocument = false;
if (model != null && model.containsAttribute("isLoadedResource")) {
isLoadedDocument = (Boolean)model.get("isLoadedResource");
if (model.containsAttribute("isLoadedResource")) {
isLoadedDocument = ((Boolean)model.get("isLoadedResource")).booleanValue();
}
// adding map to model
......@@ -181,13 +181,11 @@ public class MetaViewContoller {
// loading resource from pok by calling service
mav.getModelMap().addAttribute("resource",
metaviewBusinessService.getWLResource(
metaviewBusinessService.getURIFromPoK((PieceOfKnowledge) resource),
request.getRemoteUser()));
this.metaviewBusinessService.getWLResource(this.metaviewBusinessService.getURIFromPoK((PieceOfKnowledge) resource)));
mav.getModelMap().addAttribute("isLoadedResource", true);
mav.getModelMap().addAttribute("isLoadedResource", Boolean.TRUE);
mav.getModelMap().addAttribute("translations", metaviewBusinessService.getTranslations(
mav.getModelMap().addAttribute("translations", this.metaviewBusinessService.getTranslations(
(Resource) mav.getModelMap().get("resource"), request.getLocale()));
}
return mav;
......@@ -202,7 +200,7 @@ public class MetaViewContoller {
ModelAndView mav = new ModelAndView("view");
mav.addAllObjects(model);
if (!model.containsAttribute("isEmptyModel")) {
mav.addObject("isEmptyModel", true);
mav.addObject("isEmptyModel", Boolean.TRUE);
}
return mav;
}
......@@ -210,8 +208,8 @@ public class MetaViewContoller {
//#############################################################################
// exceptions handlers #
//#############################################################################
@ExceptionHandler(ContentNotAvailableException.class)
public ModelAndView getMetadataException(ContentNotAvailableException ex) {
@ExceptionHandler(Exception.class)
public ModelAndView getMetadataException(Exception ex) {
ModelAndView mav = new ModelAndView("error");
mav.addObject("message_error", ex.getMessage());
return mav;
......
......@@ -24,3 +24,4 @@ log4j.rootLogger = DEBUG, console, rollingfile
# You can decrease the level of a specific package by adding it here
log4j.logger.org.springframework = INFO
log4j.logger.com.hp.hpl.jena.sparql.engine.optimizer = INFO
\ No newline at end of file
......@@ -14,11 +14,6 @@ when possible (as meta-data).
<entry key="{http://weblab.ow2.org/portlet/metaview/reaction}loadDocumentAndDisplayMeta">
<list>
<value>{http://weblab.ow2.org/events/result}selectNotLoadedDocument</value>
<value>{http://weblab.ow2.org/events/result}selectNotLoadedImage</value>
<value>{http://weblab.ow2.org/events/geo}selectNotLoadedDocument</value>
<value>{http://weblab.ow2.org/events/time}selectNotLoadedDocument</value>
<value>{http://weblab.ow2.org/events/basket}selectNotLoadedDocument</value>
<value>{http://weblab.ow2.org/events/basket}selectNotLoadedImage</value>
</list>
</entry>
</map>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<!--
Spring xml for meta-data business service configuration.
-->
<beans>
<bean id="WSBusinessServiceConfig" class="org.ow2.weblab.portlet.business.bean.ServiceConfBean">
<!-- weblab client service URI -->
<property name="serviceURI" value="http://weblab.ow2.org/core/1.2/services/resourceContainer#Load_Resource"/>
<bean id="metaviewBusinessService" class="org.ow2.weblab.portlet.business.service.impl.WSBusinessServicesImpl">
<constructor-arg value="http://weblab.ow2.org/core/1.2/services/resourceContainer#Load_Resource" type="java.lang.String" name="resourceContainerUri" />
<constructor-arg value="SELECT DISTINCT ?resource WHERE { ?subject &lt;http://weblab.ow2.org/core/1.2/ontology/retrieval#isLinkedTo&gt; ?resource }" type="java.lang.String" name="linkedToQuery" />
<constructor-arg value="SELECT DISTINCT ?lang ?service ?label WHERE { ?resource &lt;http://weblab.ow2.org/core/1.2/ontology/model#isComposedByMediaUnit&gt; ?mu . ?mu &lt;http://weblab.ow2.org/core/1.2/ontology/processing#isProducedBy&gt; ?service . ?service &lt;http://www.w3.org/2000/01/rdf-schema#label&gt; ?label . ?mu &lt;http://weblab.ow2.org/core/1.2/ontology/processing#isTranslationOf&gt; ?translation . ?mu &lt;http://purl.org/dc/elements/1.1/language&gt; ?lang FILTER (langMatches(lang(?label), ?preferred) || langMatches(lang(?label), &quot;&quot;))}" type="java.lang.String" name="translationsQueryTemplate" />
</bean>
</beans>
\ No newline at end of file
......@@ -5,4 +5,5 @@
<category name="WebLab">
<portlet id="weblab-metaview" />
</category>
</display>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<!-- Spring xml for meta-data display in the result portlet. Here is
defined interesting RDF annotations namespace for the result portlet.
The portlet search in resources for this annotation and display them
when possible (as meta-data).
-->
<beans>
<bean id="rdfProperties" class="org.ow2.weblab.portlet.business.bean.RDFPropertiesConfBean">
<property name="properties">
<map>
......@@ -49,6 +43,7 @@ when possible (as meta-data).
</map>
</property>
</bean>
<bean id="displayMeta" class="org.ow2.weblab.portlet.business.bean.DisplayMetaConfBean">
<property name="properties">
<map>
......@@ -90,4 +85,5 @@ when possible (as meta-data).
</map>
</property>
</bean>
</beans>
\ No newline at end of file
<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="1.0">
<portlet>
<description xml:lang="FR">Visualisation des méta données</description>
<portlet-name>weblab-metaview</portlet-name>
<display-name xml:lang="FR">Visualisation des méta données</display-name>
<!-- <portlet-class>org.ow2.weblab.portlet.MetaDataPortlet</portlet-class>-->
<portlet-class>org.springframework.web.portlet.DispatcherPortlet</portlet-class>
<expiration-cache>0</expiration-cache>
......
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
<display-name>weblab-metaview</display-name>
<description>WebLab portlet web application to show metadata about weblab resource</description>
......@@ -20,4 +20,5 @@
<servlet-name>ViewRendererServlet</servlet-name>
<url-pattern>/WEB-INF/servlet/view</url-pattern>
</servlet-mapping>
</web-app>
......@@ -2,17 +2,13 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-3.0.xsd">
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">
<mvc:annotation-driven />
<context:component-scan base-package="org.ow2.weblab.portlet.mvc.spring.controller" />
<context:component-scan base-package="org.ow2.weblab.portlet.business.service" />
......@@ -21,15 +17,9 @@
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass">
<value>org.springframework.web.servlet.view.JstlView</value>
</property>
<property name="prefix">
<value>/jsp/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
<import resource="meta_configuration.xml"/>
......
......@@ -9,7 +9,7 @@
<fmt:setLocale value="${pageContext.request.locale}" />
<fmt:setBundle basename="meta_portlet" />
<portlet:resourceURL var="resourceURL" escapeXml="false" id="showMetadata"/>
<portlet:resourceURL var="resourceURL" escapeXml="false" id="showMetadata" />
<c:choose>
......
/**
* WEBLAB: Service oriented integration platform for media mining and intelligence applications
*
* Copyright (C) 2004 - 2014 Airbus Defence and Space
* Copyright (C) 2004 - 2015 Airbus Defence and Space
*
* This library is free software; you can redistribute it and/or modify it under the terms of
* the GNU Lesser General Public License as published by the Free Software Foundation; either
......@@ -15,17 +15,57 @@
* library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
package org.ow2.weblab.portlet.business.bean;
package org.ow2.weblab.portlet.test;
import java.net.URI;
import java.util.Locale;
import java.util.UUID;
public class ServiceConfBean {
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.ow2.weblab.core.extended.factory.WebLabResourceFactory;
import org.ow2.weblab.core.model.Document;
import org.ow2.weblab.core.model.PieceOfKnowledge;
import org.ow2.weblab.core.model.retrieval.WRetrievalAnnotator;
import org.ow2.weblab.portlet.business.service.impl.WSBusinessServicesImpl;
import org.springframework.context.support.FileSystemXmlApplicationContext;
private String serviceURI;
public String getServiceURI() {
return serviceURI;
/**
* @date 2015-10-15
* @author ymombrun
*/
public class ServiceTest {
private static WSBusinessServicesImpl SERVICE;
@BeforeClass
public static void init() {
try (final FileSystemXmlApplicationContext fsxac = new FileSystemXmlApplicationContext("src/main/webapp/WEB-INF/business_service_configuration.xml")) {
SERVICE = fsxac.getBean("metaviewBusinessService", WSBusinessServicesImpl.class);
}
public void setServiceURI(String serviceURI) {
this.serviceURI = serviceURI;
}
@Test
public void testLinkedToQuery() throws Exception {
Assert.assertNotNull(SERVICE);
final PieceOfKnowledge pok = WebLabResourceFactory.createResource("ServiceTest", UUID.randomUUID().toString(), PieceOfKnowledge.class);
final WRetrievalAnnotator wra = new WRetrievalAnnotator(URI.create(pok.getUri()), pok);
final String uriInput = "weblab://yataaaa";
wra.writeLinkedTo(URI.create(uriInput));
final String uriResult = SERVICE.getURIFromPoK(pok);
Assert.assertEquals(uriInput, uriResult);
}
@Test
public void testSearchTranslations() throws Exception {
SERVICE.getTranslations(new Document(), Locale.FRANCE);
}
}
# Console appender limited to INFO
log4j.appender.console = org.apache.log4j.ConsoleAppender
log4j.appender.console.threshold = FATAL
log4j.appender.console.encoding = UTF-8
log4j.appender.console.layout = org.apache.log4j.PatternLayout
log4j.appender.console.layout.conversionPattern = %d{ISO8601} %-5p %c - %m%n
log4j.rootLogger = DEBUG, console
# You can decrease the level of a specific package by adding it here
#log4j.logger.org.springframework = INFO
#log4j.logger.com.hp.hpl.jena.sparql.engine.optimizer = INFO
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"><beans> <bean id="servicesConfig" class="org.ow2.weblab.components.client.config.ServiceConfigMap"> <constructor-arg> <map> <entry key="http://weblab.ow2.org/core/1.2/services/resourceContainer#Load_Resource" value="http://localhost:8181/simple-file-repository/resourceContainer" /> </map> </constructor-arg> </bean></beans>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment