Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
32 changes: 32 additions & 0 deletions base-lib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -623,5 +623,37 @@
<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>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</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>
87 changes: 86 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,54 @@
<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>
<useJakartaEe>true</useJakartaEe>
<openApiNullable>false</openApiNullable>
<useOptional>true</useOptional>
</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 @@ -407,6 +455,12 @@
<version>1.4.4</version>
</dependency>

<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations-jakarta</artifactId>
<version>${swagger.version}</version>
</dependency>

<!--dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
Expand Down Expand Up @@ -647,6 +701,37 @@
<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>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
</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 @@ -1066,9 +1066,9 @@ protected List<Page> getPagesFromFolder(com.gentics.contentnode.object.Folder f,

@Override
@GET
@Path("/getFiles/{folderId}")
@Path("/getFiles/{pathFolderId}")
public LegacyFileListResponse getFiles(
@PathParam("folderId") String folderId,
@PathParam("pathFolderId") String folderId,
@BeanParam InFolderParameterBean inFolder,
@BeanParam FileListParameterBean fileListParams,
@BeanParam LegacyFilterParameterBean filterParams,
Expand All @@ -1081,9 +1081,9 @@ public LegacyFileListResponse getFiles(

@Override
@GET
@Path("/getImages/{folderId}")
@Path("/getImages/{pathFolderId}")
public LegacyFileListResponse getImages(
@PathParam("folderId") String folderId,
@PathParam("pathFolderId") String folderId,
@BeanParam InFolderParameterBean inFolder,
@BeanParam FileListParameterBean fileListParams,
@BeanParam LegacyFilterParameterBean filterParams,
Expand Down Expand Up @@ -1804,9 +1804,9 @@ protected void recursiveAttachSubfolders(Folder folder,
* @see com.gentics.contentnode.rest.api.FolderResource#getTemplates(java.lang.String, java.lang.Integer, java.lang.String, boolean, boolean, java.lang.String, java.lang.String, java.lang.String, java.lang.String, int, int, boolean, java.lang.Boolean)
*/
@GET
@Path("/getTemplates/{folderId}")
@Path("/getTemplates/{pathFolderId}")
public TemplateListResponse getTemplates(
@PathParam("folderId") String folderId,
@PathParam("pathFolderId") String folderId,
@BeanParam InFolderParameterBean inFolder,
@BeanParam TemplateListParameterBean templateListParams,
@BeanParam LegacyFilterParameterBean filterParams,
Expand All @@ -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 @@ -1900,9 +1900,9 @@ public TemplateListResponse getTemplates(
*/
@Override
@GET
@Path("/getItems/{folderId}")
@Path("/getItems/{pathFolderId}")
public ItemListResponse getItems(
@PathParam("folderId") String folderId,
@PathParam("pathFolderId") String folderId,
@QueryParam("type") List<ItemType> types,
@QueryParam("nodeId") Integer nodeId,
@QueryParam("template") @DefaultValue("false") boolean template,
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 @@ -736,10 +736,10 @@ public TypePermissionList getPerms(@PathParam("id") String id, @QueryParam("pare

@Override
@GET
@Path("/{id}/perms/{type}")
@Path("/{id}/perms/{permType}")
Comment thread
plyhun marked this conversation as resolved.
@RequiredPerm(type = PermHandler.TYPE_ADMIN, bit = PermHandler.PERM_VIEW)
@RequiredPerm(type = UserGroup.TYPE_GROUPADMIN, bit = PermHandler.PERM_VIEW)
public TypePermissionResponse getTypePerms(@PathParam("id") String id, @PathParam("type") String type) throws NodeException {
public TypePermissionResponse getTypePerms(@PathParam("id") String id, @PathParam("permType") String type) throws NodeException {
try (Trx trx = ContentNodeHelper.trx()) {
UserGroup group = MiscUtils.load(UserGroup.class, id);
TypePerms permType = getPermType(type);
Expand All @@ -763,10 +763,10 @@ public TypePermissionResponse getTypePerms(@PathParam("id") String id, @PathPara

@Override
@POST
@Path("/{id}/perms/{type}")
@Path("/{id}/perms/{permType}")
@RequiredPerm(type = PermHandler.TYPE_ADMIN, bit = PermHandler.PERM_VIEW)
@RequiredPerm(type = UserGroup.TYPE_GROUPADMIN, bit = PermHandler.PERM_VIEW)
public GenericResponse setTypePerms(@PathParam("id") String id, @PathParam("type") String type, @QueryParam("wait") @DefaultValue("0") long waitMs,
public GenericResponse setTypePerms(@PathParam("id") String id, @PathParam("permType") String type, @QueryParam("wait") @DefaultValue("0") long waitMs,
TypePermissionRequest request) throws NodeException {
TypePerms permType = getPermType(type);
expectNoInstances(permType);
Expand All @@ -788,10 +788,10 @@ public GenericResponse setTypePerms(@PathParam("id") String id, @PathParam("type

@Override
@GET
@Path("/{id}/perms/{type}/{instanceId}")
@Path("/{id}/perms/{permType}/{instanceId}")
@RequiredPerm(type = PermHandler.TYPE_ADMIN, bit = PermHandler.PERM_VIEW)
@RequiredPerm(type = UserGroup.TYPE_GROUPADMIN, bit = PermHandler.PERM_VIEW)
public TypePermissionResponse getInstancePerms(@PathParam("id") String id, @PathParam("type") String type, @PathParam("instanceId") Integer instanceId)
public TypePermissionResponse getInstancePerms(@PathParam("id") String id, @PathParam("permType") String type, @PathParam("instanceId") Integer instanceId)
throws NodeException {
try (Trx trx = ContentNodeHelper.trx()) {
UserGroup group = MiscUtils.load(UserGroup.class, id);
Expand Down Expand Up @@ -820,10 +820,10 @@ public TypePermissionResponse getInstancePerms(@PathParam("id") String id, @Path

@Override
@POST
@Path("/{id}/perms/{type}/{instanceId}")
@Path("/{id}/perms/{permType}/{instanceId}")
@RequiredPerm(type = PermHandler.TYPE_ADMIN, bit = PermHandler.PERM_VIEW)
@RequiredPerm(type = UserGroup.TYPE_GROUPADMIN, bit = PermHandler.PERM_VIEW)
public GenericResponse setInstancePerms(@PathParam("id") String id, @PathParam("type") String type, @PathParam("instanceId") Integer instanceId,
public GenericResponse setInstancePerms(@PathParam("id") String id, @PathParam("permType") String type, @PathParam("instanceId") Integer instanceId,
@QueryParam("wait") @DefaultValue("0") long waitMs, TypePermissionRequest request) throws NodeException {
TypePerms permType = getPermType(type);
expectInstances(permType);
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
Loading