Skip to content

Commit 6f34527

Browse files
gl-johnsonGitHub Enterprise
authored andcommitted
Merge pull request #23 from Conjur-Enterprise/jakarta-migration-java8-tests
CNJR-0000: Community PR: Jakarta migration java8 tests
2 parents 7e3148f + 40ddfef commit 6f34527

File tree

2 files changed

+25
-27
lines changed

2 files changed

+25
-27
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -603,14 +603,14 @@ Conjur conjur = new Conjur();
603603
String secret = conjur.variables().retrieveSecret("<VARIABLE_ID>");
604604
```
605605

606-
## JAX-RS Implementations
607-
608-
The Conjur API client uses the JAX-RS standard to make requests to the Conjur web services.
609-
In the future we plan to remove this dependency, but for the time being you may need to
610-
change the JAX-RS implementation to conform to your environment and application dependencies.
611-
Conjur API uses Apache CXF by default but for example, in a JBoss server environment, you
612-
should use the RESTlet implementation. You can replace that dependency in `pom.xml` to use an
613-
alternative implementation.
606+
## Jakarta REST (JAX-RS) Implementations
607+
The Conjur API client uses the Jakarta REST (formerly JAX-RS) standard to make requests to the Conjur web services.
608+
It is compatible with Jakarta EE environments and may not work in Java EE environments that still use the
609+
older javax.ws.rs packages.
610+
611+
Conjur API uses Jersey as the default Jakarta REST implementation for client requests. While it is broadly compatible,
612+
some application servers (e.g., JBoss EAP or WildFly) may require overriding the Jersey dependency in `pom.xml` to
613+
avoid conflicts.
614614

615615
## Troubleshooting
616616

src/test/java/com/cyberark/conjur/api/ConjurTest.java

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
package com.cyberark.conjur.api;
22

33
import org.junit.Assert;
4-
import org.junit.Rule;
54
import org.junit.Test;
6-
import org.junit.rules.ExpectedException;
7-
8-
import jakarta.ws.rs.ProcessingException;
95
import jakarta.ws.rs.WebApplicationException;
6+
107
import java.util.UUID;
118

129
/**
@@ -66,26 +63,27 @@ public void testAddSecretAndRetrieveSecret() {
6663

6764
@Test
6865
public void testSetVariableWithoutVariableInPolicy() {
69-
expectedException.expect(WebApplicationException.class);
70-
expectedException.expectMessage(NOT_FOUND_STATUS_CODE);
71-
72-
Conjur conjur = new Conjur();
73-
74-
conjur.variables().addSecret(NON_EXISTING_VARIABLE_KEY, VARIABLE_VALUE);
66+
WebApplicationException thrown = Assert.assertThrows(
67+
WebApplicationException.class,
68+
() -> {
69+
Conjur conjur = new Conjur();
70+
conjur.variables().addSecret(NON_EXISTING_VARIABLE_KEY, VARIABLE_VALUE);
71+
}
72+
);
73+
Assert.assertTrue(thrown.getMessage().contains(NOT_FOUND_STATUS_CODE));
7574
}
7675

7776
@Test
7877
public void testLogonWithAlterativeAuthenticator() {
79-
expectedException.expect(ProcessingException.class);
80-
expectedException.expectMessage(UNAUTHORIZED_STATUS_CODE);
81-
8278
String authnUrl = System.getProperty(APPLIANCE_URL_PROPERTY) + ALTERNATIVE_AUTHN_ENDPOINT;
8379

84-
Conjur conjur = new Conjur(ALTERNATIVE_USERNAME, ALTERNATIVE_API_KEY, authnUrl);
85-
conjur.variables().retrieveSecret(VARIABLE_KEY);
80+
WebApplicationException thrown = Assert.assertThrows(
81+
WebApplicationException.class,
82+
() -> {
83+
Conjur conjur = new Conjur(ALTERNATIVE_USERNAME, ALTERNATIVE_API_KEY, authnUrl);
84+
conjur.variables().retrieveSecret(VARIABLE_KEY);
85+
}
86+
);
87+
Assert.assertTrue(thrown.getMessage().contains(UNAUTHORIZED_STATUS_CODE));
8688
}
87-
88-
89-
@Rule
90-
public ExpectedException expectedException = ExpectedException.none();
9189
}

0 commit comments

Comments
 (0)