869a36e2649ae064c98063cf1e55198488d78d12Allan Foster/**
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster *
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * Copyright (c) 2009 Sun Microsystems Inc. All Rights Reserved
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster *
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * The contents of this file are subject to the terms
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * of the Common Development and Distribution License
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * (the License). You may not use this file except in
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * compliance with the License.
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster *
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * You can obtain a copy of the License at
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * https://opensso.dev.java.net/public/CDDLv1.0.html or
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * opensso/legal/CDDLv1.0.txt
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * See the License for the specific language governing
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * permission and limitations under the License.
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster *
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * When distributing Covered Code, include this CDDL
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * Header Notice in each file and include the License file
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * at opensso/legal/CDDLv1.0.txt.
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * If applicable, add the following below the CDDL Header,
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * with the fields enclosed by brackets [] replaced by
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * your own identifying information:
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * "Portions Copyrighted [year] [name of copyright owner]"
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster *
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster * $Id: EntitlementServiceTest.java,v 1.1 2009/08/19 05:41:01 veiming Exp $
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster */
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster
869a36e2649ae064c98063cf1e55198488d78d12Allan Fosterpackage com.sun.identity.entitlement.opensso;
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster
869a36e2649ae064c98063cf1e55198488d78d12Allan Fosterimport com.iplanet.sso.SSOToken;
869a36e2649ae064c98063cf1e55198488d78d12Allan Fosterimport com.sun.identity.entitlement.EntitlementConfiguration;
869a36e2649ae064c98063cf1e55198488d78d12Allan Fosterimport com.sun.identity.security.AdminTokenAction;
869a36e2649ae064c98063cf1e55198488d78d12Allan Fosterimport com.sun.identity.unittest.UnittestLog;
869a36e2649ae064c98063cf1e55198488d78d12Allan Fosterimport java.security.AccessController;
869a36e2649ae064c98063cf1e55198488d78d12Allan Fosterimport org.testng.annotations.Test;
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster
869a36e2649ae064c98063cf1e55198488d78d12Allan Fosterpublic class EntitlementServiceTest {
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster @Test
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster public void hasEntitlementDITs() {
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster SSOToken adminToken = (SSOToken) AccessController.doPrivileged(
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster AdminTokenAction.getInstance());
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster EntitlementConfiguration ec = EntitlementConfiguration.getInstance(
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster SubjectUtils.createSubject(adminToken), "/");
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster boolean result = ec.hasEntitlementDITs();
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster UnittestLog.logMessage(
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster "EntitlementServiceTest.hasEntitlementDITs: returns " + result);
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster }
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster @Test
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster public void migratedToEntitlementService() {
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster SSOToken adminToken = (SSOToken) AccessController.doPrivileged(
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster AdminTokenAction.getInstance());
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster EntitlementConfiguration ec = EntitlementConfiguration.getInstance(
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster SubjectUtils.createSubject(adminToken), "/");
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster boolean result = ec.migratedToEntitlementService();
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster UnittestLog.logMessage(
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster "EntitlementServiceTest.migratedToEntitlementService: returns " +
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster result);
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster }
869a36e2649ae064c98063cf1e55198488d78d12Allan Foster}