Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jfrantzius/issue19 tomcat extension signoff #22

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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 .github/dco.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# This enables DCO bot for you, please take a look https://github.com/probot/dco
# for more details.
require:
members: false
16 changes: 6 additions & 10 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
name: build
run-name: ${{ github.actor }} triggered module build
on:
push:
branches:
- 'main'
pull_request:
branches:
- 'main'
workflow_dispatch: # allow to run from Github web UI
push: # see https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#using-a-single-event
jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -27,9 +23,9 @@ jobs:
run: |
mkdir -p ~/.m2
echo "<settings><servers><server><id>magnolia.enterprise</id><username>${{secrets.MGNL_USERNAME}}</username><password>${{secrets.MGNL_PASSWORD}}</password></server><server><id>magnolia.forge.snapshots</id><username>${{secrets.MGNL_USERNAME}}</username><password>${{secrets.MGNL_PASSWORD}}</password></server></servers></settings>" > ~/.m2/settings.xml
- name: Build PR with Maven
if: ${{ github.base_ref == 'main' }}
run: mvn -B clean verify
- name: Build PR or branch with Maven
if: ${{ github.base_ref != 'main' }}
run: mvn -B clean verify -DtomcatTest
- name: Build and Deploy main branch with Maven
if: ${{ github.base_ref == null }}
if: ${{ github.base_ref == 'main' }}
run: mvn -B clean deploy
4 changes: 2 additions & 2 deletions .github/workflows/sonar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17 # current Sonar Maven plugin requires class file version 61.0 = JDK 17, see https://javaalmanac.io/bytecode/versions/
distribution: 'zulu' # Alternative distribution options are available.
- name: Cache SonarCloud packages
uses: actions/cache@v3
Expand All @@ -29,4 +29,4 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=IBM_magkit-test
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=IBM_magkit-test -DtomcatTest
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,14 @@
# build files
target
.DS_Store
magkit-test-cms/.checkstyle
magkit-test-jcr/.checkstyle
magkit-test-server/.checkstyle
magkit-test-servlet/.checkstyle
magkit-test-webapp/.checkstyle
magkit-test-webapp/.classpath
.vscode/settings.json
magkit-test-cms/.classpath
magkit-test-jcr/.classpath
magkit-test-server/.classpath
magkit-test-servlet/.classpath
9 changes: 7 additions & 2 deletions magkit-test-cms/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,19 @@
<parent>
<groupId>de.ibmix.magkit</groupId>
<artifactId>magkit-test</artifactId>
<version>1.0.6-SNAPSHOT</version>
<version>1.0.7-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>magkit-test-cms</artifactId>
<name>magkit-test-cms Magnolia Module</name>
<packaging>jar</packaging>

<properties>
<!-- see https://community.sonarsource.com/t/coverage-test-data-importing-jacoco-coverage-report-in-xml-format/12151#multi-module-builds-3 -->
<sonar.coverage.jacoco.xmlReportPaths>${project.basedir}/../magkit-test-webapp/target/site/jacoco-aggregate/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
Expand Down Expand Up @@ -105,7 +110,7 @@
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<artifactId>hamcrest</artifactId>
<scope>compile</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public static Node mockNodeFromXml(InputStream xmlUtf8) {
}
}

