// Path: spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/CloudEurekaClient.java
// public class CloudEurekaClient extends DiscoveryClient {
// 
// 	private static final Log log = LogFactory.getLog(CloudEurekaClient.class);
// 
// 	private final AtomicLong cacheRefreshedCount = new AtomicLong(0);
// 
// 	private ApplicationEventPublisher publisher;
// 
// 	private Field eurekaTransportField;
// 
// 	private ApplicationInfoManager applicationInfoManager;
// 
// 	private AtomicReference<EurekaHttpClient> eurekaHttpClient = new AtomicReference<>();
// 
// 	public CloudEurekaClient(ApplicationInfoManager applicationInfoManager, EurekaClientConfig config,
// 			ApplicationEventPublisher publisher) {
// 		this(applicationInfoManager, config, null, publisher);
// 	}
// 
// 	public CloudEurekaClient(ApplicationInfoManager applicationInfoManager, EurekaClientConfig config,
// 			AbstractDiscoveryClientOptionalArgs<?> args, ApplicationEventPublisher publisher) {
// 		super(applicationInfoManager, config, args);
// 		this.applicationInfoManager = applicationInfoManager;
// 		this.publisher = publisher;
// 		this.eurekaTransportField = ReflectionUtils.findField(DiscoveryClient.class, "eurekaTransport");
// 		ReflectionUtils.makeAccessible(this.eurekaTransportField);
// 	}
// 
// 	public ApplicationInfoManager getApplicationInfoManager() {
// 		return applicationInfoManager;
// 	}
// 
// 	public void cancelOverrideStatus(InstanceInfo info) {
// 		getEurekaHttpClient().deleteStatusOverride(info.getAppName(), info.getId(), info);
// 	}
// 
// 	public InstanceInfo getInstanceInfo(String appname, String instanceId) {
// 		EurekaHttpResponse<InstanceInfo> response = getEurekaHttpClient().getInstance(appname, instanceId);
// 		HttpStatus httpStatus = HttpStatus.valueOf(response.getStatusCode());
// 		if (httpStatus.is2xxSuccessful() && response.getEntity() != null) {
// 			return response.getEntity();
// 		}
// 		return null;
// 	}
// 
// 	EurekaHttpClient getEurekaHttpClient() {
// 		if (this.eurekaHttpClient.get() == null) {
// 			try {
// 				Object eurekaTransport = this.eurekaTransportField.get(this);
// 				Field registrationClientField = ReflectionUtils.findField(eurekaTransport.getClass(),
// 						"registrationClient");
// 				ReflectionUtils.makeAccessible(registrationClientField);
// 				this.eurekaHttpClient.compareAndSet(null,
// 						(EurekaHttpClient) registrationClientField.get(eurekaTransport));
// 			}
// 			catch (IllegalAccessException e) {
// 				log.error("error getting EurekaHttpClient", e);
// 			}
// 		}
// 		return this.eurekaHttpClient.get();
// 	}
// 
// 	public void setStatus(InstanceStatus newStatus, InstanceInfo info) {
// 		getEurekaHttpClient().statusUpdate(info.getAppName(), info.getId(), newStatus, info);
// 	}
// 
// 	@Override
// 	protected void onCacheRefreshed() {
// 		super.onCacheRefreshed();
// 
// 		if (this.cacheRefreshedCount != null) { // might be called during construction and
// 			// will be null
// 			long newCount = this.cacheRefreshedCount.incrementAndGet();
// 			log.trace("onCacheRefreshed called with count: " + newCount);
// 			this.publisher.publishEvent(new HeartbeatEvent(this, newCount));
// 		}
// 	}
// 
// }


import com.netflix.discovery.EurekaClient;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.cloud.netflix.eureka.CloudEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.RestController;
import static org.mockito.Mockito.mock;
/*
 * Copyright 2017-2022 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 org.springframework.cloud.netflix.eureka.sample;




/**
 * @author Ryan Baxter
 */
@SpringBootConfiguration(proxyBeanMethods = false)
@EnableAutoConfiguration
@RestController
public class RefreshEurekaSampleApplication {

