Search in sources :

Example 1 with AppInstanceScanner

use of org.cloudfoundry.promregator.scanner.AppInstanceScanner in project promregator by promregator.

the class MockedMetricsEndpointSpringApplication method appInstanceScanner.

@Bean
public AppInstanceScanner appInstanceScanner() {
    return new AppInstanceScanner() {

        @Override
        public List<Instance> determineInstancesFromTargets(List<Target> targets) {
            LinkedList<Instance> result = new LinkedList<>();
            Target t = new Target();
            t.setOrgName("unittestorg");
            t.setSpaceName("unittestspace");
            t.setApplicationName("unittestapp");
            t.setPath("/path");
            t.setProtocol("https");
            result.add(new Instance(t, "faedbb0a-2273-4cb4-a659-bd31331f7daf:0", "http://localhost:1234"));
            result.add(new Instance(t, "faedbb0a-2273-4cb4-a659-bd31331f7daf:1", "http://localhost:1234"));
            t = new Target();
            t.setOrgName("unittestorg");
            t.setSpaceName("unittestspace");
            t.setApplicationName("unittestapp2");
            t.setPath("/otherpath");
            t.setProtocol("http");
            result.add(new Instance(t, "1142a717-e27d-4028-89d8-b42a0c973300:0", "http://localhost:1235"));
            return result;
        }
    };
}
Also used : AppInstanceScanner(org.cloudfoundry.promregator.scanner.AppInstanceScanner) Target(org.cloudfoundry.promregator.config.Target) Instance(org.cloudfoundry.promregator.scanner.Instance) List(java.util.List) LinkedList(java.util.LinkedList) LinkedList(java.util.LinkedList) Bean(org.springframework.context.annotation.Bean)

Aggregations

LinkedList (java.util.LinkedList)1 List (java.util.List)1 Target (org.cloudfoundry.promregator.config.Target)1 AppInstanceScanner (org.cloudfoundry.promregator.scanner.AppInstanceScanner)1 Instance (org.cloudfoundry.promregator.scanner.Instance)1 Bean (org.springframework.context.annotation.Bean)1