Skip to content

Commit

Permalink
Feature #12584
Browse files Browse the repository at this point in the history
Take into account the module silverpeas-core-web is splitted in two:
- silverpeas-core-rs
- and silverpeas-core-web

Take into account in the Jenkinsfile build descriptor the property
core.version in the pom.xml is valued with a string and no more through
a reference to the project version. Indeed, when some Silverpeas
components are a dependency of an external project with its own
versionning, the project.version property is then the one of the
external project and not the one of Silverpeas-Components: it is a
dynamic property.
  • Loading branch information
mmoqui committed Sep 28, 2021
1 parent d546a2f commit aa7191e
Show file tree
Hide file tree
Showing 64 changed files with 368 additions and 45 deletions.
11 changes: 6 additions & 5 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ pipeline {
sh "/opt/wildfly-for-tests/wildfly-*.Final/bin/standalone.sh -c standalone-full.xml &> /dev/null &"
checkParentPOMVersion(version)
boolean coreDependencyExists = existsDependency(version, 'core')
if (!coreDependencyExists) {
def coreVersion = getCoreDependencyVersion()
sh """
sed -i -e "s/<core.version>[\\\${}0-9a-zA-Z.-]\\+/<core.version>${coreVersion}/g" pom.xml
"""
def coreVersion
if (coreDependencyExists) {
coreVersion = version
} else {
coreVersion = getCoreDependencyVersion()
}
sh """
sed -i -e "s/<core.version>[\\\${}0-9a-zA-Z.-]\\+/<core.version>${coreVersion}/g" pom.xml
mvn -U versions:set -DgenerateBackupPoms=false -DnewVersion=${version}
mvn clean install -Pdeployment -Djava.awt.headless=true -Dcontext=ci
/opt/wildfly-for-tests/wildfly-*.Final/bin/jboss-cli.sh --connect :shutdown
Expand Down
6 changes: 6 additions & 0 deletions almanach/almanach-war/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
<name>Almanach Web Application</name>

<dependencies>
<dependency>
<groupId>org.silverpeas.core</groupId>
<artifactId>silverpeas-core-rs</artifactId>
<version>${core.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.silverpeas.core</groupId>
<artifactId>silverpeas-core-web</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
package org.silverpeas.components.almanach.services;

import org.silverpeas.core.annotation.WebService;
import org.silverpeas.core.webapi.base.annotation.Authorized;
import org.silverpeas.core.web.rs.annotation.Authorized;
import org.silverpeas.core.webapi.calendar.CalendarResource;

import javax.ws.rs.Path;
Expand Down
6 changes: 6 additions & 0 deletions blog/blog-war/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
<name>Blog Web Application</name>

<dependencies>
<dependency>
<groupId>org.silverpeas.core</groupId>
<artifactId>silverpeas-core-rs</artifactId>
<version>${core.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.silverpeas.core</groupId>
<artifactId>silverpeas-core-web</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions classifieds/classifieds-war/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
<name>Classifieds Web Application</name>

<dependencies>
<dependency>
<groupId>org.silverpeas.core</groupId>
<artifactId>silverpeas-core-rs</artifactId>
<version>${core.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.silverpeas.core</groupId>
<artifactId>silverpeas-core-web</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions dataWarning/dataWarning-war/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.silverpeas.core</groupId>
<artifactId>silverpeas-core-rs</artifactId>
<version>${core.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.silverpeas.core</groupId>
<artifactId>silverpeas-core-web</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions delegatednews/delegatednews-war/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.silverpeas.core</groupId>
<artifactId>silverpeas-core-rs</artifactId>
<version>${core.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.silverpeas.core</groupId>
<artifactId>silverpeas-core-web</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import org.silverpeas.core.contribution.model.ContributionIdentifier;
import org.silverpeas.core.contribution.publication.model.PublicationDetail;
import org.silverpeas.core.date.Period;
import org.silverpeas.core.webapi.base.WebEntity;
import org.silverpeas.core.web.rs.WebEntity;
import org.silverpeas.core.webapi.profile.UserProfileEntity;

import javax.xml.bind.annotation.XmlAccessType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
import org.silverpeas.components.delegatednews.model.DelegatedNews;
import org.silverpeas.components.delegatednews.service.DelegatedNewsService;
import org.silverpeas.core.annotation.WebService;
import org.silverpeas.core.webapi.base.RESTWebService;
import org.silverpeas.core.webapi.base.annotation.Authorized;
import org.silverpeas.core.web.rs.RESTWebService;
import org.silverpeas.core.web.rs.annotation.Authorized;

import javax.inject.Inject;
import javax.ws.rs.Consumes;
Expand Down
6 changes: 6 additions & 0 deletions formsOnline/formsOnline-war/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
<name>FormsOnline Web Application</name>

<dependencies>
<dependency>
<groupId>org.silverpeas.core</groupId>
<artifactId>silverpeas-core-rs</artifactId>
<version>${core.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.silverpeas.core</groupId>
<artifactId>silverpeas-core-web</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions forums/forums-war/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
<name>Forums Web Application</name>

<dependencies>
<dependency>
<groupId>org.silverpeas.core</groupId>
<artifactId>silverpeas-core-rs</artifactId>
<version>${core.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.silverpeas.core</groupId>
<artifactId>silverpeas-core-web</artifactId>
Expand Down
5 changes: 5 additions & 0 deletions gallery/gallery-library/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
<artifactId>silverpeas-core</artifactId>
<version>${core.version}</version>
</dependency>
<dependency>
<groupId>org.silverpeas.core</groupId>
<artifactId>silverpeas-core-rs</artifactId>
<version>${core.version}</version>
</dependency>
<dependency>
<groupId>org.silverpeas.core.services</groupId>
<artifactId>silverpeas-core-silverstatistics</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
package org.silverpeas.components.gallery;

import org.silverpeas.components.gallery.stub.SessionManagementStub;
import org.silverpeas.core.test.BasicCoreWarBuilder;

/**
Expand All @@ -37,7 +38,9 @@ public class GalleryWarBuilder extends BasicCoreWarBuilder {
*/
protected <T> GalleryWarBuilder(final Class<T> test) {
super(test);
addClasses(SessionManagementStub.class);
addPackages(true, "org.silverpeas.components.gallery");
addMavenDependencies("org.silverpeas.core:silverpeas-core-rs");
addMavenDependencies("org.apache.httpcomponents:httpclient");
addMavenDependencies("org.silverpeas.core.services:silverpeas-core-comment");
addAsResource("org/silverpeas/gallery/multilang/galleryBundle.properties");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
/*
* Copyright (C) 2000 - 2021 Silverpeas
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* As a special exception to the terms and conditions of version 3.0 of
* the GPL, you may redistribute this Program in connection with Free/Lib
* Open Source Software ("FLOSS") applications as described in Silverpeas
* FLOSS exception. You should have received a copy of the text describin
* the FLOSS exception, and it is also available here:
* "https://www.silverpeas.org/legal/floss_exception.html"
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public Licen
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

package org.silverpeas.components.gallery.stub;

import org.silverpeas.core.admin.user.model.User;
import org.silverpeas.core.admin.user.model.UserDetail;
import org.silverpeas.core.annotation.Service;
import org.silverpeas.core.security.session.SessionInfo;
import org.silverpeas.core.security.session.SessionManagement;
import org.silverpeas.core.security.session.SessionValidationContext;

import javax.enterprise.inject.Alternative;
import javax.inject.Singleton;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.Collection;
import java.util.Collections;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

@Service
@Singleton
public class SessionManagementStub implements SessionManagement {

private final ConcurrentMap<String, SessionInfo> userDataSessions = new ConcurrentHashMap<>(100);

@Override
public Collection<SessionInfo> getConnectedUsersList() {
return Collections.emptyList();
}

@Override
public Collection<SessionInfo> getDistinctConnectedUsersList(final User user) {
return Collections.emptyList();
}

@Override
public int getNbConnectedUsersList(final User user) {
return 0;
}

@Override
public SessionInfo getSessionInfo(final String sessionId) {
SessionInfo session = userDataSessions.get(sessionId);
if (session == null) {
if (UserDetail.getCurrentRequester() != null && UserDetail.getCurrentRequester()
.isAnonymous()) {
session = SessionInfo.AnonymousSession;
} else {
session = SessionInfo.NoneSession;
}
}
return session;
}

@Override
public boolean isUserConnected(final UserDetail userDetail) {
return false;
}

@Override
public long getNextSessionTimeOut(final String s) {
return 0;
}

@Override
public SessionInfo validateSession(final String sessionKey) {
return validateSession(SessionValidationContext.withSessionKey(sessionKey));
}

@Override
public SessionInfo validateSession(final SessionValidationContext context) {
String sessionKey = context.getSessionKey();
return getSessionInfo(sessionKey);
}

@Override
public SessionInfo openSession(final UserDetail user) {
SessionInfo session = new SessionInfo(UUID.randomUUID()
.toString(), user);
return openSession(session);
}

private SessionInfo openSession(final SessionInfo session) {
userDataSessions.put(session.getSessionId(), session);
return session;
}

@Override
public SessionInfo openSession(final UserDetail user, final HttpServletRequest request) {
HttpSession httpSession = request.getSession();
SessionInfo session = new SessionInfo(httpSession.getId(), user);
return openSession(session);
}

@Override
public SessionInfo openAnonymousSession(final HttpServletRequest httpServletRequest) {
return SessionInfo.AnonymousSession;
}

@Override
public void closeSession(final String sessionId) {
SessionInfo si = userDataSessions.get(sessionId);
if (si != null) {
userDataSessions.remove(si.getSessionId());
si.onClosed();
}
}
}

6 changes: 6 additions & 0 deletions gallery/gallery-war/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
<name>Gallery Web Application</name>

<dependencies>
<dependency>
<groupId>org.silverpeas.core</groupId>
<artifactId>silverpeas-core-rs</artifactId>
<version>${core.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.silverpeas.core</groupId>
<artifactId>silverpeas-core-web</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
import org.silverpeas.core.node.model.NodePK;
import org.silverpeas.core.util.StringUtil;
import org.silverpeas.core.web.http.FileResponse;
import org.silverpeas.core.webapi.base.RESTWebService;
import org.silverpeas.core.web.rs.RESTWebService;

import javax.ws.rs.PathParam;
import javax.ws.rs.WebApplicationException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.silverpeas.components.gallery.constant.MediaResolution;
import org.silverpeas.components.gallery.constant.MediaType;
import org.silverpeas.components.gallery.model.Media;
import org.silverpeas.core.webapi.base.WebEntity;
import org.silverpeas.core.web.rs.WebEntity;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
package org.silverpeas.components.gallery.web;

import org.silverpeas.components.gallery.model.AlbumDetail;
import org.silverpeas.core.webapi.base.WebEntity;
import org.silverpeas.core.web.rs.WebEntity;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import org.silverpeas.core.annotation.WebService;
import org.silverpeas.core.node.model.NodePK;
import org.silverpeas.core.util.StringUtil;
import org.silverpeas.core.webapi.base.annotation.Authorized;
import org.silverpeas.core.web.rs.annotation.Authorized;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
package org.silverpeas.components.gallery.web;

import org.silverpeas.components.gallery.constant.StreamingProvider;
import org.silverpeas.core.webapi.base.WebEntity;
import org.silverpeas.core.web.rs.WebEntity;
import org.silverpeas.components.gallery.model.Streaming;
import org.silverpeas.core.io.media.Definition;
import org.silverpeas.core.webapi.media.MediaDefinitionEntity;
Expand Down
6 changes: 6 additions & 0 deletions hyperlink/hyperlink-war/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.silverpeas.core</groupId>
<artifactId>silverpeas-core-rs</artifactId>
<version>${core.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.silverpeas.core</groupId>
<artifactId>silverpeas-core-web</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions infoLetter/infoLetter-war/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
<name>InfoLetter Web Application</name>

<dependencies>
<dependency>
<groupId>org.silverpeas.core</groupId>
<artifactId>silverpeas-core-rs</artifactId>
<version>${core.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.silverpeas.core</groupId>
<artifactId>silverpeas-core-web</artifactId>
Expand Down

0 comments on commit aa7191e

Please sign in to comment.