	@Bean
	public EurekaClient getClient() {
// Path: spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/CloudEurekaClient.java
// public class CloudEurekaClient extends DiscoveryClient {
// 
// 	private static final Log log = LogFactory.getLog(CloudEurekaClient.class);
// 
// 	private final AtomicLong cacheRefreshedCount = new AtomicLong(0);
// 
// 	private ApplicationEventPublisher publisher;
// 
// 	private Field eurekaTransportField;
// 
// 	private ApplicationInfoManager applicationInfoManager;
// 
// 	private AtomicReference<EurekaHttpClient> eurekaHttpClient = new AtomicReference<>();
// 
// 	public CloudEurekaClient(ApplicationInfoManager applicationInfoManager, EurekaClientConfig config,
// 			ApplicationEventPublisher publisher) {
// 		this(applicationInfoManager, config, null, publisher);
// 	}
// 
// 	public CloudEurekaClient(ApplicationInfoManager applicationInfoManager, EurekaClientConfig config,
// 			AbstractDiscoveryClientOptionalArgs<?> args, ApplicationEventPublisher publisher) {
// 		super(applicationInfoManager, config, args);
// 		this.applicationInfoManager = applicationInfoManager;
// 		this.publisher = publisher;
// 		this.eurekaTransportField = ReflectionUtils.findField(DiscoveryClient.class, "eurekaTransport");
// 		ReflectionUtils.makeAccessible(this.eurekaTransportField);
// 	}
// 
// 	public ApplicationInfoManager getApplicationInfoManager() {
// 		return applicationInfoManager;
// 	}
// 
// 	public void cancelOverrideStatus(InstanceInfo info) {
// 		getEurekaHttpClient().deleteStatusOverride(info.getAppName(), info.getId(), info);
// 	}
// 
// 	public InstanceInfo getInstanceInfo(String appname, String instanceId) {
// 		EurekaHttpResponse<InstanceInfo> response = getEurekaHttpClient().getInstance(appname, instanceId);
// 		HttpStatus httpStatus = HttpStatus.valueOf(response.getStatusCode());
// 		if (httpStatus.is2xxSuccessful() && response.getEntity() != null) {
// 			return response.getEntity();
// 		}
// 		return null;
// 	}
// 
// 	EurekaHttpClient getEurekaHttpClient() {
// 		if (this.eurekaHttpClient.get() == null) {
// 			try {
// 				Object eurekaTransport = this.eurekaTransportField.get(this);
// 				Field registrationClientField = ReflectionUtils.findField(eurekaTransport.getClass(),
// 						"registrationClient");
// 				ReflectionUtils.makeAccessible(registrationClientField);
// 				this.eurekaHttpClient.compareAndSet(null,
// 						(EurekaHttpClient) registrationClientField.get(eurekaTransport));
// 			}
// 			catch (IllegalAccessException e) {
// 				log.error("error getting EurekaHttpClient", e);
// 			}
// 		}
// 		return this.eurekaHttpClient.get();
// 	}
// 
// 	public void setStatus(InstanceStatus newStatus, InstanceInfo info) {
// 		getEurekaHttpClient().statusUpdate(info.getAppName(), info.getId(), newStatus, info);
// 	}
// 
// 	@Override
// 	protected void onCacheRefreshed() {
// 		super.onCacheRefreshed();
// 
// 		if (this.cacheRefreshedCount != null) { // might be called during construction and
// 			// will be null
// 			long newCount = this.cacheRefreshedCount.incrementAndGet();
// 			log.trace("onCacheRefreshed called with count: " + newCount);
// 			this.publisher.publishEvent(new HeartbeatEvent(this, newCount));
// 		}
// 	}
// 
// }


// Path: spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/sample/RefreshEurekaSampleApplication.java
import com.netflix.discovery.EurekaClient;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.cloud.netflix.eureka.CloudEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.RestController;
import static org.mockito.Mockito.mock;

/*
 * Copyright 2017-2022 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 org.springframework.cloud.netflix.eureka.sample;




/**
 * @author Ryan Baxter
 */
@SpringBootConfiguration(proxyBeanMethods = false)
@EnableAutoConfiguration
@RestController
public class RefreshEurekaSampleApplication {

	@Bean
	public EurekaClient getClient() {
		return mock(CloudEurekaClient.class);