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

More code cleanup and set coveralls gha back to how it was until figured out. #2213

Merged
merged 4 commits into from
Jan 22, 2024
Merged
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: 2 additions & 2 deletions .github/workflows/coveralls.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ jobs:
if: github.event_name == 'pull_request'
run: ./mvnw -B -V test jacoco:report coveralls:report -q -D"license.skip=true" -DrepoToken=$GITHUB_TOKEN -DserviceName=github -DpullRequest=$PR_NUMBER --no-transfer-progress --file Source/JNA/pom.xml -Pcoveralls
env:
GITHUB_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.number }}
- name: Report Coverage to Coveralls for General Push
if: github.event_name == 'push'
run: ./mvnw -B -V test jacoco:report coveralls:report -q -D"license.skip=true" -DrepoToken=$GITHUB_TOKEN -DserviceName=github --no-transfer-progress --file Source/JNA/pom.xml -Pcoveralls
env:
GITHUB_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ void testAbort() throws LoginException {
this.loginModule.initialize(subject, callbackHandler, null, options);
Assertions.assertTrue(this.loginModule.login());
this.loginModule.abort();
assertThat(subject.getPrincipals().size()).isEqualTo(0);
assertThat(subject.getPrincipals().size()).isZero();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void tearDown() {
@Test
void testImpersonateEnabled() throws IOException, ServletException {

Assertions.assertFalse(Advapi32Util.getUserName().equals(MockWindowsAccount.TEST_USER_NAME),
Assertions.assertNotEquals(MockWindowsAccount.TEST_USER_NAME, Advapi32Util.getUserName(),
"Current user shouldn't be the test user prior to the test");

final SimpleHttpRequest request = new SimpleHttpRequest();
Expand Down Expand Up @@ -158,7 +158,7 @@ void testImpersonateEnabled() throws IOException, ServletException {
@Test
void testImpersonateDisabled() throws IOException, ServletException {

Assertions.assertFalse(Advapi32Util.getUserName().equals(MockWindowsAccount.TEST_USER_NAME),
Assertions.assertNotEquals(MockWindowsAccount.TEST_USER_NAME, Advapi32Util.getUserName(),
"Current user shouldn't be the test user prior to the test");
final SimpleHttpRequest request = new SimpleHttpRequest();
request.setMethod("GET");
Expand All @@ -182,9 +182,9 @@ void testImpersonateDisabled() throws IOException, ServletException {
Assertions.assertTrue(principal instanceof WindowsPrincipal);
windowsPrincipal = (WindowsPrincipal) principal;

Assertions.assertFalse(MockWindowsAccount.TEST_USER_NAME.equals(filterChain.getUserName()),
Assertions.assertNotEquals(MockWindowsAccount.TEST_USER_NAME, filterChain.getUserName(),
"Test user should not be impersonated");
Assertions.assertFalse(Advapi32Util.getUserName().equals(MockWindowsAccount.TEST_USER_NAME),
Assertions.assertNotEquals(MockWindowsAccount.TEST_USER_NAME, Advapi32Util.getUserName(),
"Impersonation context should have been reverted");
} finally {
if (windowsPrincipal != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

import java.io.IOException;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Level;
Expand All @@ -53,7 +54,7 @@ class NegotiateSecurityFilterLoadTest {
@Test
void launchLoadTest() throws RunnerException {
final Options opt = new OptionsBuilder().threads(10).measurementIterations(10).build();
new Runner(opt).run();
Assertions.assertNotNull(new Runner(opt).run());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
package waffle.windows.auth;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Scope;
Expand All @@ -46,7 +47,7 @@ class WindowsAuthProviderLoadTest {
@Test
void launchLoadTest() throws RunnerException {
final Options opt = new OptionsBuilder().threads(10).measurementIterations(10).build();
new Runner(opt).run();
Assertions.assertNotNull(new Runner(opt).run());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ void testImpersonateLoggedOnUser() {
void testGetCurrentComputer() {
final IWindowsAuthProvider prov = new WindowsAuthProviderImpl();
final IWindowsComputer computer = prov.getCurrentComputer();
WindowsAuthProviderTest.LOGGER.info(computer.getComputerName());
WindowsAuthProviderTest.LOGGER.info("{}", computer.getComputerName());
assertThat(computer.getComputerName()).isNotEmpty();
WindowsAuthProviderTest.LOGGER.info(computer.getJoinStatus());
WindowsAuthProviderTest.LOGGER.info(computer.getMemberOf());
WindowsAuthProviderTest.LOGGER.info("{}", computer.getJoinStatus());
WindowsAuthProviderTest.LOGGER.info("{}", computer.getMemberOf());
final String[] localGroups = computer.getGroups();
Assertions.assertNotNull(localGroups);
assertThat(localGroups).isNotEmpty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ void testAbort() throws LoginException {
this.loginModule.initialize(subject, callbackHandler, null, options);
Assertions.assertTrue(this.loginModule.login());
this.loginModule.abort();
assertThat(subject.getPrincipals().size()).isEqualTo(0);
assertThat(subject.getPrincipals().size()).isZero();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.Base64;
import java.util.Locale;

import javax.security.auth.Subject;
import javax.servlet.ServletException;
Expand Down Expand Up @@ -221,7 +222,8 @@ void testNegotiate() throws IOException, ServletException {
Assertions.assertTrue(filterChain.getRequest() instanceof NegotiateRequestWrapper);
Assertions.assertTrue(filterChain.getResponse() instanceof SimpleHttpResponse);
final NegotiateRequestWrapper wrappedRequest = (NegotiateRequestWrapper) filterChain.getRequest();
Assertions.assertEquals(NegotiateSecurityFilterTest.NEGOTIATE.toUpperCase(), wrappedRequest.getAuthType());
Assertions.assertEquals(NegotiateSecurityFilterTest.NEGOTIATE.toUpperCase(Locale.ENGLISH),
wrappedRequest.getAuthType());
Assertions.assertEquals(Secur32Util.getUserNameEx(EXTENDED_NAME_FORMAT.NameSamCompatible),
wrappedRequest.getRemoteUser());
Assertions.assertTrue(wrappedRequest.getUserPrincipal() instanceof WindowsPrincipal);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ void testImpersonateLoggedOnUser() {
void testGetCurrentComputer() {
final IWindowsAuthProvider prov = new WindowsAuthProviderImpl();
final IWindowsComputer computer = prov.getCurrentComputer();
WindowsAuthProviderTest.LOGGER.info(computer.getComputerName());
WindowsAuthProviderTest.LOGGER.info("{}", computer.getComputerName());
assertThat(computer.getComputerName()).isNotEmpty();
WindowsAuthProviderTest.LOGGER.info(computer.getJoinStatus());
WindowsAuthProviderTest.LOGGER.info(computer.getMemberOf());
WindowsAuthProviderTest.LOGGER.info("{}", computer.getJoinStatus());
WindowsAuthProviderTest.LOGGER.info("{}", computer.getMemberOf());
final String[] localGroups = computer.getGroups();
Assertions.assertNotNull(localGroups);
assertThat(localGroups).isNotEmpty();
Expand Down
Loading