// Path: test/com/google/enterprise/adaptor/sharepoint/FormsAuthenticationHandlerTest.java
// static class MockScheduledExecutor 
//     extends UnsupportedScheduledExecutor {
//   long executionDelay;
//   TimeUnit executionTimeUnit;   
//     
//   @Override
//   public ScheduledFuture<?> schedule(Runnable command, long delay,
//       TimeUnit unit) {
//     executionDelay = delay;
//     executionTimeUnit = unit;
//     return null;
//   }
// }
// 
// Path: src/com/google/enterprise/adaptor/sharepoint/SamlAuthenticationHandler.java
// @VisibleForTesting
// public interface HttpPostClient {
//   public PostResponseInfo issuePostRequest(URL url,
//       Map<String, String> connectionProperties, String requestBody)
//       throws IOException;
// }
// 
// Path: src/com/google/enterprise/adaptor/sharepoint/SamlAuthenticationHandler.java
// @VisibleForTesting
// public static class PostResponseInfo {
//   /** Non-null contents. */
//   private final String contents;
//   /** Non-null headers. */
//   private final Map<String, List<String>> headers;
// 
//   PostResponseInfo(
//       String contents, Map<String, List<String>> headers) {
//     this.contents = contents;
//     this.headers  = (headers == null)
//         ? new HashMap<String, List<String>>() 
//         : new HashMap<String, List<String>>(headers);
//   }
// 
//   public String getPostContents() {
//     return contents;
//   }
// 
//   public Map<String, List<String>> getPostResponseHeaders() {
//     return Collections.unmodifiableMap(headers);
//   }
// 
//   public String getPostResponseHeaderField(String header) {
//     if (headers == null || !headers.containsKey(header)) {
//       return null;
//     }
//     if (headers.get(header) == null || headers.get(header).isEmpty()) {
//       return null;
//     }
//     StringBuilder sbValues = new StringBuilder();
//     for(String value : headers.get(header)) {
//       if ("".equals(value)) {
//         continue;
//       }
//       sbValues.append(value);
//       sbValues.append(";");
//     }
//     return sbValues.toString();
//   }
// }


import org.junit.rules.ExpectedException;
import static org.junit.Assert.assertEquals;
import com.google.enterprise.adaptor.sharepoint.FormsAuthenticationHandlerTest.MockScheduledExecutor;
import com.google.enterprise.adaptor.sharepoint.SamlAuthenticationHandler.HttpPostClient;
import com.google.enterprise.adaptor.sharepoint.SamlAuthenticationHandler.PostResponseInfo;
import java.io.IOException;
import java.net.URL;
import java.net.URLEncoder;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.Rule;
import org.junit.Test;
// Copyright 2014 Google Inc. All Rights Reserved.
//
// 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.google.enterprise.adaptor.sharepoint;






public class AdfsHandshakeManagerTest {
  
  @Rule
  public ExpectedException thrown = ExpectedException.none();
  
  private static class UnsupportedHttpPostClient implements HttpPostClient {
    @Override
    public SamlAuthenticationHandler.PostResponseInfo issuePostRequest(
        URL url, Map<String, String> connectionProperties, String requestBody)
        throws IOException {
      throw new UnsupportedOperationException();
    }    
  }
  
// Path: test/com/google/enterprise/adaptor/sharepoint/FormsAuthenticationHandlerTest.java
// static class MockScheduledExecutor 
//     extends UnsupportedScheduledExecutor {
//   long executionDelay;
//   TimeUnit executionTimeUnit;   
//     
//   @Override
//   public ScheduledFuture<?> schedule(Runnable command, long delay,
//       TimeUnit unit) {
//     executionDelay = delay;
//     executionTimeUnit = unit;
//     return null;
//   }
// }
// 
// Path: src/com/google/enterprise/adaptor/sharepoint/SamlAuthenticationHandler.java
// @VisibleForTesting
// public interface HttpPostClient {
//   public PostResponseInfo issuePostRequest(URL url,
//       Map<String, String> connectionProperties, String requestBody)
//       throws IOException;
// }
// 
// Path: src/com/google/enterprise/adaptor/sharepoint/SamlAuthenticationHandler.java
// @VisibleForTesting
// public static class PostResponseInfo {
//   /** Non-null contents. */
//   private final String contents;
//   /** Non-null headers. */
//   private final Map<String, List<String>> headers;
// 
//   PostResponseInfo(
//       String contents, Map<String, List<String>> headers) {
//     this.contents = contents;
//     this.headers  = (headers == null)
//         ? new HashMap<String, List<String>>() 
//         : new HashMap<String, List<String>>(headers);
//   }
// 
//   public String getPostContents() {
//     return contents;
//   }
// 
//   public Map<String, List<String>> getPostResponseHeaders() {
//     return Collections.unmodifiableMap(headers);
//   }
// 
//   public String getPostResponseHeaderField(String header) {
//     if (headers == null || !headers.containsKey(header)) {
//       return null;
//     }
//     if (headers.get(header) == null || headers.get(header).isEmpty()) {
//       return null;
//     }
//     StringBuilder sbValues = new StringBuilder();
//     for(String value : headers.get(header)) {
//       if ("".equals(value)) {
//         continue;
//       }
//       sbValues.append(value);
//       sbValues.append(";");
//     }
//     return sbValues.toString();
//   }
// }


// Path: test/com/google/enterprise/adaptor/sharepoint/AdfsHandshakeManagerTest.java
import org.junit.rules.ExpectedException;
import static org.junit.Assert.assertEquals;
import com.google.enterprise.adaptor.sharepoint.FormsAuthenticationHandlerTest.MockScheduledExecutor;
import com.google.enterprise.adaptor.sharepoint.SamlAuthenticationHandler.HttpPostClient;
import com.google.enterprise.adaptor.sharepoint.SamlAuthenticationHandler.PostResponseInfo;
import java.io.IOException;
import java.net.URL;
import java.net.URLEncoder;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.Rule;
import org.junit.Test;

// Copyright 2014 Google Inc. All Rights Reserved.
//
// 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.google.enterprise.adaptor.sharepoint;






public class AdfsHandshakeManagerTest {
  
  @Rule
  public ExpectedException thrown = ExpectedException.none();
  
  private static class UnsupportedHttpPostClient implements HttpPostClient {
    @Override
    public SamlAuthenticationHandler.PostResponseInfo issuePostRequest(
        URL url, Map<String, String> connectionProperties, String requestBody)
        throws IOException {
      throw new UnsupportedOperationException();
    }    
  }
  
  private static class MockHttpPostClient implements HttpPostClient {