//========================================================================
//Copyright 2007-2008 David Yu dyuproject@gmail.com
//------------------------------------------------------------------------
//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at 
//http://www.apache.org/licenses/LICENSE-2.0
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.
//========================================================================

package com.dyuproject.openid;

import junit.framework.TestCase;

/**
 * @author David Yu
 * @created Sep 20, 2008
 */

public class HtmlBasedDiscoveryTest extends TestCase
{
    
    public void testDiscovery() throws Exception
    {        
        OpenIdContext context = new OpenIdContext();
        context.setHttpConnector(new SimpleHttpConnector());
        context.setDiscovery(new HtmlBasedDiscovery());
        Identifier identifier = Identifier.getIdentifier("http://davidyu.myopenid.com", null, context);
        OpenIdUser user = context.getDiscovery().discover(identifier, context);
        assertTrue(user!=null && user.getOpenIdServer()!=null);
    }

}

@@ -1509,14 +1509,631 @@
 %0D%0A    %7D%0D
+%0A    %0D%0A    public void testDiscoveryWithCDATA() throws Exception%0D%0A    %7B        %0D%0A        OpenIdContext context = new OpenIdContext();%0D%0A        context.setHttpConnector(new SimpleHttpConnector());%0D%0A        context.setDiscovery(new HtmlBasedDiscovery());%0D%0A        Identifier identifier = Identifier.getIdentifier(%22http://ct15.wordpress.com%22, null, context);%0D%0A        OpenIdUser user = context.getDiscovery().discover(identifier, context);%0D%0A        assertTrue(user!=null && user.getOpenIdServer()!=null);%0D%0A        System.err.println(user.getOpenIdServer());%0D%0A        System.err.println(user.getOpenIdDelegate());%0D%0A    %7D%0D
 %0A%0D%0A%7D%0D%0A

test for CDATA