Repository: syncope Updated Branches: refs/heads/master 17a8eb5d9 -> 45ad6f559
http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SAML2ITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SAML2ITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SAML2ITCase.java index 20d8995..642c810 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SAML2ITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SAML2ITCase.java @@ -18,13 +18,14 @@ */ package org.apache.syncope.fit.core; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; +import static org.junit.jupiter.api.Assumptions.assumeTrue; import java.io.File; import java.io.InputStream; @@ -92,10 +93,9 @@ import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter; import org.bouncycastle.operator.ContentSigner; import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder; import org.joda.time.DateTime; -import org.junit.AfterClass; -import org.junit.Assume; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import org.opensaml.saml.common.xml.SAMLConstants; import org.opensaml.saml.saml2.core.Status; import org.opensaml.xmlsec.signature.support.SignatureConstants; @@ -113,7 +113,7 @@ public class SAML2ITCase extends AbstractITCase { private static Path truststorePath; - @BeforeClass + @BeforeAll public static void setup() { anonymous = new SyncopeClientFactoryBean(). setAddress(ADDRESS). @@ -123,7 +123,7 @@ public class SAML2ITCase extends AbstractITCase { OpenSAMLUtil.initSamlEngine(false); } - @BeforeClass + @BeforeAll public static void importFromIdPMetadata() throws Exception { if (!SAML2SPDetector.isSAML2SPAvailable()) { return; @@ -147,7 +147,7 @@ public class SAML2ITCase extends AbstractITCase { // Allow unsolicited responses for the realmb case String realmBEntityId = "urn:org:apache:cxf:fediz:idp:realm-B"; Optional<SAML2IdPTO> realmBIdP = - saml2IdPService.list().stream().filter(idp -> realmBEntityId.equals(idp.getEntityID())).findFirst(); + saml2IdPService.list().stream().filter(idp -> realmBEntityId.equals(idp.getEntityID())).findFirst(); realmBIdP.get().setSupportUnsolicited(true); saml2IdPService.update(realmBIdP.get()); } catch (Exception e) { @@ -161,7 +161,7 @@ public class SAML2ITCase extends AbstractITCase { assertEquals(4, saml2IdPService.list().size()); } - @AfterClass + @AfterAll public static void clearIdPs() throws Exception { if (!SAML2SPDetector.isSAML2SPAvailable()) { return; @@ -177,7 +177,7 @@ public class SAML2ITCase extends AbstractITCase { @Test public void spMetadata() { - Assume.assumeTrue(SAML2SPDetector.isSAML2SPAvailable()); + assumeTrue(SAML2SPDetector.isSAML2SPAvailable()); try { SAML2SPService service = anonymous.getService(SAML2SPService.class); @@ -209,7 +209,7 @@ public class SAML2ITCase extends AbstractITCase { @Test public void createLoginRequest() { - Assume.assumeTrue(SAML2SPDetector.isSAML2SPAvailable()); + assumeTrue(SAML2SPDetector.isSAML2SPAvailable()); SAML2RequestTO loginRequest = anonymous.getService(SAML2SPService.class). createLoginRequest(ADDRESS, "https://idp.testshib.org/idp/shibboleth"); @@ -223,7 +223,7 @@ public class SAML2ITCase extends AbstractITCase { @Test public void setIdPMapping() { - Assume.assumeTrue(SAML2SPDetector.isSAML2SPAvailable()); + assumeTrue(SAML2SPDetector.isSAML2SPAvailable()); Optional<SAML2IdPTO> ssoCircleOpt = saml2IdPService.list().stream().filter(o -> "https://idp.ssocircle.com".equals(o.getEntityID())). @@ -262,7 +262,7 @@ public class SAML2ITCase extends AbstractITCase { @Test public void validateLoginResponse() throws Exception { - Assume.assumeTrue(SAML2SPDetector.isSAML2SPAvailable()); + assumeTrue(SAML2SPDetector.isSAML2SPAvailable()); // Get a valid login request for the Fediz realm SAML2SPService saml2Service = anonymous.getService(SAML2SPService.class); @@ -313,7 +313,7 @@ public class SAML2ITCase extends AbstractITCase { @Test public void unsignedAssertionInLoginResponse() throws Exception { - Assume.assumeTrue(SAML2SPDetector.isSAML2SPAvailable()); + assumeTrue(SAML2SPDetector.isSAML2SPAvailable()); // Get a valid login request for the Fediz realm SAML2SPService saml2Service = anonymous.getService(SAML2SPService.class); @@ -331,7 +331,7 @@ public class SAML2ITCase extends AbstractITCase { org.opensaml.saml.saml2.core.Response samlResponse = createResponse(inResponseTo, false, SAML2Constants.CONF_SENDER_VOUCHES, - "urn:org:apache:cxf:fediz:idp:realm-A"); + "urn:org:apache:cxf:fediz:idp:realm-A"); Document doc = DOMUtils.newDocument(); Element responseElement = OpenSAMLUtil.toDom(samlResponse, doc); @@ -349,7 +349,7 @@ public class SAML2ITCase extends AbstractITCase { @Test public void loginResponseWrappingAttack() throws Exception { - Assume.assumeTrue(SAML2SPDetector.isSAML2SPAvailable()); + assumeTrue(SAML2SPDetector.isSAML2SPAvailable()); // Get a valid login request for the Fediz realm SAML2SPService saml2Service = anonymous.getService(SAML2SPService.class); @@ -411,7 +411,7 @@ public class SAML2ITCase extends AbstractITCase { @Test public void validateIdpInitiatedLoginResponse() throws Exception { - Assume.assumeTrue(SAML2SPDetector.isSAML2SPAvailable()); + assumeTrue(SAML2SPDetector.isSAML2SPAvailable()); SAML2SPService saml2Service = anonymous.getService(SAML2SPService.class); @@ -421,7 +421,7 @@ public class SAML2ITCase extends AbstractITCase { response.setUrlContext("saml2sp"); org.opensaml.saml.saml2.core.Response samlResponse = - createResponse(null, true, SAML2Constants.CONF_BEARER, "urn:org:apache:cxf:fediz:idp:realm-B"); + createResponse(null, true, SAML2Constants.CONF_BEARER, "urn:org:apache:cxf:fediz:idp:realm-B"); Document doc = DOMUtils.newDocument(); Element responseElement = OpenSAMLUtil.toDom(samlResponse, doc); @@ -431,7 +431,7 @@ public class SAML2ITCase extends AbstractITCase { response.setSamlResponse(Base64.getEncoder().encodeToString(responseStr.getBytes())); response.setRelayState("idpInitiated"); SAML2LoginResponseTO loginResponse = - saml2Service.validateLoginResponse(response); + saml2Service.validateLoginResponse(response); assertNotNull(loginResponse.getAccessToken()); assertEquals("puccini", loginResponse.getNameID()); } @@ -439,7 +439,7 @@ public class SAML2ITCase extends AbstractITCase { // Make sure that the IdP initiated case is only supported when "supportUnsolicited" is true for that IdP @Test public void validateIdpInitiatedLoginResponseFailure() throws Exception { - Assume.assumeTrue(SAML2SPDetector.isSAML2SPAvailable()); + assumeTrue(SAML2SPDetector.isSAML2SPAvailable()); SAML2SPService saml2Service = anonymous.getService(SAML2SPService.class); @@ -449,7 +449,7 @@ public class SAML2ITCase extends AbstractITCase { response.setUrlContext("saml2sp"); org.opensaml.saml.saml2.core.Response samlResponse = - createResponse(null, true, SAML2Constants.CONF_BEARER, "urn:org:apache:cxf:fediz:idp:realm-A"); + createResponse(null, true, SAML2Constants.CONF_BEARER, "urn:org:apache:cxf:fediz:idp:realm-A"); Document doc = DOMUtils.newDocument(); Element responseElement = OpenSAMLUtil.toDom(samlResponse, doc); http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SchedTaskITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SchedTaskITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SchedTaskITCase.java index 88e6c27..9ae9644 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SchedTaskITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SchedTaskITCase.java @@ -18,12 +18,12 @@ */ package org.apache.syncope.fit.core; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.util.Date; import java.util.List; @@ -44,7 +44,7 @@ import org.apache.syncope.common.rest.api.beans.ExecQuery; import org.apache.syncope.common.rest.api.beans.TaskQuery; import org.apache.syncope.common.rest.api.service.TaskService; import org.apache.syncope.fit.core.reference.TestSampleJobDelegate; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class SchedTaskITCase extends AbstractTaskITCase { @@ -63,7 +63,7 @@ public class SchedTaskITCase extends AbstractTaskITCase { tasks.getResult().stream().filter( task -> !(task instanceof SchedTaskTO) || task instanceof PullTaskTO || task instanceof PushTaskTO). forEachOrdered(item -> { - fail(); + fail("This should not happen"); }); } http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SearchITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SearchITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SearchITCase.java index e565362..e8002a6 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SearchITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SearchITCase.java @@ -18,11 +18,11 @@ */ package org.apache.syncope.fit.core; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import javax.ws.rs.core.Response; import org.apache.syncope.client.lib.SyncopeClient; @@ -41,7 +41,7 @@ import org.apache.syncope.common.rest.api.beans.AnyQuery; import org.apache.syncope.common.rest.api.service.RoleService; import org.apache.syncope.fit.AbstractITCase; import org.apache.syncope.fit.ElasticsearchDetector; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class SearchITCase extends AbstractITCase { http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SecurityQuestionITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SecurityQuestionITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SecurityQuestionITCase.java index cb9b018..8a6223a 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SecurityQuestionITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SecurityQuestionITCase.java @@ -18,10 +18,10 @@ */ package org.apache.syncope.fit.core; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.fail; import java.util.List; import javax.ws.rs.core.Response; @@ -30,7 +30,7 @@ import org.apache.syncope.common.lib.to.SecurityQuestionTO; import org.apache.syncope.common.lib.types.ClientExceptionType; import org.apache.syncope.common.rest.api.service.SecurityQuestionService; import org.apache.syncope.fit.AbstractITCase; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class SecurityQuestionITCase extends AbstractITCase { @@ -90,7 +90,7 @@ public class SecurityQuestionITCase extends AbstractITCase { try { securityQuestionService.read(securityQuestion.getKey()); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.NotFound, e.getType()); } http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SwaggerITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SwaggerITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SwaggerITCase.java index 78c219b..d928e3c 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SwaggerITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SwaggerITCase.java @@ -18,9 +18,10 @@ */ package org.apache.syncope.fit.core; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assumptions.assumeTrue; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; @@ -30,8 +31,7 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.apache.cxf.jaxrs.client.WebClient; import org.apache.syncope.fit.AbstractITCase; -import org.junit.Assume; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class SwaggerITCase extends AbstractITCase { @@ -39,7 +39,7 @@ public class SwaggerITCase extends AbstractITCase { public void swagger() throws IOException { WebClient webClient = WebClient.create(ADDRESS + "/swagger.json").accept(MediaType.APPLICATION_JSON_TYPE); Response response = webClient.get(); - Assume.assumeTrue(response.getStatus() == 200); + assumeTrue(response.getStatus() == 200); JsonNode tree = new ObjectMapper().readTree((InputStream) response.getEntity()); assertNotNull(tree); http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserITCase.java index 20d58da..f406c0e 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserITCase.java @@ -18,12 +18,14 @@ */ package org.apache.syncope.fit.core; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; +import static org.junit.jupiter.api.Assumptions.assumeTrue; import java.security.AccessControlException; import java.util.Collections; @@ -83,8 +85,7 @@ import org.apache.syncope.fit.core.reference.TestPasswordRuleConf; import org.apache.syncope.fit.AbstractITCase; import org.apache.syncope.fit.FlowableDetector; import org.identityconnectors.framework.common.objects.OperationalAttributes; -import org.junit.Assume; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class UserITCase extends AbstractITCase { @@ -152,7 +153,7 @@ public class UserITCase extends AbstractITCase { try { userTO = createUser(userTO).getEntity(); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.RequiredValuesMissing, e.getType()); } @@ -180,7 +181,7 @@ public class UserITCase extends AbstractITCase { try { userTO = createUser(userTO).getEntity(); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.RequiredValuesMissing, e.getType()); } @@ -205,50 +206,60 @@ public class UserITCase extends AbstractITCase { assertEquals(PropagationTaskExecStatus.SUCCESS, result.getPropagationStatuses().get(0).getStatus()); } - @Test(expected = SyncopeClientException.class) + @Test public void createWithInvalidPassword() { - UserTO userTO = getSampleTO("[email protected]"); - userTO.setPassword("pass"); - createUser(userTO); + assertThrows(SyncopeClientException.class, () -> { + UserTO userTO = getSampleTO("[email protected]"); + userTO.setPassword("pass"); + createUser(userTO); + }); } - @Test(expected = SyncopeClientException.class) + @Test public void createWithInvalidUsername() { - UserTO userTO = getSampleTO("[email protected]"); - userTO.setUsername("us"); - userTO.setRealm("/odd"); + assertThrows(SyncopeClientException.class, () -> { + UserTO userTO = getSampleTO("[email protected]"); + userTO.setUsername("us"); + userTO.setRealm("/odd"); - createUser(userTO); + createUser(userTO); + }); } - @Test(expected = SyncopeClientException.class) + @Test public void createWithInvalidPasswordByRes() { - UserTO userTO = getSampleTO("[email protected]"); + assertThrows(SyncopeClientException.class, () -> { + UserTO userTO = getSampleTO("[email protected]"); - // configured to be minLength=16 - userTO.setPassword("password1"); - userTO.getResources().add(RESOURCE_NAME_NOPROPAGATION); - createUser(userTO); + // configured to be minLength=16 + userTO.setPassword("password1"); + userTO.getResources().add(RESOURCE_NAME_NOPROPAGATION); + createUser(userTO); + }); } - @Test(expected = SyncopeClientException.class) + @Test public void createWithInvalidPasswordByGroup() { - UserTO userTO = getSampleTO("[email protected]"); + assertThrows(SyncopeClientException.class, () -> { + UserTO userTO = getSampleTO("[email protected]"); - // configured to be minLength=16 - userTO.setPassword("password1"); + // configured to be minLength=16 + userTO.setPassword("password1"); - userTO.getMemberships().add(new MembershipTO.Builder(). - group("f779c0d4-633b-4be5-8f57-32eb478a3ca5").build()); + userTO.getMemberships().add(new MembershipTO.Builder(). + group("f779c0d4-633b-4be5-8f57-32eb478a3ca5").build()); - createUser(userTO); + createUser(userTO); + }); } - @Test(expected = SyncopeClientException.class) + @Test public void createWithException() { - UserTO newUserTO = new UserTO(); - newUserTO.getPlainAttrs().add(attrTO("userId", "[email protected]")); - createUser(newUserTO); + assertThrows(SyncopeClientException.class, () -> { + UserTO newUserTO = new UserTO(); + newUserTO.getPlainAttrs().add(attrTO("userId", "[email protected]")); + createUser(newUserTO); + }); } @Test @@ -337,7 +348,7 @@ public class UserITCase extends AbstractITCase { try { createUser(userTO); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.EntityExists, e.getType()); } @@ -356,7 +367,7 @@ public class UserITCase extends AbstractITCase { // 1. create user without type (mandatory by UserSchema) try { createUser(userTO); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.RequiredValuesMissing, e.getType()); } @@ -369,7 +380,7 @@ public class UserITCase extends AbstractITCase { // 2. create user without surname (mandatory when type == 'F') try { createUser(userTO); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.RequiredValuesMissing, e.getType()); } @@ -492,33 +503,37 @@ public class UserITCase extends AbstractITCase { assertFalse(userTO.getPlainAttr("ctype").isPresent()); } - @Test(expected = SyncopeClientException.class) + @Test public void updateInvalidPassword() { - UserTO userTO = getSampleTO("[email protected]"); + assertThrows(SyncopeClientException.class, () -> { + UserTO userTO = getSampleTO("[email protected]"); - userTO = createUser(userTO).getEntity(); - assertNotNull(userTO); + userTO = createUser(userTO).getEntity(); + assertNotNull(userTO); - UserPatch userPatch = new UserPatch(); - userPatch.setKey(userTO.getKey()); - userPatch.setPassword(new PasswordPatch.Builder().value("pass").build()); + UserPatch userPatch = new UserPatch(); + userPatch.setKey(userTO.getKey()); + userPatch.setPassword(new PasswordPatch.Builder().value("pass").build()); - userService.update(userPatch); + userService.update(userPatch); + }); } - @Test(expected = SyncopeClientException.class) + @Test public void updateSamePassword() { - UserTO userTO = getUniqueSampleTO("[email protected]"); - userTO.setRealm("/even/two"); + assertThrows(SyncopeClientException.class, () -> { + UserTO userTO = getUniqueSampleTO("[email protected]"); + userTO.setRealm("/even/two"); - userTO = createUser(userTO).getEntity(); - assertNotNull(userTO); + userTO = createUser(userTO).getEntity(); + assertNotNull(userTO); - UserPatch userPatch = new UserPatch(); - userPatch.setKey(userTO.getKey()); - userPatch.setPassword(new PasswordPatch.Builder().value("password123").build()); + UserPatch userPatch = new UserPatch(); + userPatch.setKey(userTO.getKey()); + userPatch.setPassword(new PasswordPatch.Builder().value("password123").build()); - userService.update(userPatch); + userService.update(userPatch); + }); } @Test @@ -683,7 +698,7 @@ public class UserITCase extends AbstractITCase { @Test public void createActivate() { - Assume.assumeTrue(FlowableDetector.isFlowableEnabledForUsers(syncopeService)); + assumeTrue(FlowableDetector.isFlowableEnabledForUsers(syncopeService)); UserTO userTO = getUniqueSampleTO("[email protected]"); @@ -921,7 +936,7 @@ public class UserITCase extends AbstractITCase { // org.apache.syncope.common.lib.policy.AbstractAccountRuleConf's and / or // org.apache.syncope.common.lib.policy.AbstractPasswordRuleConf's // @XmlSeeAlso - the power of JAXB :-/ - Assume.assumeTrue(MediaType.APPLICATION_JSON_TYPE.equals(clientFactory.getContentType().getMediaType())); + assumeTrue(MediaType.APPLICATION_JSON_TYPE.equals(clientFactory.getContentType().getMediaType())); AccountPolicyTO accountPolicy = new AccountPolicyTO(); accountPolicy.setDescription("Account Policy with custom rules"); @@ -947,7 +962,7 @@ public class UserITCase extends AbstractITCase { user.setRealm(realm.getFullPath()); try { createUser(user); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.InvalidUser, e.getType()); assertTrue(e.getElements().iterator().next().startsWith("InvalidPassword")); @@ -956,7 +971,7 @@ public class UserITCase extends AbstractITCase { user.setPassword(user.getPassword() + "XXX"); try { createUser(user); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.InvalidUser, e.getType()); assertTrue(e.getElements().iterator().next().startsWith("InvalidUsername")); @@ -1064,7 +1079,7 @@ public class UserITCase extends AbstractITCase { try { resourceService.readConnObject(RESOURCE_NAME_CSV, AnyTypeKind.USER.name(), actual.getKey()); - fail(); + fail("This should not happen"); } catch (Exception e) { assertNotNull(e); } @@ -1082,7 +1097,7 @@ public class UserITCase extends AbstractITCase { try { resourceService.readConnObject(RESOURCE_NAME_CSV, AnyTypeKind.USER.name(), actual.getKey()); - fail(); + fail("This should not happen"); } catch (Exception e) { assertNotNull(e); } @@ -1114,7 +1129,7 @@ public class UserITCase extends AbstractITCase { try { resourceService.readConnObject(RESOURCE_NAME_CSV, AnyTypeKind.USER.name(), actual.getKey()); - fail(); + fail("This should not happen"); } catch (Exception e) { assertNotNull(e); } @@ -1134,7 +1149,7 @@ public class UserITCase extends AbstractITCase { try { resourceService.readConnObject(RESOURCE_NAME_CSV, AnyTypeKind.USER.name(), actual.getKey()); - fail(); + fail("This should not happen"); } catch (Exception e) { assertNotNull(e); } @@ -1179,7 +1194,7 @@ public class UserITCase extends AbstractITCase { try { resourceService.readConnObject(RESOURCE_NAME_CSV, AnyTypeKind.USER.name(), actual.getKey()); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.NotFound, e.getType()); } @@ -1199,7 +1214,7 @@ public class UserITCase extends AbstractITCase { try { resourceService.readConnObject(RESOURCE_NAME_CSV, AnyTypeKind.USER.name(), actual.getKey()); - fail(); + fail("This should not happen"); } catch (Exception e) { assertNotNull(e); } @@ -1232,7 +1247,7 @@ public class UserITCase extends AbstractITCase { try { resourceService.readConnObject(RESOURCE_NAME_CSV, AnyTypeKind.USER.name(), actual.getKey()); - fail(); + fail("This should not happen"); } catch (Exception e) { assertNotNull(e); } @@ -1263,7 +1278,7 @@ public class UserITCase extends AbstractITCase { try { resourceService.readConnObject(RESOURCE_NAME_CSV, AnyTypeKind.USER.name(), actual.getKey()); - fail(); + fail("This should not happen"); } catch (Exception e) { assertNotNull(e); } http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserIssuesITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserIssuesITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserIssuesITCase.java index ca81a1d..a7207ce 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserIssuesITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserIssuesITCase.java @@ -18,13 +18,13 @@ */ package org.apache.syncope.fit.core; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.io.IOException; import java.util.Base64; @@ -74,16 +74,13 @@ import org.apache.syncope.fit.AbstractITCase; import org.apache.syncope.fit.core.reference.DoubleValueLogicActions; import org.identityconnectors.framework.common.objects.Name; import org.identityconnectors.framework.common.objects.OperationalAttributes; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = { "classpath:testJDBCEnv.xml" }) +@SpringJUnitConfig(locations = { "classpath:testJDBCEnv.xml" }) public class UserIssuesITCase extends AbstractITCase { @Autowired @@ -115,7 +112,7 @@ public class UserIssuesITCase extends AbstractITCase { try { userTO = updateUser(userPatch).getEntity(); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.RequiredValuesMissing, e.getType()); } @@ -247,7 +244,7 @@ public class UserIssuesITCase extends AbstractITCase { try { createUser(userTO); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.InvalidValues, e.getType()); } @@ -709,7 +706,7 @@ public class UserIssuesITCase extends AbstractITCase { // 5. try to read user on resource: fail try { resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.USER.name(), userTO.getKey()); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.NotFound, e.getType()); } @@ -1136,7 +1133,7 @@ public class UserIssuesITCase extends AbstractITCase { userTO.getResources().add(RESOURCE_NAME_CSV); createUser(userTO, false); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.InvalidUser, e.getType()); assertTrue(e.getMessage().contains("Password mandatory")); @@ -1203,7 +1200,7 @@ public class UserIssuesITCase extends AbstractITCase { user.setPassword(user.getUsername()); try { createUser(user); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.InvalidUser, e.getType()); assertTrue(e.getElements().iterator().next().startsWith("InvalidPassword")); http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserSelfITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserSelfITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserSelfITCase.java index 249d8f3..565b043 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserSelfITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserSelfITCase.java @@ -18,13 +18,14 @@ */ package org.apache.syncope.fit.core; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; +import static org.junit.jupiter.api.Assumptions.assumeTrue; import java.util.Map; import java.util.Set; @@ -53,16 +54,12 @@ import org.apache.syncope.common.rest.api.service.UserSelfService; import org.apache.syncope.common.rest.api.service.UserService; import org.apache.syncope.fit.AbstractITCase; import org.apache.syncope.fit.FlowableDetector; -import org.junit.Assume; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = { "classpath:testJDBCEnv.xml" }) +@SpringJUnitConfig(locations = { "classpath:testJDBCEnv.xml" }) public class UserSelfITCase extends AbstractITCase { @Autowired @@ -75,12 +72,12 @@ public class UserSelfITCase extends AbstractITCase { @Test public void create() { - Assume.assumeTrue(FlowableDetector.isFlowableEnabledForUsers(syncopeService)); + assumeTrue(FlowableDetector.isFlowableEnabledForUsers(syncopeService)); // 1. self-registration as admin: failure try { userSelfService.create(UserITCase.getUniqueSampleTO("[email protected]"), true); - fail(); + fail("This should not happen"); } catch (ForbiddenException e) { assertNotNull(e); } @@ -97,7 +94,7 @@ public class UserSelfITCase extends AbstractITCase { @Test public void createAndApprove() { - Assume.assumeTrue(FlowableDetector.isFlowableEnabledForUsers(syncopeService)); + assumeTrue(FlowableDetector.isFlowableEnabledForUsers(syncopeService)); // self-create user with membership: goes 'createApproval' with resources and membership but no propagation UserTO userTO = UserITCase.getUniqueSampleTO("[email protected]"); @@ -117,7 +114,7 @@ public class UserSelfITCase extends AbstractITCase { try { resourceService.readConnObject(RESOURCE_NAME_TESTDB, AnyTypeKind.USER.name(), userTO.getKey()); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.NotFound, e.getType()); } @@ -138,7 +135,7 @@ public class UserSelfITCase extends AbstractITCase { try { userService2.read("1417acbe-cbf6-4277-9372-e75e04f97000"); - fail(); + fail("This should not happen"); } catch (ForbiddenException e) { assertNotNull(e); } @@ -182,7 +179,7 @@ public class UserSelfITCase extends AbstractITCase { @Test public void updateWithApproval() { - Assume.assumeTrue(FlowableDetector.isFlowableEnabledForUsers(syncopeService)); + assumeTrue(FlowableDetector.isFlowableEnabledForUsers(syncopeService)); // 1. create user as admin UserTO created = createUser(UserITCase.getUniqueSampleTO("[email protected]")).getEntity(); @@ -215,7 +212,7 @@ public class UserSelfITCase extends AbstractITCase { assertTrue(updated.getResources().isEmpty()); try { resourceService.readConnObject(RESOURCE_NAME_TESTDB, AnyTypeKind.USER.name(), updated.getKey()); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.NotFound, e.getType()); } @@ -282,7 +279,7 @@ public class UserSelfITCase extends AbstractITCase { SyncopeClient anonClient = clientFactory.create(); try { anonClient.getService(UserSelfService.class).requestPasswordReset(user.getUsername(), "WRONG"); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.InvalidSecurityAnswer, e.getType()); } @@ -295,7 +292,7 @@ public class UserSelfITCase extends AbstractITCase { // 5. confirm password reset try { anonClient.getService(UserSelfService.class).confirmPasswordReset("WRONG TOKEN", "newPassword"); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.NotFound, e.getType()); assertTrue(e.getMessage().contains("WRONG TOKEN")); @@ -340,7 +337,7 @@ public class UserSelfITCase extends AbstractITCase { // 5. confirm password reset try { anonClient.getService(UserSelfService.class).confirmPasswordReset("WRONG TOKEN", "newPassword"); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.NotFound, e.getType()); assertTrue(e.getMessage().contains("WRONG TOKEN")); @@ -380,7 +377,7 @@ public class UserSelfITCase extends AbstractITCase { // 2. attempt to access -> fail try { vivaldiClient.getService(ResourceService.class).list(); - fail(); + fail("This should not happen"); } catch (ForbiddenException e) { assertNotNull(e); assertEquals("Please change your password first", e.getMessage()); http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserWorkflowITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserWorkflowITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserWorkflowITCase.java index 5670398..ceffc32 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserWorkflowITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserWorkflowITCase.java @@ -20,12 +20,13 @@ package org.apache.syncope.fit.core; import org.apache.syncope.fit.FlowableDetector; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; +import static org.junit.jupiter.api.Assumptions.assumeTrue; import java.util.Collections; import java.util.List; @@ -48,17 +49,13 @@ import org.apache.syncope.common.lib.types.PatchOperation; import org.apache.syncope.common.rest.api.service.UserSelfService; import org.apache.syncope.common.rest.api.service.UserWorkflowService; import org.apache.syncope.fit.AbstractITCase; -import org.junit.Assume; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = { "classpath:testJDBCEnv.xml" }) +@SpringJUnitConfig(locations = { "classpath:testJDBCEnv.xml" }) public class UserWorkflowITCase extends AbstractITCase { @Autowired @@ -66,7 +63,7 @@ public class UserWorkflowITCase extends AbstractITCase { @Test public void createWithReject() { - Assume.assumeTrue(FlowableDetector.isFlowableEnabledForUsers(syncopeService)); + assumeTrue(FlowableDetector.isFlowableEnabledForUsers(syncopeService)); UserTO userTO = UserITCase.getUniqueSampleTO("[email protected]"); userTO.getResources().add(RESOURCE_NAME_TESTDB); @@ -106,7 +103,7 @@ public class UserWorkflowITCase extends AbstractITCase { getService(UserWorkflowService.class); try { userService2.claimForm(form.getTaskId()); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.Workflow, e.getType()); } @@ -140,7 +137,7 @@ public class UserWorkflowITCase extends AbstractITCase { @Test public void createWithApproval() { - Assume.assumeTrue(FlowableDetector.isFlowableEnabledForUsers(syncopeService)); + assumeTrue(FlowableDetector.isFlowableEnabledForUsers(syncopeService)); // read forms *before* any operation List<WorkflowFormTO> forms = userWorkflowService.getForms(); @@ -226,7 +223,7 @@ public class UserWorkflowITCase extends AbstractITCase { @Test public void updateApproval() { - Assume.assumeTrue(FlowableDetector.isFlowableEnabledForUsers(syncopeService)); + assumeTrue(FlowableDetector.isFlowableEnabledForUsers(syncopeService)); // read forms *before* any operation List<WorkflowFormTO> forms = userWorkflowService.getForms(); @@ -284,7 +281,7 @@ public class UserWorkflowITCase extends AbstractITCase { @Test public void issueSYNCOPE15() { - Assume.assumeTrue(FlowableDetector.isFlowableEnabledForUsers(syncopeService)); + assumeTrue(FlowableDetector.isFlowableEnabledForUsers(syncopeService)); // read forms *before* any operation List<WorkflowFormTO> forms = userWorkflowService.getForms(); http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/VirAttrITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/VirAttrITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/VirAttrITCase.java index 452fc11..d7161f7 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/VirAttrITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/VirAttrITCase.java @@ -18,10 +18,10 @@ */ package org.apache.syncope.fit.core; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.List; import java.util.Locale; @@ -61,15 +61,12 @@ import org.apache.syncope.common.rest.api.service.AnyTypeClassService; import org.apache.syncope.common.rest.api.service.ResourceService; import org.apache.syncope.fit.AbstractITCase; import org.identityconnectors.framework.common.objects.ObjectClass; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = { "classpath:testJDBCEnv.xml" }) +@SpringJUnitConfig(locations = { "classpath:testJDBCEnv.xml" }) public class VirAttrITCase extends AbstractITCase { @Autowired @@ -679,7 +676,7 @@ public class VirAttrITCase extends AbstractITCase { assertNotNull(userTO); assertTrue(ldap.getKey().equals(userTO.getResources().iterator().next())); - assertEquals(2, userTO.getVirAttrs().iterator().next().getValues().size(), 0); + assertEquals(2, userTO.getVirAttrs().iterator().next().getValues().size()); assertTrue(userTO.getVirAttrs().iterator().next().getValues().contains("[email protected]")); assertTrue(userTO.getVirAttrs().iterator().next().getValues().contains("[email protected]")); @@ -695,7 +692,7 @@ public class VirAttrITCase extends AbstractITCase { UserTO updated = updateUser(userPatch).getEntity(); assertNotNull(updated); - assertEquals(2, updated.getVirAttrs().iterator().next().getValues().size(), 0); + assertEquals(2, updated.getVirAttrs().iterator().next().getValues().size()); assertTrue(updated.getVirAttrs().iterator().next().getValues().contains("[email protected]")); assertTrue(updated.getVirAttrs().iterator().next().getValues().contains("[email protected]")); } finally { http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/VirSchemaITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/VirSchemaITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/VirSchemaITCase.java index faf1a0d..27d4a8e 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/VirSchemaITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/VirSchemaITCase.java @@ -18,11 +18,11 @@ */ package org.apache.syncope.fit.core; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.security.AccessControlException; import java.util.List; @@ -37,7 +37,7 @@ import org.apache.syncope.common.lib.types.SchemaType; import org.apache.syncope.common.rest.api.beans.SchemaQuery; import org.apache.syncope.common.rest.api.service.SchemaService; import org.apache.syncope.fit.AbstractITCase; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class VirSchemaITCase extends AbstractITCase { @@ -79,7 +79,7 @@ public class VirSchemaITCase extends AbstractITCase { try { schemaService.read(SchemaType.VIRTUAL, schema.getKey()); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.NotFound, e.getType()); } @@ -95,7 +95,7 @@ public class VirSchemaITCase extends AbstractITCase { SchemaService unauthenticated = clientFactory.create().getService(SchemaService.class); try { unauthenticated.list(new SchemaQuery.Builder().type(SchemaType.VIRTUAL).build()); - fail(); + fail("This should not happen"); } catch (AccessControlException e) { assertNotNull(e); } @@ -113,7 +113,7 @@ public class VirSchemaITCase extends AbstractITCase { try { createSchema(SchemaType.VIRTUAL, actual); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(Response.Status.CONFLICT, e.getType().getResponseStatus()); assertEquals(ClientExceptionType.EntityExists, e.getType()); @@ -122,7 +122,7 @@ public class VirSchemaITCase extends AbstractITCase { actual.setKey(null); try { createSchema(SchemaType.VIRTUAL, actual); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(Response.Status.BAD_REQUEST, e.getType().getResponseStatus()); assertEquals(ClientExceptionType.RequiredValuesMissing, e.getType()); @@ -144,7 +144,7 @@ public class VirSchemaITCase extends AbstractITCase { try { createSchema(SchemaType.VIRTUAL, schema); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.InvalidVirSchema, e.getType()); http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/WorkflowITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/WorkflowITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/WorkflowITCase.java index e9b28ba..3a921f9 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/WorkflowITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/WorkflowITCase.java @@ -18,9 +18,10 @@ */ package org.apache.syncope.fit.core; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assumptions.assumeTrue; import java.io.IOException; import java.io.InputStream; @@ -32,17 +33,16 @@ import org.apache.syncope.common.lib.to.WorkflowDefinitionTO; import org.apache.syncope.common.lib.types.AnyTypeKind; import org.apache.syncope.fit.AbstractITCase; import org.apache.syncope.fit.FlowableDetector; -import org.junit.Assume; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; public class WorkflowITCase extends AbstractITCase { private static String defaultUserKey = null; - @BeforeClass + @BeforeAll public static void findDefault() { - Assume.assumeTrue(FlowableDetector.isFlowableEnabledForUsers(syncopeService)); + assumeTrue(FlowableDetector.isFlowableEnabledForUsers(syncopeService)); Optional<WorkflowDefinitionTO> found = workflowService.list(AnyTypeKind.USER.name()).stream(). filter(object -> object.isMain()).findAny(); if (found.isPresent()) { @@ -53,7 +53,7 @@ public class WorkflowITCase extends AbstractITCase { @Test public void exportUserDefinition() throws IOException { - Assume.assumeTrue(FlowableDetector.isFlowableEnabledForUsers(syncopeService)); + assumeTrue(FlowableDetector.isFlowableEnabledForUsers(syncopeService)); Response response = workflowService.get(AnyTypeKind.USER.name(), defaultUserKey); assertTrue(response.getMediaType().toString(). startsWith(clientFactory.getContentType().getMediaType().toString())); @@ -65,7 +65,7 @@ public class WorkflowITCase extends AbstractITCase { @Test public void updateUserDefinition() throws IOException { - Assume.assumeTrue(FlowableDetector.isFlowableEnabledForUsers(syncopeService)); + assumeTrue(FlowableDetector.isFlowableEnabledForUsers(syncopeService)); Response response = workflowService.get(AnyTypeKind.USER.name(), defaultUserKey); String definition = IOUtils.toString((InputStream) response.getEntity(), StandardCharsets.UTF_8); http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/resources/log4j2.xml ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/resources/log4j2.xml b/fit/core-reference/src/test/resources/log4j2.xml index 924edbd..151eedb 100644 --- a/fit/core-reference/src/test/resources/log4j2.xml +++ b/fit/core-reference/src/test/resources/log4j2.xml @@ -19,12 +19,19 @@ under the License. --> <configuration status="WARN" shutdownHook="disable"> <appenders> - <console name="main" target="SYSTEM_OUT"> + <RollingRandomAccessFile name="main" fileName="${log.directory}/it.log" + filePattern="${log.directory}/it-%d{yyyy-MM-dd}.log.gz" + immediateFlush="false" append="true"> <PatternLayout> <pattern>%d{HH:mm:ss.SSS} %-5level %logger - %msg%n</pattern> </PatternLayout> - </console> + <Policies> + <TimeBasedTriggeringPolicy/> + <SizeBasedTriggeringPolicy size="250 MB"/> + </Policies> + </RollingRandomAccessFile> </appenders> + <loggers> <asyncLogger name="org.apache.syncope.fit" additivity="false" level="DEBUG"> <appender-ref ref="main"/> http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/enduser-reference/pom.xml ---------------------------------------------------------------------- diff --git a/fit/enduser-reference/pom.xml b/fit/enduser-reference/pom.xml index b6a9807..c9eb188 100644 --- a/fit/enduser-reference/pom.xml +++ b/fit/enduser-reference/pom.xml @@ -99,8 +99,8 @@ under the License. <!-- TEST --> <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-engine</artifactId> <scope>test</scope> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/ide/eclipse/bundles/org.apache.syncope.ide.eclipse.tests/src/main/java/org/apache/syncope/ide/eclipse/tests/SyncopeViewTest.java ---------------------------------------------------------------------- diff --git a/ide/eclipse/bundles/org.apache.syncope.ide.eclipse.tests/src/main/java/org/apache/syncope/ide/eclipse/tests/SyncopeViewTest.java b/ide/eclipse/bundles/org.apache.syncope.ide.eclipse.tests/src/main/java/org/apache/syncope/ide/eclipse/tests/SyncopeViewTest.java index 9228481..b4a4591 100644 --- a/ide/eclipse/bundles/org.apache.syncope.ide.eclipse.tests/src/main/java/org/apache/syncope/ide/eclipse/tests/SyncopeViewTest.java +++ b/ide/eclipse/bundles/org.apache.syncope.ide.eclipse.tests/src/main/java/org/apache/syncope/ide/eclipse/tests/SyncopeViewTest.java @@ -18,8 +18,8 @@ */ package org.apache.syncope.ide.eclipse.tests; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView; @@ -29,7 +29,7 @@ import org.eclipse.swtbot.swt.finder.waits.ICondition; import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.junit.runner.RunWith; @RunWith(SWTBotJunit4ClassRunner.class) http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 2c3e450..a349edc 100644 --- a/pom.xml +++ b/pom.xml @@ -407,7 +407,7 @@ under the License. <h2.version>1.4.196</h2.version> - <junit.version>4.12</junit.version> + <junit.version>5.0.0</junit.version> <conf.directory>${project.build.directory}/test-classes</conf.directory> <bundles.directory>${project.build.directory}/bundles</bundles.directory> @@ -736,6 +736,12 @@ under the License. <groupId>org.apache.openjpa</groupId> <artifactId>openjpa-jdbc</artifactId> <version>${openjpa.version}</version> + <exclusions> + <exclusion> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>org.apache.openjpa</groupId> @@ -1581,6 +1587,12 @@ under the License. <artifactId>greenmail</artifactId> <version>1.5.5</version> <scope>test</scope> + <exclusions> + <exclusion> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>org.bouncycastle</groupId> @@ -1595,8 +1607,8 @@ under the License. <scope>test</scope> </dependency> <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-engine</artifactId> <version>${junit.version}</version> <scope>test</scope> </dependency> @@ -1619,6 +1631,10 @@ under the License. <id>netbeans</id> <url>http://bits.netbeans.org/maven2/</url> </repository> + <repository> + <id>jitpack.io</id> + <url>https://jitpack.io</url> + </repository> </repositories> <pluginRepositories> @@ -1626,6 +1642,16 @@ under the License. <id>apache.snapshots</id> <url>http://repository.apache.org/snapshots</url> </pluginRepository> + <pluginRepository> + <id>sonatype</id> + <url>https://oss.sonatype.org/content/repositories/snapshots</url> + <releases> + <enabled>false</enabled> + </releases> + <snapshots> + <enabled>true</enabled> + </snapshots> + </pluginRepository> </pluginRepositories> <build> @@ -1801,6 +1827,13 @@ under the License. <runOrder>alphabetical</runOrder> <argLine>-Xms512m -Xmx1024m -Xss256k</argLine> </configuration> + <dependencies> + <dependency> + <groupId>org.junit.platform</groupId> + <artifactId>junit-platform-surefire-provider</artifactId> + <version>1.1.0-SNAPSHOT</version> + </dependency> + </dependencies> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> @@ -1812,6 +1845,13 @@ under the License. <runOrder>alphabetical</runOrder> <argLine>-Xms512m -Xmx1024m -Xss256k</argLine> </configuration> + <dependencies> + <dependency> + <groupId>org.junit.platform</groupId> + <artifactId>junit-platform-surefire-provider</artifactId> + <version>1.1.0-SNAPSHOT</version> + </dependency> + </dependencies> <executions> <execution> <goals>