private static class JcrXmlHandler extends DefaultHandler {
private static final class JcrXmlHandler extends DefaultHandler {
private MockNode _result;
private Stack<MockNode> _currentPath = new Stack<MockNode>();
private String _currentPropertyName = null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
package de.ibmix.magkit.test.cms.context;

import static de.ibmix.magkit.test.cms.context.ContextMockUtils.mockWebContext;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import java.util.Locale;

import javax.jcr.Node;
import javax.jcr.RepositoryException;

/*-
* #%L
* magkit-test-cms Magnolia Module
Expand All @@ -21,22 +33,11 @@
*/

import de.ibmix.magkit.test.ExceptionStubbingOperation;
import de.ibmix.magkit.test.jcr.NodeStubbingOperation;
import de.ibmix.magkit.test.cms.node.MagnoliaNodeMockUtils;
import de.ibmix.magkit.test.jcr.NodeStubbingOperation;
import info.magnolia.cms.core.AggregationState;
import info.magnolia.cms.core.Channel;

import javax.jcr.Node;
import javax.jcr.RepositoryException;
import java.util.Locale;

import static de.ibmix.magkit.test.cms.context.ContextMockUtils.mockWebContext;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

/**
* Utility class that provides factory methods for AggregationStateStubbingOperations.
* Stubbing operations to be used as parameters in ContextMockUtils.mockAggregationState(...).
Expand Down
7 changes: 6 additions & 1 deletion magkit-test-jcr/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>de.ibmix.magkit</groupId>
<artifactId>magkit-test</artifactId>
<version>1.0.6-SNAPSHOT</version>
<version>1.0.7-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand All @@ -13,6 +13,11 @@
<description>Utility classes to easily mock javax.jcr classes (version 2.0).</description>
<packaging>jar</packaging>

<properties>
<!-- see https://community.sonarsource.com/t/coverage-test-data-importing-jacoco-coverage-report-in-xml-format/12151#multi-module-builds-3 -->
<sonar.coverage.jacoco.xmlReportPaths>${project.basedir}/../magkit-test-webapp/target/site/jacoco-aggregate/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ public static Node mockPlainNode(final String name) throws RepositoryException {
when(result.setProperty(anyString(), any(Value.class), anyInt())).thenAnswer(SET_VALUE_PROPERTY_ANSWER);
when(result.setProperty(anyString(), any(Value[].class))).thenAnswer(SET_VALUES_PROPERTY_ANSWER);
when(result.setProperty(anyString(), any(Value[].class), anyInt())).thenAnswer(SET_VALUES_PROPERTY_ANSWER);
doAnswer(Answers.CALLS_REAL_METHODS.get()).when(result).remove();
doAnswer(Answers.CALLS_REAL_METHODS).when(result).remove();
// check if this is the correct default value
stubType(NodeType.NT_BASE).of(result);
when(result.isNodeType(anyString())).then(IS_NODE_TYPE_ANSWER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public static Property mockProperty(final String name) throws RepositoryExceptio
when(property.getSession()).then(NodeMockUtils.SESSION_ANSWER);
when(property.getValues()).thenReturn(new Value[0]);
when(property.isMultiple()).then(IS_MULTIPLE_ANSWER);
doAnswer(Answers.CALLS_REAL_METHODS.get()).when(property).remove();
doAnswer(Answers.CALLS_REAL_METHODS).when(property).remove();
PropertyStubbingOperation.stubAccept().of(property);
return property;
}
Expand Down
73 changes: 73 additions & 0 deletions magkit-test-server/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>de.ibmix.magkit</groupId>
<artifactId>magkit-test</artifactId>
<version>1.0.7-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>magkit-test-server</artifactId>
<name>magkit-test-server Maven Module</name>
<packaging>jar</packaging>

<properties>
<test.tomcat.version>9.0.74</test.tomcat.version>
<!-- see https://community.sonarsource.com/t/coverage-test-data-importing-jacoco-coverage-report-in-xml-format/12151#multi-module-builds-3 -->
<sonar.coverage.jacoco.xmlReportPaths>${project.basedir}/../magkit-test-webapp/target/site/jacoco-aggregate/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
</properties>
<dependencies>


<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>${restAssuredVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-catalina</artifactId>
<version>${test.tomcat.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-util-scan</artifactId>
<version>${test.tomcat.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jasper</artifactId>
<version>${test.tomcat.version}</version>
</dependency>

<dependency>
<groupId>info.magnolia</groupId>
<artifactId>magnolia-core</artifactId>
</dependency>
<dependency>
<groupId>info.magnolia.cache</groupId>
<artifactId>magnolia-cache-core</artifactId>
</dependency>
</dependencies>

</project>
Loading
Loading