ref #9056:TabMan - Improve resource management in TabMan

https://support.d4science.org/issues/9056

Improve resources management

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@152475 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2017-08-03 18:00:23 +00:00
parent d9e5320f64
commit dfca5cb86b
4 changed files with 64 additions and 8 deletions

View File

@ -274,6 +274,13 @@
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.0.1</version>
<scope>test</scope>
</dependency>
<!-- JUnit TEST -->
<dependency>
<groupId>junit</groupId>

View File

@ -109,13 +109,7 @@ public class SessionUtil {
String groupName = null;
if (Constants.DEBUG_MODE) {
logger.info("No credential found in session, use test user!");
InfoLocale infoLocale = getInfoLocale(httpServletRequest, null);
Locale locale = new Locale(infoLocale.getLanguage());
ResourceBundle messages = ResourceBundle.getBundle(TDGWTServiceMessagesConstants.TDGWTServiceMessages,
locale);
logger.info("No credential found in session, use test user!");
userName = Constants.DEFAULT_USER;
scope = Constants.DEFAULT_SCOPE;
token = Constants.DEFAULT_TOKEN;
@ -126,7 +120,14 @@ public class SessionUtil {
ScopeProvider.instance.set(scope);
sCredentials = new ServiceCredentials(userName, scope, token);
InfoLocale infoLocale = getInfoLocale(httpServletRequest, sCredentials);
Locale locale = new Locale(infoLocale.getLanguage());
ResourceBundle.getBundle(TDGWTServiceMessagesConstants.TDGWTServiceMessages,
locale);
} else {
logger.info("Retrieving credential in session!");
PortalContext pContext = PortalContext.getConfiguration();

View File

@ -26,6 +26,9 @@
<inherits
name='org.gcube.portlets.user.td.widgetcommonevent.WidgetCommonEvent' />
<!-- DataMiner Manager CL -->
<inherits name="org.gcube.data.analysis.dataminermanagercl.dataminermanagercl"/>
<!-- Specify the app entry point class. -->
<!-- <entry-point class='org.gcube.portlets.user.td.information.client.InformationEntry'
/> -->

View File

@ -8,6 +8,7 @@ import org.gcube.data.analysis.tabulardata.model.column.Column;
import org.gcube.data.analysis.tabulardata.model.table.Table;
import org.gcube.data.analysis.tabulardata.service.TabularDataService;
import org.gcube.data.analysis.tabulardata.service.tabular.TabularResource;
import org.gcube.data.analysis.tabulardata.service.tabular.metadata.NameMetadata;
import org.gcube.data.analysis.tabulardata.service.tabular.metadata.TabularResourceMetadata;
import org.junit.Assert;
import org.junit.Test;
@ -37,7 +38,7 @@ public class TestServiceListTR {
if (lastTable != null) {
logger.debug("TabularResource: [ id="
+ tr.getId().getValue() + ", type="
+ tr.getId().getValue() + ", type="
+ tr.getTabularResourceType() + ", date="
+ sdf.format(tr.getCreationDate().getTime())
+ ", lastTable=[ id="
@ -60,6 +61,50 @@ public class TestServiceListTR {
}
for (TabularResourceMetadata<?> meta : metas) {
logger.debug("Meta: " + meta);
}
logger.debug("---------------------------------");
}
}
@Test
public void shortListTR() throws Exception {
logger.debug("------------Short List of Tabular Resources--------------");
TDService tdService=new TDService();
TabularDataService service = tdService.getService();
List<TabularResource> trs = service.getTabularResources();
Assert.assertTrue(trs.size() > 0);
Table lastTable = null;
for (TabularResource tr : trs) {
lastTable = service.getLastTable(tr.getId());
Collection<TabularResourceMetadata<?>> metas = tr.getAllMetadata();
if (lastTable != null) {
logger.debug("TabularResource: [ id="
+ tr.getId().getValue() + ", type="
+ tr.getTabularResourceType() + ", date="
+ sdf.format(tr.getCreationDate().getTime())
+ ", lastTable=[ id="
+ lastTable.getId().getValue() + ", type="
+ lastTable.getTableType().getName() + "]]");
} else {
logger.debug("TabularResource: [ id="
+ tr.getId().getValue() + ", lastTable= " + lastTable
+ "]");
}
for (TabularResourceMetadata<?> meta : metas) {
if(meta instanceof NameMetadata){
NameMetadata nameMetadata=(NameMetadata)meta;
String nome=nameMetadata.getValue();
logger.debug("TabularResource Nome: " + nome);
}
}
logger.debug("---------------------------------");
}