Skip to content

Commit

Permalink
Bump the framework version and fix the test failures due to framework…
Browse files Browse the repository at this point in the history
… version bump
  • Loading branch information
sandushi committed Jul 19, 2023
1 parent 778a5e1 commit 05ad734
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@
<groupId>org.wso2.carbon.identity.governance</groupId>
<artifactId>org.wso2.carbon.identity.auth.attribute.handler</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.organization.management.core</groupId>
<artifactId>org.wso2.carbon.identity.organization.management.service</artifactId>
</dependency>

<!--Test Dependencies-->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.wso2.carbon.identity.application.authentication.framework.context.AuthenticationContext;
import org.wso2.carbon.identity.application.authentication.framework.exception.AuthenticationFailedException;
import org.wso2.carbon.identity.application.authentication.framework.exception.InvalidCredentialsException;
import org.wso2.carbon.identity.application.authentication.framework.internal.FrameworkServiceDataHolder;
import org.wso2.carbon.identity.application.authentication.framework.model.AuthenticatedUser;
import org.wso2.carbon.identity.application.authentication.framework.util.FrameworkUtils;
import org.wso2.carbon.identity.application.authenticator.magiclink.cache.MagicLinkAuthContextCache;
Expand Down Expand Up @@ -79,7 +80,8 @@

@PrepareForTest({ TokenGenerator.class, IdentityUtil.class, ServiceURLBuilder.class, IdentityTenantUtil.class,
AbstractUserStoreManager.class, MagicLinkAuthContextCache.class, MagicLinkServiceDataHolder.class,
ConfigurationFacade.class, FrameworkUtils.class, MultitenantUtils.class, UserCoreUtil.class})
ConfigurationFacade.class, FrameworkUtils.class, MultitenantUtils.class, UserCoreUtil.class,
FrameworkServiceDataHolder.class})
@PowerMockIgnore({ "javax.net.*", "javax.security.*", "javax.crypto.*", "javax.xml.*" })
public class MagicLinkAuthenticatorTest {

Expand Down Expand Up @@ -122,6 +124,8 @@ public class MagicLinkAuthenticatorTest {
@Mock
private ConfigurationFacade mockConfigurationFacade;

private FrameworkServiceDataHolder frameworkServiceDataHolder;

@BeforeMethod
public void setUp() {

Expand All @@ -134,6 +138,8 @@ public void setUp() {
mockStatic(MultitenantUtils.class);
mockUserStoreManager = mock(AbstractUserStoreManager.class);
Whitebox.setInternalState(magicLinkAuthenticator, "authenticationContext", context);
frameworkServiceDataHolder = mock(FrameworkServiceDataHolder.class);
mockStatic(FrameworkServiceDataHolder.class);
}

private void mockServiceURLBuilder() {
Expand Down Expand Up @@ -490,8 +496,9 @@ public void testProcess() throws Exception {
MagicLinkServiceDataHolder.getInstance().setRealmService(mockRealmService);
when(IdentityUtil.getPrimaryDomainName()).thenReturn(USER_STORE_DOMAIN);
when(IdentityTenantUtil.getTenantId(SUPER_TENANT_DOMAIN)).thenReturn(-1234);
AuthenticatedUser authenticatedUser = AuthenticatedUser.createLocalAuthenticatedUserFromSubjectIdentifier(
USERNAME);
AuthenticatedUser authenticatedUser = new AuthenticatedUser();
authenticatedUser.setAuthenticatedSubjectIdentifier(USERNAME);
authenticatedUser.setUserName(USERNAME);
when(context.getLastAuthenticatedUser()).thenReturn(authenticatedUser);
when(TokenGenerator.generateToken(anyInt())).thenReturn(DUMMY_MAGIC_TOKEN);
mockStatic(MagicLinkAuthContextCache.class);
Expand All @@ -512,6 +519,8 @@ public void testProcess() throws Exception {
when(mockRealmService.getTenantUserRealm(anyInt())).thenReturn(mockUserRealm);
when(mockUserRealm.getUserStoreManager()).thenReturn(mockUserStoreManager);
when(mockUserStoreManager.getUserListWithID(USERNAME_CLAIM, USERNAME, null)).thenReturn(userList);
PowerMockito.when(FrameworkServiceDataHolder.getInstance()).thenReturn(frameworkServiceDataHolder);
PowerMockito.when(frameworkServiceDataHolder.getRealmService()).thenReturn(mockRealmService);

Mockito.doNothing().when(httpServletResponse).sendRedirect(anyString());

Expand Down
10 changes: 9 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@
<version>${powermock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.organization.management.core</groupId>
<artifactId>org.wso2.carbon.identity.organization.management.service</artifactId>
<version>${org.wso2.carbon.identity.organization.management.core.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>org.jacoco.agent</artifactId>
Expand Down Expand Up @@ -201,14 +207,16 @@
<identity.application.authenticator.magiclink.exp.pkg.version>${project.version}
</identity.application.authenticator.magiclink.exp.pkg.version>
<carbon.kernel.version>4.7.0</carbon.kernel.version>
<carbon.identity.framework.version>5.25.245</carbon.identity.framework.version>
<carbon.identity.framework.version>5.25.252</carbon.identity.framework.version>
<apache.felix.scr.ds.annotations.version>1.2.10</apache.felix.scr.ds.annotations.version>
<identity.event.handler.notification.version>1.3.14</identity.event.handler.notification.version>
<identity.inbound.auth.oauth.version>6.4.126</identity.inbound.auth.oauth.version>
<identity.outbound.auth.oidc.version>5.1.2</identity.outbound.auth.oidc.version>
<commons-logging.version>4.4.3</commons-logging.version>
<carbon.p2.plugin.version>1.5.3</carbon.p2.plugin.version>
<identity.governance.version>1.8.23</identity.governance.version>
<org.wso2.carbon.identity.organization.management.core.version>1.0.55
</org.wso2.carbon.identity.organization.management.core.version>

<!--Test Dependencies-->
<testng.version>6.9.10</testng.version>
Expand Down

0 comments on commit 05ad734

Please sign in to comment.