// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java
// public static final Integer MAX_SERIES_IN_STUDY = VALUE_PARAM_MAX_LIMIT_FOR_SERIES * 3;
// 
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java
// public static final Integer MAX_STUDIES_IN_DICOM_STORE = VALUE_PARAM_MAX_LIMIT_FOR_STUDY * 3;
// 
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java
// public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_INSTANCES = 15000; // max - 50 000 results
// 
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java
// public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_SERIES = 5000;
// 
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java
// public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_STUDY = 5000;
// 
// Path: src/main/java/com/google/dicomwebfuse/auth/AuthAdc.java
// public class AuthAdc {
// 
//   private static final List<String> SCOPES = Collections.singletonList(
//       "https://www.googleapis.com/auth/cloud-healthcare"
//   );
//   private GoogleCredentials googleCredentials;
// 
//   public AuthAdc(GoogleCredentials googleCredentials) {
//     this.googleCredentials = googleCredentials;
//   }
// 
//   public AuthAdc() {
//   }
// 
//   public void createCredentials(Path keyPath) throws IOException {
//     InputStream inputStream = new FileInputStream(keyPath.toFile());
//     googleCredentials = GoogleCredentials.fromStream(inputStream).createScoped(SCOPES);
//   }
// 
//   public void createCredentials() throws IOException {
//     googleCredentials = GoogleCredentials.getApplicationDefault().createScoped(SCOPES);
//   }
// 
//   public GoogleCredentials getCredentials() throws IOException {
//     googleCredentials.getRequestMetadata(); // Update token if it necessary.
//     return googleCredentials;
//   }
// }
// 
// Path: src/main/java/com/google/dicomwebfuse/dao/http/HttpClientFactory.java
// public interface HttpClientFactory {
// 
//   CloseableHttpClient createHttpClient();
// }
// 
// Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java
// public class DicomFuseException extends Exception {
// 
//   private int statusCode;
// 
//   public DicomFuseException(String message) {
//     super(message);
//   }
// 
//   public DicomFuseException(String message, Exception e) {
//     super(message, e);
//   }
// 
//   public DicomFuseException(Exception e) {
//     super(e);
//   }
// 
//   public DicomFuseException(String message, int statusCode) {
//     super(message);
//     this.statusCode = statusCode;
//   }
// 
//   public int getStatusCode() {
//     return statusCode;
//   }
// }


