// Path: spring-cloud-services-connector-core/src/main/java/io/pivotal/spring/cloud/service/common/ConfigServerServiceInfo.java
// public class ConfigServerServiceInfo extends UriBasedServiceInfo {
// 	private String clientId;
// 	private String clientSecret;
// 	private String accessTokenUri;
// 
// 	public ConfigServerServiceInfo(String id, String uriString, String clientId, String clientSecret, String accessTokenUri) {
// 		super(id, uriString);
// 		this.clientId = clientId;
// 		this.clientSecret = clientSecret;
// 		this.accessTokenUri = accessTokenUri;
// 	}
// 
// 	public String getClientId() {
// 		return clientId;
// 	}
// 
// 	public String getClientSecret() {
// 		return clientSecret;
// 	}
// 
// 	public String getAccessTokenUri() {
// 		return accessTokenUri;
// 	}
// }


import org.junit.Assert;
import org.junit.Test;
import org.springframework.cloud.cloudfoundry.AbstractCloudFoundryConnectorTest;
import org.springframework.cloud.service.ServiceInfo;
import io.pivotal.spring.cloud.service.common.ConfigServerServiceInfo;
import java.util.List;
import static org.mockito.Mockito.when;
/*
 * Copyright 2015 the original author or authors.
 *
 * 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
 *
 *      https://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 io.pivotal.spring.cloud.cloudfoundry;




/**
 * Connector tests for Config Server services
 *
 * @author Chris Schaefer
 */
public class ConfigServerServiceInfoCreatorTest extends AbstractCloudFoundryConnectorTest {
	private static final String CONFIG_SERVER_SERVICE_TAG_NAME = "myConfigServerService";
	private static final String VCAP_SERVICES_ENV_KEY = "VCAP_SERVICES";
	private static final String PAYLOAD_FILE_NAME = "test-config-server-info.json";
	private static final String PAYLOAD_TEMPLATE_SERVICE_NAME = "$serviceName";
	private static final String PAYLOAD_TEMPLATE_HOSTNAME = "$hostname";
	private static final String PAYLOAD_TEMPLATE_PORT = "$port";
	private static final String PAYLOAD_TEMPLATE_USER = "$user";
	private static final String PAYLOAD_TEMPLATE_PASS = "$pass";

	@Test
	public void configServerServiceCreationWithTags() {
		when(mockEnvironment.getEnvValue(VCAP_SERVICES_ENV_KEY))
				.thenReturn(getServicesPayload(getConfigServerServicePayload(CONFIG_SERVER_SERVICE_TAG_NAME,
						hostname, port, username, password)));

		List<ServiceInfo> serviceInfos = testCloudConnector.getServiceInfos();
// Path: spring-cloud-services-connector-core/src/main/java/io/pivotal/spring/cloud/service/common/ConfigServerServiceInfo.java
// public class ConfigServerServiceInfo extends UriBasedServiceInfo {
// 	private String clientId;
// 	private String clientSecret;
// 	private String accessTokenUri;
// 
// 	public ConfigServerServiceInfo(String id, String uriString, String clientId, String clientSecret, String accessTokenUri) {
// 		super(id, uriString);
// 		this.clientId = clientId;
// 		this.clientSecret = clientSecret;
// 		this.accessTokenUri = accessTokenUri;
// 	}
// 
// 	public String getClientId() {
// 		return clientId;
// 	}
// 
// 	public String getClientSecret() {
// 		return clientSecret;
// 	}
// 
// 	public String getAccessTokenUri() {
// 		return accessTokenUri;
// 	}
// }


// Path: spring-cloud-services-cloudfoundry-connector/src/test/java/io/pivotal/spring/cloud/cloudfoundry/ConfigServerServiceInfoCreatorTest.java
import org.junit.Assert;
import org.junit.Test;
import org.springframework.cloud.cloudfoundry.AbstractCloudFoundryConnectorTest;
import org.springframework.cloud.service.ServiceInfo;
import io.pivotal.spring.cloud.service.common.ConfigServerServiceInfo;
import java.util.List;
import static org.mockito.Mockito.when;

/*
 * Copyright 2015 the original author or authors.
 *
 * 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
 *
 *      https://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 io.pivotal.spring.cloud.cloudfoundry;




/**
 * Connector tests for Config Server services
 *
 * @author Chris Schaefer
 */
public class ConfigServerServiceInfoCreatorTest extends AbstractCloudFoundryConnectorTest {
	private static final String CONFIG_SERVER_SERVICE_TAG_NAME = "myConfigServerService";
	private static final String VCAP_SERVICES_ENV_KEY = "VCAP_SERVICES";
	private static final String PAYLOAD_FILE_NAME = "test-config-server-info.json";
	private static final String PAYLOAD_TEMPLATE_SERVICE_NAME = "$serviceName";
	private static final String PAYLOAD_TEMPLATE_HOSTNAME = "$hostname";
	private static final String PAYLOAD_TEMPLATE_PORT = "$port";
	private static final String PAYLOAD_TEMPLATE_USER = "$user";
	private static final String PAYLOAD_TEMPLATE_PASS = "$pass";

	@Test
	public void configServerServiceCreationWithTags() {
		when(mockEnvironment.getEnvValue(VCAP_SERVICES_ENV_KEY))
				.thenReturn(getServicesPayload(getConfigServerServicePayload(CONFIG_SERVER_SERVICE_TAG_NAME,
						hostname, port, username, password)));

		List<ServiceInfo> serviceInfos = testCloudConnector.getServiceInfos();
		assertServiceFoundOfType(serviceInfos, CONFIG_SERVER_SERVICE_TAG_NAME, ConfigServerServiceInfo.class);