ref 18291: Modify Accounting Dashboard portlet to support Core Services

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

Fixed infra nodes scope
Feature/N18291
Giancarlo Panichi 4 years ago
parent d0e815d7f7
commit d5266a0b7c

@ -110,10 +110,19 @@ public class PortalContextTreeProvider implements ContextTreeProvider {
currUser);
if (infraNode != null) {
String scopeGroup="";
if(gCubeGroup.getGroupName().toUpperCase().endsWith(" GATEWAY")){
int l=gCubeGroup.getGroupName().length();
scopeGroup=gCubeGroup.getGroupName().substring(0, l-8);
} else {
scopeGroup=gCubeGroup.getGroupName();
}
StringBuilder gatewayScope=new StringBuilder();
gatewayScope.append(infrastructureScope);
gatewayScope.append("/");
gatewayScope.append(gCubeGroup.getGroupName());
gatewayScope.append(scopeGroup);
ScopeDescriptor infraNodeScopeDescriptor = createRelativeInfraNode(infraNode, gatewayScope.toString());
if (gatewayChildren != null) {
gatewayChildren.addFirst(infraNodeScopeDescriptor);
@ -163,10 +172,17 @@ public class PortalContextTreeProvider implements ContextTreeProvider {
GCubeUser currUser = pContext.getCurrentUser(request);
String portalScope = pContext.getCurrentScope(currentSiteGroupId + "");
String scopeGroup="";
if(gatewayName.toUpperCase().endsWith(" GATEWAY")){
int l=gatewayName.length();
scopeGroup=gatewayName.substring(0, l-8);
} else {
scopeGroup=gatewayName;
}
StringBuilder gatewayScope=new StringBuilder();
gatewayScope.append(portalScope);
gatewayScope.append("/");
gatewayScope.append(gatewayName);
gatewayScope.append(scopeGroup);
InfraNode infraNode = BuildInfraNode.build(portalScope);

@ -36,9 +36,9 @@ public class BuildInfraNode {
if (accountingDashboardConfigJAXB != null) {
logger.info("AccountingDashboard: use configuration in scope: " + scope);
if (accountingDashboardConfigJAXB.isEnabledInfraNode()) {
logger.info("Infra Nodes configuration enabled in scope: " + scope);
logger.info("AccountingDashboard: Infra Nodes configuration enabled in scope: " + scope);
InfraNodeJAXB infraNodeJAXB = accountingDashboardConfigJAXB.getBaseInfraNode();
logger.info("Infra Nodes configuration: " + infraNodeJAXB);
logger.info("AccountingDashboard: Base Infra Nodes configuration: " + infraNodeJAXB);
if (infraNodeJAXB != null) {
infraNode = new InfraNode(infraNodeJAXB.getScope(), infraNodeJAXB.getName(),
infraNodeJAXB.getDescription());
@ -48,15 +48,18 @@ public class BuildInfraNode {
}
} else {
logger.info("Infra Nodes use default configuration for scope: " + scope);
infraNode = useDefaultConfiguration();
logger.info(
"AccountingDashboard: Base Infra Nodes is not present in configuration"
+ " resource for scope: "
+ scope);
//infraNode = useDefaultConfiguration();
}
} else {
logger.info("Infra Nodes configuration disabled in scope: " + scope);
logger.info("AccountingDashboard: Infra Nodes configuration disabled for scope: " + scope);
}
} else {
logger.info("AccountingDashboard: use infra nodes default configuration for scope: " + scope);
infraNode = useDefaultConfiguration();
logger.info("AccountingDashboard: configuration resource is not present in scope: " + scope);
// infraNode = useDefaultConfiguration();
}
}

@ -17,7 +17,8 @@ public class Constants {
public static final String CMEMS_IMPORTER_LANG = "AccountingDashBoradLang";
public static final String DEFAULT_USER = "giancarlo.panichi";
public static final String DEFAULT_SCOPE = "/gcube/devNext/NextNext";
//public static final String DEFAULT_SCOPE = "/gcube/devNext/NextNext";
public static final String DEFAULT_SCOPE = "/gcube";
public static final String DEFAULT_TOKEN = "";
public static final String DEFAULT_ROLE = "OrganizationMember";

@ -24,8 +24,8 @@ public class AccountingServiceTest extends TestCase {
try {
AuthTest.setToken();
AccountingService accountingService = new AccountingService(AccountingServiceType.CurrentScope);
// accountingService.getTree();
new AccountingService(AccountingServiceType.CurrentScope);
//accountingService.getTree();
assertTrue(true);
} catch (Throwable e) {

Loading…
Cancel
Save