import static com.google.dicomwebfuse.EntityType.DICOM_STORE;
import static com.google.dicomwebfuse.dao.Constants.MAX_INSTANCES_IN_SERIES;
import static com.google.dicomwebfuse.dao.Constants.MAX_SERIES_IN_STUDY;
import static com.google.dicomwebfuse.dao.Constants.MAX_STUDIES_IN_DICOM_STORE;
import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_INSTANCES;
import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_SERIES;
import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_STUDY;
import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.auth.oauth2.AccessToken;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.dicomwebfuse.auth.AuthAdc;
import com.google.dicomwebfuse.dao.http.HttpClientFactory;
import com.google.dicomwebfuse.exception.DicomFuseException;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.apache.http.ProtocolVersion;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.entity.BasicHttpEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.message.BasicStatusLine;
import org.mockito.ArgumentMatchers;
import org.mockito.Mockito;
    GoogleCredentials googleCredentials = GoogleCredentials.create(accessToken);
    return new AuthAdc(googleCredentials);
  }

  /**
   * Generates http entities list.
   *
   * @param entityCount how many entities would be generated
   * @param offset start offset
   * @param entityType  type of entity
   */
  private static List<BasicHttpEntity> prepareHttpEntities(int entityCount, int offset, EntityType entityType)
      throws DicomFuseException {
    List<BasicHttpEntity> basicHttpEntities = new ArrayList<>();
    int entityLimit;
    int maxEntities;
    switch (entityType) {
      case DICOM_STORE:
        entityLimit = 100;
        maxEntities = 100;
        break;
      case STUDY:
        entityLimit = VALUE_PARAM_MAX_LIMIT_FOR_STUDY;
        maxEntities = MAX_STUDIES_IN_DICOM_STORE;
        break;
      case SERIES:
        entityLimit = VALUE_PARAM_MAX_LIMIT_FOR_SERIES;
        maxEntities = MAX_SERIES_IN_STUDY;
        break;
      case INSTANCE:
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java
// public static final Integer MAX_SERIES_IN_STUDY = VALUE_PARAM_MAX_LIMIT_FOR_SERIES * 3;
// 
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java
// public static final Integer MAX_STUDIES_IN_DICOM_STORE = VALUE_PARAM_MAX_LIMIT_FOR_STUDY * 3;
// 
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java
// public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_INSTANCES = 15000; // max - 50 000 results
// 
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java
// public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_SERIES = 5000;
// 
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java
// public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_STUDY = 5000;
// 
// Path: src/main/java/com/google/dicomwebfuse/auth/AuthAdc.java
// public class AuthAdc {
// 
//   private static final List<String> SCOPES = Collections.singletonList(
//       "https://www.googleapis.com/auth/cloud-healthcare"
//   );
//   private GoogleCredentials googleCredentials;
// 
//   public AuthAdc(GoogleCredentials googleCredentials) {
//     this.googleCredentials = googleCredentials;
//   }
// 
//   public AuthAdc() {
//   }
// 
//   public void createCredentials(Path keyPath) throws IOException {
//     InputStream inputStream = new FileInputStream(keyPath.toFile());
//     googleCredentials = GoogleCredentials.fromStream(inputStream).createScoped(SCOPES);
//   }
// 
//   public void createCredentials() throws IOException {
//     googleCredentials = GoogleCredentials.getApplicationDefault().createScoped(SCOPES);
//   }
// 
//   public GoogleCredentials getCredentials() throws IOException {
//     googleCredentials.getRequestMetadata(); // Update token if it necessary.
//     return googleCredentials;
//   }
// }
// 
// Path: src/main/java/com/google/dicomwebfuse/dao/http/HttpClientFactory.java
// public interface HttpClientFactory {
// 
//   CloseableHttpClient createHttpClient();
// }
// 
// Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java
// public class DicomFuseException extends Exception {
// 
//   private int statusCode;
// 
//   public DicomFuseException(String message) {
//     super(message);
//   }
// 
//   public DicomFuseException(String message, Exception e) {
//     super(message, e);
//   }
// 
//   public DicomFuseException(Exception e) {
//     super(e);
//   }
// 
//   public DicomFuseException(String message, int statusCode) {
//     super(message);
//     this.statusCode = statusCode;
//   }
// 
//   public int getStatusCode() {
//     return statusCode;
//   }
// }


// Path: src/test/java/com/google/dicomwebfuse/TestUtils.java
import static com.google.dicomwebfuse.EntityType.DICOM_STORE;
import static com.google.dicomwebfuse.dao.Constants.MAX_INSTANCES_IN_SERIES;
import static com.google.dicomwebfuse.dao.Constants.MAX_SERIES_IN_STUDY;
import static com.google.dicomwebfuse.dao.Constants.MAX_STUDIES_IN_DICOM_STORE;
import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_INSTANCES;
import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_SERIES;
import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_STUDY;
import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.auth.oauth2.AccessToken;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.dicomwebfuse.auth.AuthAdc;
import com.google.dicomwebfuse.dao.http.HttpClientFactory;
import com.google.dicomwebfuse.exception.DicomFuseException;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.apache.http.ProtocolVersion;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.entity.BasicHttpEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.message.BasicStatusLine;
import org.mockito.ArgumentMatchers;
import org.mockito.Mockito;

    GoogleCredentials googleCredentials = GoogleCredentials.create(accessToken);
    return new AuthAdc(googleCredentials);
  }

  /**
   * Generates http entities list.
   *
   * @param entityCount how many entities would be generated
   * @param offset start offset
   * @param entityType  type of entity
   */
  private static List<BasicHttpEntity> prepareHttpEntities(int entityCount, int offset, EntityType entityType)
      throws DicomFuseException {
    List<BasicHttpEntity> basicHttpEntities = new ArrayList<>();
    int entityLimit;
    int maxEntities;
    switch (entityType) {
      case DICOM_STORE:
        entityLimit = 100;
        maxEntities = 100;
        break;
      case STUDY:
        entityLimit = VALUE_PARAM_MAX_LIMIT_FOR_STUDY;
        maxEntities = MAX_STUDIES_IN_DICOM_STORE;
        break;
      case SERIES:
        entityLimit = VALUE_PARAM_MAX_LIMIT_FOR_SERIES;
        maxEntities = MAX_SERIES_IN_STUDY;
        break;
      case INSTANCE:
        entityLimit = VALUE_PARAM_MAX_LIMIT_FOR_INSTANCES;