Skip to content

Commit

Permalink
Update unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hwupathum committed Feb 9, 2025
1 parent f145471 commit d5c799a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@
import javax.xml.bind.annotation.XmlTransient;


import static org.wso2.carbon.identity.application.mgt.ApplicationConstants.DEFAULT_BACKCHANNEL_LOGOUT_URL;
import static org.wso2.carbon.identity.application.mgt.ApplicationConstants.IS_FRAGMENT_APP;
import static org.wso2.carbon.identity.configuration.mgt.core.constant.ConfigurationConstants.TENANT_CONTEXT_PATH_COMPONENT;
import static org.wso2.carbon.identity.organization.management.application.constant.OrgApplicationMgtConstants.IS_FRAGMENT_APP;

/**
* OAuth application data object.
Expand All @@ -57,7 +58,6 @@
public class OAuthAppDO extends InboundConfigurationProtocol implements Serializable {

private static final long serialVersionUID = -6453843721358989519L;
private static final String DEFAULT_BACKCHANNEL_LOGOUT_URL = "/identity/oidc/slo";

@XmlTransient
private int id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
import static org.mockito.MockitoAnnotations.initMocks;
import static org.testng.Assert.assertThrows;
import static org.wso2.carbon.base.MultitenantConstants.SUPER_TENANT_ID;
import static org.wso2.carbon.identity.application.mgt.ApplicationConstants.DEFAULT_BACKCHANNEL_LOGOUT_URL;
import static org.wso2.carbon.identity.oauth.common.OAuthConstants.ENABLE_CLAIMS_SEPARATION_FOR_ACCESS_TOKEN;
import static org.wso2.carbon.identity.oauth.common.OAuthConstants.OIDC_DIALECT;
import static org.wso2.carbon.utils.multitenancy.MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;
Expand Down Expand Up @@ -234,6 +235,7 @@ public void testGetAllOAuthApplicationData(String userName) throws Exception {
AuthenticatedUser authenticatedUser = new AuthenticatedUser();
oAuthAppDO.setApplicationName("testapp1");
oAuthAppDO.setUser(authenticatedUser);
oAuthAppDO.setBackChannelLogoutUrl(DEFAULT_BACKCHANNEL_LOGOUT_URL);
authenticatedUser.setUserName(userName);

try (MockedConstruction<OAuthAppDAO> mockedConstruction = Mockito.mockConstruction(OAuthAppDAO.class,
Expand Down Expand Up @@ -289,6 +291,7 @@ public void testRegisterOAuthApplicationData(String oauthVersion, String userNam
oAuthConsumerAppDTO.setOauthConsumerSecret(consumerSecret);
oAuthConsumerAppDTO.setOAuthVersion(oauthVersion);
oAuthConsumerAppDTO.setRenewRefreshTokenEnabled("true");
oAuthConsumerAppDTO.setBackChannelLogoutUrl(DEFAULT_BACKCHANNEL_LOGOUT_URL);

try (MockedConstruction<OAuthAppDAO> mockedConstruction = Mockito.mockConstruction(OAuthAppDAO.class,
(mock, context) -> {
Expand Down Expand Up @@ -722,6 +725,7 @@ public void testUpdateOauthSecretKey() throws Exception {
OAuthAppDO oAuthAppDO = new OAuthAppDO();
oAuthAppDO.setOauthConsumerKey(CONSUMER_KEY);
oAuthAppDO.setOauthConsumerSecret(UPDATED_CONSUMER_SECRET);
oAuthAppDO.setBackChannelLogoutUrl(DEFAULT_BACKCHANNEL_LOGOUT_URL);

AuthenticatedUser authenticatedUser = new AuthenticatedUser();
authenticatedUser.setUserName("test_user");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.mockStatic;
import static org.mockito.Mockito.when;
import static org.wso2.carbon.identity.application.mgt.ApplicationConstants.DEFAULT_BACKCHANNEL_LOGOUT_URL;
import static org.wso2.carbon.identity.oauth2.test.utils.CommonTestUtils.setFinalStatic;

@WithCarbonHome
Expand Down Expand Up @@ -247,6 +248,7 @@ private void addSampleOauth2Application() throws IdentityOAuthAdminException {
oAuthAppDO.setUser(user);
oAuthAppDO.setApplicationName("testApp" + new Random(4));
oAuthAppDO.setOauthVersion("2.0");
oAuthAppDO.setBackChannelLogoutUrl(DEFAULT_BACKCHANNEL_LOGOUT_URL);

OAuthAppDAO authAppDAO = new OAuthAppDAO();
authAppDAO.addOAuthConsumer("testUser", -1234, "PRIMARY");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.mockStatic;
import static org.wso2.carbon.identity.application.mgt.ApplicationConstants.DEFAULT_BACKCHANNEL_LOGOUT_URL;

/**
* Unit test covering TokenResponseTypeHandler class
Expand Down Expand Up @@ -108,6 +109,7 @@ public void testIssue(boolean isIDPIdColumnEnabled, String clientId) throws Exce
oAuthAppDO.setOauthConsumerKey(clientId);
oAuthAppDO.setUser(authenticatedUser);
oAuthAppDO.setOauthVersion(OAuthConstants.OAuthVersions.VERSION_2);
oAuthAppDO.setBackChannelLogoutUrl(DEFAULT_BACKCHANNEL_LOGOUT_URL);

AccessTokenDO accessTokenDO = new AccessTokenDO();
accessTokenDO.setAccessToken("abcdefghijklmn");
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,7 @@
<carbon.kernel.registry.imp.pkg.version.range>[1.0.1, 2.0.0)</carbon.kernel.registry.imp.pkg.version.range>

<!-- Carbon Identity Framework version -->
<carbon.identity.framework.version>7.7.140</carbon.identity.framework.version>
<carbon.identity.framework.version>7.7.221</carbon.identity.framework.version>
<carbon.identity.framework.imp.pkg.version.range>[5.25.234, 8.0.0)
</carbon.identity.framework.imp.pkg.version.range>
<identity.oauth.xacml.version.range>[2.0.0, 3.0.0)</identity.oauth.xacml.version.range>
Expand Down

0 comments on commit d5c799a

Please sign in to comment.