Java Code Examples for org.wso2.carbon.identity.base.IdentityConstants
The following examples show how to use
org.wso2.carbon.identity.base.IdentityConstants.
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: carbon-identity-framework Author: wso2 File: EntitlementEngine.java License: Apache License 2.0 | 6 votes |
/** * Evaluates the given XACML request and returns the Response * * @param requestCtx Balana Object model for request * @param xacmlRequest Balana Object model for request * @return ResponseCtx Balana Object model for response */ public ResponseCtx evaluate(AbstractRequestCtx requestCtx, String xacmlRequest) { if (log.isDebugEnabled() && IdentityUtil.isTokenLoggable(IdentityConstants.IdentityTokens.XACML_REQUEST)) { log.debug("XACML Request : " + xacmlRequest); } ResponseCtx xacmlResponse; if ((xacmlResponse = (ResponseCtx) getFromCache(xacmlRequest, false)) != null) { if (log.isDebugEnabled() && IdentityUtil.isTokenLoggable(IdentityConstants.IdentityTokens.XACML_RESPONSE)) { log.debug("XACML Response : " + xacmlResponse); } return xacmlResponse; } xacmlResponse = pdp.evaluate(requestCtx); addToCache(xacmlRequest, xacmlResponse, false); if (log.isDebugEnabled() && IdentityUtil.isTokenLoggable(IdentityConstants.IdentityTokens.XACML_RESPONSE)) { log.debug("XACML Response : " + xacmlResponse); } return xacmlResponse; }
Example #2
Source Project: carbon-identity-framework Author: wso2 File: DefaultServiceURLBuilderTest.java License: Apache License 2.0 | 6 votes |
@BeforeMethod public void setUp() throws Exception { mockStatic(CarbonUtils.class); mockStatic(ServerConfiguration.class); mockStatic(NetworkUtils.class); mockStatic(IdentityCoreServiceComponent.class); mockStatic(IdentityTenantUtil.class); mockStatic(PrivilegedCarbonContext.class); PrivilegedCarbonContext privilegedCarbonContext = mock(PrivilegedCarbonContext.class); when(PrivilegedCarbonContext.getThreadLocalCarbonContext()).thenReturn(privilegedCarbonContext); when(ServerConfiguration.getInstance()).thenReturn(mockServerConfiguration); when(IdentityCoreServiceComponent.getConfigurationContextService()).thenReturn(mockConfigurationContextService); when(mockConfigurationContextService.getServerConfigContext()).thenReturn(mockConfigurationContext); when(mockConfigurationContext.getAxisConfiguration()).thenReturn(mockAxisConfiguration); try { when(NetworkUtils.getLocalHostname()).thenReturn("localhost"); } catch (SocketException e) { // Mock behaviour, hence ignored } System.setProperty(IdentityConstants.CarbonPlaceholders.CARBON_PORT_HTTP_PROPERTY, "9763"); System.setProperty(IdentityConstants.CarbonPlaceholders.CARBON_PORT_HTTPS_PROPERTY, "9443"); }
Example #3
Source Project: carbon-identity Author: wso2-attic File: UserProfileAdmin.java License: Apache License 2.0 | 6 votes |
/** * @return * @throws UserStoreException */ private Claim[] getAllSupportedClaims(UserRealm realm, String dialectUri) throws org.wso2.carbon.user.api.UserStoreException { ClaimMapping[] claims = null; List<Claim> reqClaims = null; claims = realm.getClaimManager().getAllSupportClaimMappingsByDefault(); reqClaims = new ArrayList<Claim>(); for (int i = 0; i < claims.length; i++) { if (dialectUri.equals(claims[i].getClaim().getDialectURI()) && (claims[i] != null && claims[i].getClaim().getDisplayTag() != null && !claims[i].getClaim().getClaimUri().equals(IdentityConstants.CLAIM_PPID))) { reqClaims.add((Claim) claims[i].getClaim()); } } return reqClaims.toArray(new Claim[reqClaims.size()]); }
Example #4
Source Project: carbon-identity Author: wso2-attic File: OpenIDProvider.java License: Apache License 2.0 | 6 votes |
/** * Configure the OpenID Provider's end-point URL */ private OpenIDProvider() { // This is the OpenID provider server URL opAddress = OpenIDUtil.getOpenIDServerURL(); // The URL which accepts OpenID Authentication requests, obtained by // performing discovery on the the User-Supplied Identifier. This value // must be an absolute URL manager.setOPEndpointUrl(opAddress); // default association expiry time is set to 15 minutes int assocExpiryTime = 15; String expiryTime = IdentityUtil.getProperty(IdentityConstants.ServerConfig.OPENID_ASSOCIATION_EXPIRY_TIME); if (expiryTime != null && !expiryTime.trim().isEmpty()) { try { assocExpiryTime = Integer.parseInt(expiryTime); } catch (NumberFormatException e) { log.warn("Error while setting association expiry time as " + expiryTime + ". Setting association expiry time to default ("+assocExpiryTime+")", e); } } manager.setExpireIn(assocExpiryTime); }
Example #5
Source Project: carbon-identity Author: wso2-attic File: OpenIDRememberMeTokenManager.java License: Apache License 2.0 | 6 votes |
/** * Checks if the rememberMe token is expired * * @param storedDo * @return */ private boolean isExpired(OpenIDRememberMeDO storedDo) { Timestamp timestamp = storedDo.getTimestamp(); String expiry = IdentityUtil.getProperty(IdentityConstants.ServerConfig.OPENID_REMEMBER_ME_EXPIRY); if (timestamp != null && expiry != null) { long t0 = timestamp.getTime(); long t1 = new Date().getTime(); long delta = Long.parseLong(expiry) * 1000 * 60; if (t1 - t0 > delta) { log.debug("Remember Me token expired for user " + storedDo.getUserName()); return true; } } return false; }
Example #6
Source Project: carbon-identity Author: wso2-attic File: IdentityProviderData.java License: Apache License 2.0 | 6 votes |
@Override public String getTenantDomain() throws IdentityProviderException { if (this.authMechanism == IdentityConstants.AUTH_TYPE_SELF_ISSUED) { //only for tenant 0 return null; } if (userIdentifier == null) { // auth type is not self issued and still the user identifier is null. // this is a invalid case throw new IllegalStateException("User identifier must NOT be null"); } String domain = null; domain = MultitenantUtils.getTenantDomain(userIdentifier); return domain; }
Example #7
Source Project: carbon-identity Author: wso2-attic File: IdentityProviderUtil.java License: Apache License 2.0 | 6 votes |
public static OMElement createDisplayClaim(OMElement parent, String displayTag, String displayValue, String uri) { OMElement claimElem = createOMElement(parent, IdentityConstants.NS, IdentityConstants.LocalNames.DISPLAY_CLAIM, IdentityConstants.PREFIX); claimElem.addAttribute("Uri", uri, null); OMElement tagElem = createOMElement(claimElem, IdentityConstants.NS, IdentityConstants.LocalNames.DISPLAY_TAG, IdentityConstants.PREFIX); tagElem.setText(displayTag); OMElement valElem = createOMElement(claimElem, IdentityConstants.NS, IdentityConstants.LocalNames.DISPLAY_VALUE, IdentityConstants.PREFIX); valElem.setText(displayValue); return claimElem; }
Example #8
Source Project: carbon-identity Author: wso2-attic File: SAMLSSOServiceProviderDO.java License: Apache License 2.0 | 6 votes |
public SAMLSSOServiceProviderDO() { if (StringUtils.isNotBlank(IdentityUtil.getProperty(IdentityConstants.ServerConfig .SSO_DEFAULT_SIGNING_ALGORITHM))) { signingAlgorithmUri = IdentityUtil.getProperty(IdentityConstants.ServerConfig .SSO_DEFAULT_SIGNING_ALGORITHM).trim(); } else { signingAlgorithmUri = IdentityCoreConstants.XML_SIGNATURE_ALGORITHM_RSA_SHA1_URI; } if (StringUtils.isNotBlank(IdentityUtil.getProperty(IdentityConstants.ServerConfig .SSO_DEFAULT_DIGEST_ALGORITHM))) { digestAlgorithmUri = IdentityUtil.getProperty(IdentityConstants.ServerConfig .SSO_DEFAULT_DIGEST_ALGORITHM).trim(); } else { digestAlgorithmUri = IdentityCoreConstants.XML_DIGEST_ALGORITHM_SHA1; } }
Example #9
Source Project: carbon-identity-framework Author: wso2 File: EntitlementEngine.java License: Apache License 2.0 | 5 votes |
/** * Test request for PDP * * @param xacmlRequest XACML request as String * @return response as String */ public String test(String xacmlRequest) { if (log.isDebugEnabled() && IdentityUtil.isTokenLoggable(IdentityConstants.IdentityTokens.XACML_REQUEST)) { log.debug("XACML Request : " + xacmlRequest); } String xacmlResponse = pdpTest.evaluate(xacmlRequest); if (log.isDebugEnabled() && IdentityUtil.isTokenLoggable(IdentityConstants.IdentityTokens.XACML_RESPONSE)) { log.debug("XACML Response : " + xacmlResponse); } return xacmlResponse; }
Example #10
Source Project: carbon-identity Author: wso2-attic File: SAMLSSOUtil.java License: Apache License 2.0 | 5 votes |
public static String getNotificationEndpoint(){ String redirectURL = IdentityUtil.getProperty(IdentityConstants.ServerConfig .NOTIFICATION_ENDPOINT); if (StringUtils.isBlank(redirectURL)){ redirectURL = IdentityUtil.getServerURL(SAMLSSOConstants.NOTIFICATION_ENDPOINT, false, false); } return redirectURL; }
Example #11
Source Project: carbon-identity-framework Author: wso2 File: IdentityApplicationManagementUtil.java License: Apache License 2.0 | 5 votes |
/** * @return the Signing Algorithm URI defined in configuration */ public static String getSigningAlgoURIByConfig() { if (StringUtils.isNotBlank(IdentityUtil.getProperty(IdentityConstants.ServerConfig .SSO_DEFAULT_SIGNING_ALGORITHM))) { return IdentityUtil.getProperty(IdentityConstants.ServerConfig.SSO_DEFAULT_SIGNING_ALGORITHM).trim(); } else { return IdentityApplicationConstants.XML.SignatureAlgorithmURI.RSA_SHA1; } }
Example #12
Source Project: carbon-identity-framework Author: wso2 File: IdentityApplicationManagementUtil.java License: Apache License 2.0 | 5 votes |
/** * @return the Digest Algorithm URI defined in configuration */ public static String getDigestAlgoURIByConfig() { if (StringUtils.isNotBlank(IdentityUtil.getProperty(IdentityConstants.ServerConfig .SSO_DEFAULT_DIGEST_ALGORITHM))) { return IdentityUtil.getProperty(IdentityConstants.ServerConfig.SSO_DEFAULT_DIGEST_ALGORITHM).trim(); } else { return IdentityApplicationConstants.XML.DigestAlgorithmURI.SHA1; } }
Example #13
Source Project: carbon-identity-framework Author: wso2 File: IdentityApplicationManagementUtil.java License: Apache License 2.0 | 5 votes |
/** * @return the Assertion Encryption Algorithm URI defined in configuration */ public static String getAssertionEncryptionAlgorithmURIByConfig() { if (StringUtils.isNotBlank(IdentityUtil.getProperty(IdentityConstants.ServerConfig .SSO_DEFAULT_ASSERTION_ENCRYPTION_ALGORITHM))) { return IdentityUtil.getProperty(IdentityConstants.ServerConfig.SSO_DEFAULT_ASSERTION_ENCRYPTION_ALGORITHM) .trim(); } else { return IdentityApplicationConstants.XML.AssertionEncryptionAlgorithmURI.AES256; } }
Example #14
Source Project: carbon-identity-framework Author: wso2 File: IdentityApplicationManagementUtil.java License: Apache License 2.0 | 5 votes |
/** * @return the Key Encryption Algorithm URI defined in configuration */ public static String getKeyEncryptionAlgorithmURIByConfig() { if (StringUtils.isNotBlank(IdentityUtil.getProperty(IdentityConstants.ServerConfig .SSO_DEFAULT_KEY_ENCRYPTION_ALGORITHM))) { return IdentityUtil.getProperty(IdentityConstants.ServerConfig.SSO_DEFAULT_KEY_ENCRYPTION_ALGORITHM).trim(); } else { return IdentityApplicationConstants.XML.KeyEncryptionAlgorithmURI.RSAOAEP; } }
Example #15
Source Project: carbon-identity-framework Author: wso2 File: SAMLSSOServiceProviderDO.java License: Apache License 2.0 | 5 votes |
public SAMLSSOServiceProviderDO() { if (StringUtils.isNotBlank(IdentityUtil.getProperty(IdentityConstants.ServerConfig .SSO_DEFAULT_SIGNING_ALGORITHM))) { signingAlgorithmUri = IdentityUtil.getProperty(IdentityConstants.ServerConfig .SSO_DEFAULT_SIGNING_ALGORITHM).trim(); } else { signingAlgorithmUri = IdentityCoreConstants.XML_SIGNATURE_ALGORITHM_RSA_SHA1_URI; } if (StringUtils.isNotBlank(IdentityUtil.getProperty(IdentityConstants.ServerConfig .SSO_DEFAULT_DIGEST_ALGORITHM))) { digestAlgorithmUri = IdentityUtil.getProperty(IdentityConstants.ServerConfig .SSO_DEFAULT_DIGEST_ALGORITHM).trim(); } else { digestAlgorithmUri = IdentityCoreConstants.XML_DIGEST_ALGORITHM_SHA1; } if (StringUtils.isNotBlank(IdentityUtil.getProperty(IdentityConstants.ServerConfig .SSO_DEFAULT_ASSERTION_ENCRYPTION_ALGORITHM))) { assertionEncryptionAlgorithmUri = IdentityUtil.getProperty(IdentityConstants.ServerConfig .SSO_DEFAULT_ASSERTION_ENCRYPTION_ALGORITHM).trim(); } else { assertionEncryptionAlgorithmUri = IdentityCoreConstants.XML_ASSERTION_ENCRYPTION_ALGORITHM_AES256; } if (StringUtils.isNotBlank(IdentityUtil.getProperty(IdentityConstants.ServerConfig .SSO_DEFAULT_KEY_ENCRYPTION_ALGORITHM))) { keyEncryptionAlgorithmUri = IdentityUtil.getProperty(IdentityConstants.ServerConfig .SSO_DEFAULT_KEY_ENCRYPTION_ALGORITHM).trim(); } else { keyEncryptionAlgorithmUri = IdentityCoreConstants.XML_KEY_ENCRYPTION_ALGORITHM_RSAOAEP; } }
Example #16
Source Project: carbon-identity-framework Author: wso2 File: IdentityLogTokenParser.java License: Apache License 2.0 | 5 votes |
private IdentityLogTokenParser() { boolean readProperties = Boolean .valueOf(System.getProperty(IdentityConstants.IdentityTokens.READ_LOG_TOKEN_PROPERTIES)); if (readProperties) { buildConfiguration(); } }
Example #17
Source Project: carbon-identity-framework Author: wso2 File: IdentityUtil.java License: Apache License 2.0 | 5 votes |
public static long getCleanUpTimeout() { String cleanUpTimeout = IdentityUtil.getProperty(IdentityConstants.ServerConfig.CLEAN_UP_TIMEOUT); if (StringUtils.isBlank(cleanUpTimeout)) { cleanUpTimeout = IdentityConstants.ServerConfig.CLEAN_UP_TIMEOUT_DEFAULT; } else if (!StringUtils.isNumeric(cleanUpTimeout)) { cleanUpTimeout = IdentityConstants.ServerConfig.CLEAN_UP_TIMEOUT_DEFAULT; } return Long.parseLong(cleanUpTimeout); }
Example #18
Source Project: carbon-identity Author: wso2-attic File: IdentityUtil.java License: Apache License 2.0 | 5 votes |
public static int getCleanUpPeriod(String tenantDomain) { String cleanUpPeriod = IdentityUtil.getProperty(IdentityConstants.ServerConfig.CLEAN_UP_PERIOD); if (StringUtils.isBlank(cleanUpPeriod)) { cleanUpPeriod = IdentityConstants.ServerConfig.CLEAN_UP_PERIOD_DEFAULT; } else if (!StringUtils.isNumeric(cleanUpPeriod)) { cleanUpPeriod = IdentityConstants.ServerConfig.CLEAN_UP_PERIOD_DEFAULT; } return Integer.parseInt(cleanUpPeriod); }
Example #19
Source Project: carbon-identity-framework Author: wso2 File: IdentityUtil.java License: Apache License 2.0 | 5 votes |
public static long getOperationCleanUpTimeout() { String cleanUpTimeout = IdentityUtil.getProperty(IdentityConstants.ServerConfig.OPERATION_CLEAN_UP_TIMEOUT); if (StringUtils.isBlank(cleanUpTimeout)) { cleanUpTimeout = IdentityConstants.ServerConfig.OPERATION_CLEAN_UP_TIMEOUT_DEFAULT; } else if (!StringUtils.isNumeric(cleanUpTimeout)) { cleanUpTimeout = IdentityConstants.ServerConfig.OPERATION_CLEAN_UP_TIMEOUT_DEFAULT; } return Long.parseLong(cleanUpTimeout); }
Example #20
Source Project: carbon-identity-framework Author: wso2 File: IdentityUtil.java License: Apache License 2.0 | 5 votes |
public static long getTempDataCleanUpTimeout() { String cleanUpTimeout = IdentityUtil.getProperty(IdentityConstants.ServerConfig.TEMP_DATA_CLEAN_UP_TIMEOUT); if (StringUtils.isBlank(cleanUpTimeout)) { cleanUpTimeout = IdentityConstants.ServerConfig.TEMP_DATA_CLEAN_UP_TIMEOUT_DEFAULT; } else if (!StringUtils.isNumeric(cleanUpTimeout)) { cleanUpTimeout = IdentityConstants.ServerConfig.TEMP_DATA_CLEAN_UP_TIMEOUT_DEFAULT; } return Long.parseLong(cleanUpTimeout); }
Example #21
Source Project: carbon-identity-framework Author: wso2 File: IdentityUtil.java License: Apache License 2.0 | 5 votes |
public static long getOperationCleanUpPeriod(String tenantDomain) { String cleanUpPeriod = IdentityUtil.getProperty(IdentityConstants.ServerConfig.OPERATION_CLEAN_UP_PERIOD); if (StringUtils.isBlank(cleanUpPeriod)) { cleanUpPeriod = IdentityConstants.ServerConfig.OPERATION_CLEAN_UP_PERIOD_DEFAULT; } else if (!StringUtils.isNumeric(cleanUpPeriod)) { cleanUpPeriod = IdentityConstants.ServerConfig.OPERATION_CLEAN_UP_PERIOD_DEFAULT; } return Long.parseLong(cleanUpPeriod); }
Example #22
Source Project: carbon-identity Author: wso2-attic File: SAMLSSOService.java License: Apache License 2.0 | 5 votes |
public static boolean isSAMLSSOLoginAccepted() { if (IdentityUtil.getProperty(IdentityConstants.ServerConfig.ACCEPT_SAMLSSO_LOGIN) != null && !"".equals(IdentityUtil.getProperty(IdentityConstants.ServerConfig.ACCEPT_SAMLSSO_LOGIN).trim())) { return Boolean.parseBoolean(IdentityUtil.getProperty(IdentityConstants.ServerConfig.ACCEPT_SAMLSSO_LOGIN).trim()); } else { return false; } }
Example #23
Source Project: carbon-identity-framework Author: wso2 File: IdentityUtil.java License: Apache License 2.0 | 5 votes |
/** * Get the server synchronization tolerance value in seconds * * @return clock skew in seconds */ public static int getClockSkewInSeconds() { String clockSkewConfigValue = IdentityUtil.getProperty(IdentityConstants.ServerConfig.CLOCK_SKEW); if (StringUtils.isBlank(clockSkewConfigValue) || !StringUtils.isNumeric(clockSkewConfigValue)) { clockSkewConfigValue = IdentityConstants.ServerConfig.CLOCK_SKEW_DEFAULT; } return Integer.parseInt(clockSkewConfigValue); }
Example #24
Source Project: carbon-identity-framework Author: wso2 File: IdentityUtil.java License: Apache License 2.0 | 5 votes |
/** * Get the server config for enabling federated user association * * @return isFederatedUserAssociationEnabled value */ public static boolean isFederatedUserAssociationEnabled() { String enableFedUserAssocicationConfigValue = IdentityUtil.getProperty( IdentityConstants.ServerConfig.ENABLE_FEDERATED_USER_ASSOCIATION); if (StringUtils.isBlank(enableFedUserAssocicationConfigValue)) { enableFedUserAssocicationConfigValue = IdentityConstants.ServerConfig.ENABLE_FEDERATED_USER_ASSOCIATION_DEFAULT; } return Boolean.parseBoolean(enableFedUserAssocicationConfigValue); }
Example #25
Source Project: carbon-identity-framework Author: wso2 File: IdentityUtilTest.java License: Apache License 2.0 | 5 votes |
@BeforeMethod public void setUp() throws Exception { mockStatic(CarbonUtils.class); mockStatic(ServerConfiguration.class); mockStatic(NetworkUtils.class); mockStatic(IdentityCoreServiceComponent.class); mockStatic(IdentityConfigParser.class); mockStatic(CarbonUtils.class); mockStatic(IdentityTenantUtil.class); when(ServerConfiguration.getInstance()).thenReturn(mockServerConfiguration); when(IdentityCoreServiceComponent.getConfigurationContextService()).thenReturn(mockConfigurationContextService); when(mockConfigurationContextService.getServerConfigContext()).thenReturn(mockConfigurationContext); when(mockConfigurationContext.getAxisConfiguration()).thenReturn(mockAxisConfiguration); when(IdentityTenantUtil.getRealmService()).thenReturn(mockRealmService); when(mockRealmService.getTenantManager()).thenReturn(mockTenantManager); when(CarbonUtils.getCarbonHome()).thenReturn("carbon.home"); when(mockRequest.getRemoteAddr()).thenReturn("127.0.0.1"); when(mockUserStoreManager.getRealmConfiguration()).thenReturn(mockRealmConfiguration); when(mockRealmService.getBootstrapRealmConfiguration()).thenReturn(mockRealmConfiguration); when(mockUserRealm.getUserStoreManager()).thenReturn(mockUserStoreManager); try { when(NetworkUtils.getLocalHostname()).thenReturn("localhost"); } catch (SocketException e) { // Mock behaviour, hence ignored } System.setProperty(IdentityConstants.CarbonPlaceholders.CARBON_PORT_HTTP_PROPERTY, "9763"); System.setProperty(IdentityConstants.CarbonPlaceholders.CARBON_PORT_HTTPS_PROPERTY, "9443"); }
Example #26
Source Project: carbon-identity-framework Author: wso2 File: IdentityUtilTest.java License: Apache License 2.0 | 5 votes |
@AfterMethod public void tearDown() throws Exception { System.clearProperty(IdentityConstants.CarbonPlaceholders.CARBON_PORT_HTTP_PROPERTY); System.clearProperty(IdentityConstants.CarbonPlaceholders.CARBON_PORT_HTTPS_PROPERTY); IdentityLogTokenParser.getInstance().getLogTokenMap().remove("authz"); IdentityLogTokenParser.getInstance().getLogTokenMap().remove("access"); }
Example #27
Source Project: carbon-identity-framework Author: wso2 File: IdentityUtilTest.java License: Apache License 2.0 | 5 votes |
@DataProvider public Object[][] getCleanUpTimeoutData() { long defaultVal = Long.parseLong(IdentityConstants.ServerConfig.CLEAN_UP_TIMEOUT_DEFAULT); return new Object[][]{ {"1000", 1000L}, {" ", defaultVal}, {"NotANumber", defaultVal}, }; }
Example #28
Source Project: carbon-identity-framework Author: wso2 File: IdentityUtilTest.java License: Apache License 2.0 | 5 votes |
@Test(dataProvider = "getCleanUpTimeoutData") public void testGetCleanUpTimeout(String value, long expected) throws Exception { Map<String, Object> mockConfiguration = new HashMap<>(); mockConfiguration.put(IdentityConstants.ServerConfig.CLEAN_UP_TIMEOUT, value); Whitebox.setInternalState(IdentityUtil.class, "configuration", mockConfiguration); assertEquals(IdentityUtil.getCleanUpTimeout(), expected, "Expected value mismatches returned for input: " + value); }
Example #29
Source Project: carbon-identity-framework Author: wso2 File: IdentityUtilTest.java License: Apache License 2.0 | 5 votes |
@DataProvider public Object[][] getCleanUpPeriodData() { long defaultVal = Long.parseLong(IdentityConstants.ServerConfig.CLEAN_UP_PERIOD_DEFAULT); return new Object[][]{ {"1000", 1000L}, {" ", defaultVal}, {"NotANumber", defaultVal}, }; }
Example #30
Source Project: carbon-identity-framework Author: wso2 File: IdentityUtilTest.java License: Apache License 2.0 | 5 votes |
@Test(dataProvider = "getCleanUpPeriodData") public void testGetCleanUpPeriod(String value, long expected) throws Exception { Map<String, Object> mockConfiguration = new HashMap<>(); mockConfiguration.put(IdentityConstants.ServerConfig.CLEAN_UP_PERIOD, value); Whitebox.setInternalState(IdentityUtil.class, "configuration", mockConfiguration); assertEquals(IdentityUtil.getCleanUpPeriod("ignoredParam"), expected, "Expected value mismatches returned " + "for input: " + value); }