Skip to content

Commit

Permalink
Feature/java21 (#757)
Browse files Browse the repository at this point in the history
* 2023-12-07 Full support for Java 21 (compiling, testing, etc.) (jjlauer)
* 2023-12-07 Updated Jetty dependency to v9.4.53.v20231009 (jjlauer)
* 2023-12-07 Github workflow automated CI for Java 8, 11, 17, and 21 (jjlauer)
* 2023-12-07 Updated Mockito dependency for testing to v4.11.0 for Java 8, v5.4.0 for Java 9+ (jjlauer)
* 2023-12-07 Improved 'mvn test' speed by roughly 100% through optimizing several unit tests (jjlauer)
* 2023-12-07 Removed PowerMock dependency for testing (its old, no longer supported) (jjlauer)
* 2023-12-07 Added maven central and CI badges to README (jjlauer)
  • Loading branch information
jjlauer authored Dec 7, 2023
1 parent e5f1945 commit 45489c1
Show file tree
Hide file tree
Showing 81 changed files with 364 additions and 339 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/java11.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Java 11
on:
- push
- workflow_dispatch
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- name: Set up Azul JDK 11
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'zulu'
cache: 'maven'
- name: Test in Maven
run: mvn test
18 changes: 18 additions & 0 deletions .github/workflows/java17.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Java 17
on:
- push
- workflow_dispatch
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- name: Set up Azul JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'zulu'
cache: 'maven'
- name: Test in Maven
run: mvn test
18 changes: 18 additions & 0 deletions .github/workflows/java21.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Java 21
on:
- push
- workflow_dispatch
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- name: Set up Azul JDK 21
uses: actions/setup-java@v3
with:
java-version: 21
distribution: 'zulu'
cache: 'maven'
- name: Test in Maven
run: mvn test
18 changes: 18 additions & 0 deletions .github/workflows/java8.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Java 8
on:
- push
- workflow_dispatch
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- name: Set up Azul JDK 8
uses: actions/setup-java@v3
with:
java-version: 8
distribution: 'zulu'
cache: 'maven'
- name: Test in Maven
run: mvn test
23 changes: 0 additions & 23 deletions .github/workflows/maven.yml

This file was deleted.

9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@
/ | \ / | \/\__| / | \
\____|__ /___\____|__ /\________\____|__ /
web\/framework \/ \/


Ninja - web framework
=====================

[![Maven Central](https://img.shields.io/maven-central/v/org.ninjaframework/ninja?color=blue&style=flat-square)](https://mvnrepository.com/artifact/org.ninjaframework/ninja)

[![Java 8](https://img.shields.io/github/actions/workflow/status/ninjaframework/ninja/java8.yaml?branch=develop&label=Java%208&style=flat-square)](https://github.com/ninjaframework/ninja/actions/workflows/java11.yaml)
[![Java 11](https://img.shields.io/github/actions/workflow/status/ninjaframework/ninja/java11.yaml?branch=develop&label=Java%2011&style=flat-square)](https://github.com/ninjaframework/ninja/actions/workflows/java11.yaml)
[![Java 17](https://img.shields.io/github/actions/workflow/status/ninjaframework/ninja/java17.yaml?branch=develop&label=Java%2017&style=flat-square)](https://github.com/ninjaframework/ninja/actions/workflows/java17.yaml)
[![Java 19](https://img.shields.io/github/actions/workflow/status/ninjaframework/ninja/java21.yaml?branch=develop&label=Java%2021&style=flat-square)](https://github.com/ninjaframework/ninja/actions/workflows/java21.yaml)

Ninja is a full stack web framework for Java.
Rock solid, fast and super productive.

Expand Down
6 changes: 3 additions & 3 deletions ninja-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<parent>
<groupId>org.ninjaframework</groupId>
<artifactId>ninja</artifactId>
<version>6.9.1-SNAPSHOT</version>
<version>7.0.0-SNAPSHOT</version>
</parent>

<organization>
Expand Down Expand Up @@ -263,15 +263,15 @@
<artifactId>mockito-core</artifactId>
</dependency>

<dependency>
<!--<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId>
</dependency>
</dependency>-->

<!-- Jaxb was removed from Java 9 and onwards. So we add the dependency explicitly -->
<dependency>
Expand Down
11 changes: 11 additions & 0 deletions ninja-core/src/site/markdown/developer/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
Version 7.x.x
=============

* 2023-12-07 Full support for Java 21 (compiling, testing, etc.) (jjlauer)
* 2023-12-07 Updated Jetty dependency to v9.4.53.v20231009 (jjlauer)
* 2023-12-07 Github workflow automated CI for Java 8, 11, 17, and 21 (jjlauer)
* 2023-12-07 Updated Mockito dependency for testing to v4.11.0 for Java 8, v5.4.0 for Java 9+ (jjlauer)
* 2023-12-07 Improved 'mvn test' speed by roughly 100% through optimizing several unit tests (jjlauer)
* 2023-12-07 Removed PowerMock dependency for testing (its old, no longer supported) (jjlauer)
* 2023-12-07 Added maven central and CI badges to README (jjlauer)

Version 6.9.0
=============

Expand Down
2 changes: 1 addition & 1 deletion ninja-core/src/test/java/ninja/AssetsControllerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import org.mockito.Captor;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;

import java.io.ByteArrayOutputStream;

Expand Down
2 changes: 1 addition & 1 deletion ninja-core/src/test/java/ninja/AuthenticityFilterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;

@RunWith(MockitoJUnitRunner.class)
public class AuthenticityFilterTest {
Expand Down
22 changes: 8 additions & 14 deletions ninja-core/src/test/java/ninja/BasicAuthFilterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,19 @@

package ninja;

import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;

import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;

import ninja.session.Session;
import ninja.utils.NinjaConstant;
import ninja.utils.NinjaProperties;

import org.apache.commons.codec.binary.Base64;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;

import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.*;

@RunWith(MockitoJUnitRunner.class)
public class BasicAuthFilterTest {
Expand Down Expand Up @@ -91,7 +85,7 @@ public void testNullSession() {
// filter that
basicAuthFilter.filter(filterChain, context);

verifyZeroInteractions(filterChain);
verifyNoInteractions(filterChain);
}

@Test
Expand All @@ -107,7 +101,7 @@ public void testUnauthenticatedSession() {

assertEquals(NinjaConstant.LOCATION_VIEW_FTL_HTML_UNAUTHORIZED,
result.getTemplate());
verifyZeroInteractions(filterChain);
verifyNoInteractions(filterChain);
}

@Test
Expand Down Expand Up @@ -137,7 +131,7 @@ public void testSessionIsNotReturingWithInvalidCredentials() {

assertEquals(NinjaConstant.LOCATION_VIEW_FTL_HTML_UNAUTHORIZED,
result.getTemplate());
verifyZeroInteractions(filterChain);
verifyNoInteractions(filterChain);
}

@Test
Expand Down
23 changes: 6 additions & 17 deletions ninja-core/src/test/java/ninja/BootstrapTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,19 @@

package ninja;

import java.util.Optional;
import ninja.cache.Cache;
import static org.junit.Assert.assertTrue;
import ninja.utils.NinjaConstant;
import ninja.utils.NinjaMode;
import ninja.utils.NinjaProperties;
import ninja.utils.NinjaPropertiesImpl;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.isA;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;

/**
*
* @author ra
*/
@RunWith(MockitoJUnitRunner.class)
import java.util.Optional;

import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;

public class BootstrapTest {

NinjaPropertiesImpl ninjaPropertiesImpl;
Expand Down
2 changes: 1 addition & 1 deletion ninja-core/src/test/java/ninja/NinjaDefaultTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import org.mockito.Captor;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;

import java.util.Optional;

Expand Down
2 changes: 1 addition & 1 deletion ninja-core/src/test/java/ninja/ResultTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;

import com.google.common.collect.Maps;
import java.io.BufferedOutputStream;
Expand Down
10 changes: 5 additions & 5 deletions ninja-core/src/test/java/ninja/RouteBuilderImplTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
package ninja;

import com.google.common.collect.Lists;

import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
Expand All @@ -26,16 +28,14 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;

import com.google.inject.Injector;
import com.google.inject.Provider;
import ninja.utils.MethodReference;
import ninja.utils.NinjaBaseDirectoryResolver;
import ninja.utils.NinjaConstant;
import ninja.utils.NinjaProperties;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.startsWith;
import org.hamcrest.Matchers;
import static org.junit.Assert.assertThat;
import org.junit.Before;
Expand Down Expand Up @@ -404,7 +404,7 @@ public void routeToSpecificInstanceMethodReference() throws Exception {
Route route = routeBuilder.buildRoute(injector);

assertTrue(route.matches("GET", "/execute"));
assertThat(route.getControllerClass().getCanonicalName(), startsWith(this.getClass().getCanonicalName()));
assertThat(route.getControllerMethod().toString(), containsString(this.getClass().getCanonicalName()));
assertThat(route.getControllerMethod().getName(), is("apply"));
}

Expand Down Expand Up @@ -443,7 +443,7 @@ public void routeToAnonymousMethodReference() throws Exception {

assertTrue(route.matches("GET", "/execute"));
// should be a class within this test class as a real lambda
assertThat(route.getControllerClass().getCanonicalName(), startsWith(this.getClass().getCanonicalName()));
assertThat(route.getControllerMethod().toString(), containsString(this.getClass().getCanonicalName()));
assertThat(route.getControllerMethod().getName(), is("apply"));
}

Expand Down
2 changes: 1 addition & 1 deletion ninja-core/src/test/java/ninja/RouterImplTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;
import com.google.inject.Injector;
import com.google.inject.Provider;
import java.util.Collections;
Expand Down
11 changes: 5 additions & 6 deletions ninja-core/src/test/java/ninja/SecureFilterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,16 @@
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;
import static org.mockito.Mockito.*;

import ninja.session.Session;
import ninja.utils.NinjaConstant;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;

@RunWith(MockitoJUnitRunner.class)
public class SecureFilterTest {
Expand Down Expand Up @@ -70,7 +69,7 @@ public void testSecureFilter() {
// filter that
secureFilter.filter(filterChain, context);

verifyZeroInteractions(filterChain);
verifyNoInteractions(filterChain);
}

@Test
Expand All @@ -83,7 +82,7 @@ public void testSessionIsNotReturingWhenUserNameMissing() {
Result result = secureFilter.filter(filterChain, context);

assertEquals(NinjaConstant.LOCATION_VIEW_FTL_HTML_FORBIDDEN, result.getTemplate());
verifyZeroInteractions(filterChain);
verifyNoInteractions(filterChain);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;

import java.io.ByteArrayInputStream;
import java.io.IOException;
Expand Down
Loading

0 comments on commit 45489c1

Please sign in to comment.