Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ spec:
parameters {
booleanParam(name: 'checkGitCommit', defaultValue: false, description: 'If set to true, the current git revision is compared with the git revision of the last successful build. If they are equal, the build is skipped and env.BUILD_SKIPPED is set to true')
booleanParam(name: 'runTests', defaultValue: true, description: "Whether to run the unit tests. tests will be skipped for MR builds if there are no relevant changes.")
booleanParam(name: 'useOpenApiTestClient', defaultValue: false, description: "Whether to use an autogenerated OpenAPI Jersey 3 based REST client for the tests.")
booleanParam(name: 'runBaseLibTests', defaultValue: false, description: "Whether to run tests from the base-lib module.")
booleanParam(name: 'skiporacle', defaultValue: false, description: "Whether to skip base-lib tests with Oracle")
booleanParam(name: 'skipmssql', defaultValue: false, description: "Whether to skip base-lib tests with MSSQL")
Expand Down Expand Up @@ -174,6 +175,9 @@ spec:
if (!params.runBaseLibTests) {
mvnArguments += "-Dsurefire.baselib.excludedGroups=com.gentics.contentnode.tests.category.BaseLibTest"
}
if (params.useOpenApiTestClient) {
mvnArguments += "-Dtest.client.use.openapi=true"
}
def skipDBs = ""
if (params.skiporacle) {
skipDBs += " -Dskip.oracle12.2=true"
Expand Down
37 changes: 37 additions & 0 deletions base-lib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -623,5 +623,42 @@
<artifactId>jakarta.servlet-api</artifactId>
<scope>provided</scope>
</dependency>

<!-- Swagger / OpenAPI -->
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-models</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
84 changes: 83 additions & 1 deletion cms-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
<configuration>
<maxmemory>200M</maxmemory>
<!-- exclude all but com.gentics.api packages -->
<excludePackageNames>com.gentics.contentnode,com.gentics.lib,com.gentics.portalnode</excludePackageNames>
<excludePackageNames>com.gentics.contentnode,com.gentics.lib,com.gentics.portalnode,org.openapitools.client</excludePackageNames>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
</execution>
Expand Down Expand Up @@ -339,6 +339,51 @@
<overWriteSnapshots>true</overWriteSnapshots>
</configuration>
</plugin>
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>7.19.0</version>
Comment thread
plyhun marked this conversation as resolved.
<executions>
<execution>
<id>generate-client</id>
<goals>
<goal>generate</goal>
</goals>
<phase>process-test-resources</phase>
<configuration>
<inputSpec>${basedir}/../cms-oss-server/src/main/resources/webroot/openapi/openapi.json</inputSpec>
<output>${project.build.directory}/generated-test-sources/openapi</output>
<generatorName>java</generatorName>
<generateApiDocumentation>false</generateApiDocumentation>
<generateApiTests>false</generateApiTests>
<generateSupportingFiles>true</generateSupportingFiles>
<generateModelTests>false</generateModelTests>
<configOptions>
<sourceFolder>/</sourceFolder>
</configOptions>
<library>jersey3</library>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-test-sources</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/generated-test-sources/openapi</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down Expand Up @@ -647,6 +692,43 @@
<groupId>com.nimbusds</groupId>
<artifactId>nimbus-jose-jwt</artifactId>
</dependency>

<!-- Swagger / OpenAPI -->
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-models</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<repositories>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1819,7 +1819,7 @@ public TemplateListResponse getTemplates(

try {
// set the channel
channelIdSet = setChannelToTransaction(templateListParams.nodeId);
channelIdSet = setChannelToTransaction(templateListParams.folderNodeId);
Comment thread
plyhun marked this conversation as resolved.
Outdated
boolean includeWastebin = Arrays.asList(WastebinSearch.include, WastebinSearch.only).contains(wastebinParams.wastebinSearch);

try (WastebinFilter filter = getWastebinFilter(includeWastebin, inFolder.folderId)) {
Expand Down Expand Up @@ -2843,7 +2843,7 @@ public FolderObjectCountResponse getObjectCounts(@PathParam("id") Integer id, @Q
TemplateListResponse templateList = getTemplates(
folderId,
inFolder,
new TemplateListParameterBean().setNodeId(nodeId).setInherited(inherited),
new TemplateListParameterBean().setFolderNodeId(nodeId).setInherited(inherited),
new LegacyFilterParameterBean(),
new LegacySortParameterBean(),
new LegacyPagingParameterBean(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,6 @@
import javax.media.jai.JAI;
import javax.media.jai.PlanarImage;
import javax.media.jai.operator.TransposeDescriptor;
import jakarta.ws.rs.BeanParam;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.DefaultValue;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.WebApplicationException;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.Response.Status;

import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.tuple.Pair;
Expand Down Expand Up @@ -129,6 +117,16 @@
import com.gentics.lib.image.SmarterResizeFilter;
import com.gentics.lib.log.NodeLogger;

import jakarta.ws.rs.BeanParam;
import jakarta.ws.rs.DefaultValue;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.WebApplicationException;
import jakarta.ws.rs.core.Response.Status;

/**
* Resource for loading and manipulating Images in GCN
* @author norbert
Expand Down Expand Up @@ -572,18 +570,6 @@ public ImageLoadResponse rotate(ImageRotateRequest request) {
}
}

/*
* (non-Javadoc)
* @see com.gentics.contentnode.rest.api.ImageResource@loadContent(Integer id)
Comment thread
plyhun marked this conversation as resolved.
*/
@GET
@Path("/content/load/{id}")
@Produces("image/*")
public Response loadContent(@PathParam("id") Integer id) {
throw new WebApplicationException(Status.SERVICE_UNAVAILABLE);
// return Response.ok(null, (MediaType)null).build();
}

/*
* (non-Javadoc)
* @see com.gentics.contentnode.rest.api.ImageResource#create(com.gentics.contentnode.rest.model.request.ImageCreateRequest)
Expand Down Expand Up @@ -739,13 +725,6 @@ public GenericResponse save(@PathParam("id") Integer id, ImageSaveRequest reques
}
}

@POST
@Path("/content/save/{id}")
@Consumes("image/*")
public GenericResponse saveContent(InputStream fileContent) {
throw new WebApplicationException(Status.SERVICE_UNAVAILABLE);
}

/* (non-Javadoc)
* @see com.gentics.contentnode.rest.resource.ImageResource#delete(java.lang.String, java.lang.Integer)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;

import jakarta.ws.rs.client.Entity;

import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.GnuParser;
Expand All @@ -32,6 +30,7 @@
import com.gentics.api.lib.etc.ObjectTransformer;
import com.gentics.contentnode.rest.client.ObjectMapperProvider;
import com.gentics.contentnode.rest.client.RestClient;
import com.gentics.contentnode.rest.client.JerseyRestClientImpl;
import com.gentics.contentnode.rest.client.exceptions.RestException;
import com.gentics.contentnode.rest.model.ContentMaintenanceAction;
import com.gentics.contentnode.rest.model.ContentMaintenanceType;
Expand All @@ -55,6 +54,8 @@
import com.gentics.contentnode.tools.update.Config;
import com.gentics.contentnode.tools.update.Logger;

import jakarta.ws.rs.client.Entity;

/**
* CmdLine Tool for updating implementations in the CMS
*/
Expand Down Expand Up @@ -178,7 +179,7 @@ protected UpdateImplementation(CommandLine line) throws Exception {
System.out.println(String.format("Updating implementation on CMS with base URL %s as user %s", config.getBase(),
config.getUser()));

client = new RestClient(() -> {
client = new JerseyRestClientImpl(() -> {
ClientConfig clientConfig = new ClientConfig().connectorProvider(new HttpUrlConnectorProvider())
.property(ClientProperties.CONNECT_TIMEOUT, config.getTimeout())
.property(ClientProperties.READ_TIMEOUT, config.getTimeout());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;

import jakarta.ws.rs.client.ClientRequestContext;
import jakarta.ws.rs.client.ClientRequestFilter;
import jakarta.ws.rs.client.Entity;
import jakarta.ws.rs.core.MediaType;

import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.HttpUrlConnectorProvider;
import org.glassfish.jersey.client.JerseyClientBuilder;
Expand All @@ -38,6 +33,7 @@
import com.gentics.contentnode.perm.PermHandler;
import com.gentics.contentnode.perm.PermHandler.Permission;
import com.gentics.contentnode.rest.client.RestClient;
import com.gentics.contentnode.rest.client.JerseyRestClientImpl;
import com.gentics.contentnode.rest.client.exceptions.RestException;
import com.gentics.contentnode.rest.model.request.FolderCreateRequest;
import com.gentics.contentnode.rest.model.response.FileUploadResponse;
Expand All @@ -51,6 +47,11 @@
import com.gentics.contentnode.testutils.RESTAppContext;
import com.gentics.contentnode.testutils.RESTAppContext.LoggedInClient;

import jakarta.ws.rs.client.ClientRequestContext;
import jakarta.ws.rs.client.ClientRequestFilter;
import jakarta.ws.rs.client.Entity;
import jakarta.ws.rs.core.MediaType;

/**
* Test cases for the RestClient
*/
Expand Down Expand Up @@ -173,7 +174,7 @@ public void setup() throws NodeException {
*/
@Test
public void testLogin() throws NodeException, RestException {
RestClient client = new RestClient(restContext.getBaseUri());
RestClient client = new JerseyRestClientImpl(restContext.getBaseUri());
client.login(LOGIN, PASSWORD);

// assert successful login
Expand Down Expand Up @@ -219,7 +220,7 @@ public void testLogin() throws NodeException, RestException {
@Test
public void testClientFilter() throws Exception {
final AtomicInteger filterCounter = new AtomicInteger();
RestClient client = new RestClient(() -> {
RestClient client = new JerseyRestClientImpl(() -> {
ClientConfig clientConfig = new ClientConfig().connectorProvider(new HttpUrlConnectorProvider());
return JerseyClientBuilder.createClient(clientConfig).register(JacksonFeature.class).register(new ClientRequestFilter() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.gentics.contentnode.object.SystemUser;
import com.gentics.contentnode.object.UserGroup;
import com.gentics.contentnode.rest.client.RestClient;
import com.gentics.contentnode.rest.client.JerseyRestClientImpl;
import com.gentics.contentnode.testutils.Creator;
import com.gentics.contentnode.testutils.DBTestContext;
import com.gentics.contentnode.testutils.RESTAppContext;
Expand Down Expand Up @@ -77,7 +78,7 @@ public void setup() throws NodeException {

@Test
public void testSSOLogin() throws Exception {
RestClient client = new RestClient(restContext.getBaseUri());
RestClient client = new JerseyRestClientImpl(restContext.getBaseUri());
client.ssologin();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
import java.util.Arrays;
import java.util.List;

import jakarta.ws.rs.ForbiddenException;
import jakarta.ws.rs.NotAuthorizedException;
import jakarta.ws.rs.NotFoundException;
import jakarta.ws.rs.client.Entity;

import org.glassfish.jersey.server.ResourceConfig;
import org.junit.BeforeClass;
import org.junit.ClassRule;
Expand All @@ -23,13 +18,18 @@
import com.gentics.contentnode.factory.Trx;
import com.gentics.contentnode.object.UserGroup;
import com.gentics.contentnode.rest.client.RestClient;
import com.gentics.contentnode.rest.client.JerseyRestClientImpl;
import com.gentics.contentnode.rest.client.exceptions.RestException;
import com.gentics.contentnode.testutils.Creator;
import com.gentics.contentnode.testutils.DBTestContext;
import com.gentics.contentnode.testutils.RESTAppContext;
import com.gentics.contentnode.testutils.RESTAppContext.LoggedInClient;

import fi.iki.santtu.md5.MD5;
import jakarta.ws.rs.ForbiddenException;
import jakarta.ws.rs.NotAuthorizedException;
import jakarta.ws.rs.NotFoundException;
import jakarta.ws.rs.client.Entity;

/**
* Test cases for custom proxy
Expand Down Expand Up @@ -115,7 +115,7 @@ public void testUnconfigured() throws RestException {
*/
@Test(expected = NotAuthorizedException.class)
public void testNoLogin() throws RestException {
RestClient client = new RestClient(restContext.getBaseUri());
RestClient client = new JerseyRestClientImpl(restContext.getBaseUri());
// set invalid sid, so that the RestClient allows to make the request
client.setSid("bla");
client.base().path("proxy").path(RESOURCE_KEY).path("hello").request().get(String.class);
Expand Down
Loading