org.springframework.cloud.service.BaseServiceInfo Java Examples

The following examples show how to use org.springframework.cloud.service.BaseServiceInfo. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LatticeConnector.java    From spring-cloud-lattice with Apache License 2.0 5 votes vote down vote up
@Override
protected FallbackServiceInfoCreator<BaseServiceInfo, Process> getFallbackServiceInfoCreator() {
	return new FallbackServiceInfoCreator<BaseServiceInfo, Process>() {
		@Override
		public BaseServiceInfo createServiceInfo(Process process) {
			return new BaseServiceInfo(process.getProcessGuid());
		}
	};
}
 
Example #2
Source File: CloudTest.java    From spring-cloud-connectors with Apache License 2.0 5 votes vote down vote up
@Test(expected=CloudException.class)
public void getSingletonServiceConnectorNoMatchingServiceConnectorCreator() {
    // Think an app bound to a (user) service that doesn't have a corresponding
    // registered ServiceConnectorCreator. When user asks for singleton service connector
    // for another type (with a corresponding creator registered), 
    // getSingletonServiceConnector() should throw a CloudException.
    BaseServiceInfo testServiceInfo = new BaseServiceInfo("user-service");
    StubCloudConnector stubCloudConnector = CloudTestUtil.getTestCloudConnector(testServiceInfo);
    serviceConnectorCreators.add(new StubServiceConnectorCreator());
    Cloud testCloud = new Cloud(stubCloudConnector, serviceConnectorCreators);	

    testCloud.getSingletonServiceConnector(StubServiceConnector.class, null);
}
 
Example #3
Source File: AbstractCloudConnectorTest.java    From spring-cloud-connectors with Apache License 2.0 5 votes vote down vote up
@Test 
public void fallbacksCorrectly() {
	TestServiceData acceptableServiceData = new TestServiceData("my-service1", "test-tag");
	TestServiceData unAcceptableServiceData = new TestServiceData("my-service2", "unknown-tag");
	
	CloudConnector testCloudConnector = new TestCloudConnector(acceptableServiceData, unAcceptableServiceData);
	List<ServiceInfo> serviceInfos = testCloudConnector.getServiceInfos();
	assertNotNull(serviceInfos);
	assertEquals(2, serviceInfos.size());
	assertThat(serviceInfos.get(0), is(instanceOf(TestServiceInfo.class)));
	assertThat(serviceInfos.get(0), is(instanceOf(BaseServiceInfo.class)));
}
 
Example #4
Source File: AbstractCloudConfigServiceScanTest.java    From spring-cloud-connectors with Apache License 2.0 5 votes vote down vote up
@Test
public void skipUnknowServices() {
       ApplicationContext testContext = getTestApplicationContext(createMysqlService("mysqlDb"), 
                                                                  new BaseServiceInfo("newrelic-service"));

       assertNotNull("Getting service by id", testContext.getBean("mysqlDb"));
       assertNotNull("Getting service by id and type", testContext.getBean("mysqlDb", DataSource.class));      
}
 
Example #5
Source File: AbstractCloudConnectorTest.java    From spring-cloud-connectors with Apache License 2.0 4 votes vote down vote up
@Override
protected FallbackServiceInfoCreator<BaseServiceInfo,TestServiceData> getFallbackServiceInfoCreator() {
	return new TestFallbackServiceInfoCreator();
}
 
Example #6
Source File: AbstractCloudConnectorTest.java    From spring-cloud-connectors with Apache License 2.0 4 votes vote down vote up
@Override
public BaseServiceInfo createServiceInfo(TestServiceData serviceData) {
	return new BaseServiceInfo(serviceData.getId());
}
 
Example #7
Source File: CloudFoundryConnector.java    From spring-cloud-connectors with Apache License 2.0 4 votes vote down vote up
@Override
protected FallbackServiceInfoCreator<BaseServiceInfo,Map<String,Object>> getFallbackServiceInfoCreator() {
	return new CloudFoundryFallbackServiceInfoCreator();
}
 
Example #8
Source File: CloudFoundryConnector.java    From spring-cloud-connectors with Apache License 2.0 4 votes vote down vote up
@Override
public BaseServiceInfo createServiceInfo(Map<String,Object> serviceData) {
	String id = (String) serviceData.get("name");
	return new BaseServiceInfo(id);
}
 
Example #9
Source File: LocalConfigConnector.java    From spring-cloud-connectors with Apache License 2.0 4 votes vote down vote up
@Override
protected FallbackServiceInfoCreator<BaseServiceInfo, UriBasedServiceData> getFallbackServiceInfoCreator() {
	return new FallbackBaseServiceInfoCreator();
}
 
Example #10
Source File: HerokuConnector.java    From spring-cloud-connectors with Apache License 2.0 4 votes vote down vote up
@Override
protected FallbackServiceInfoCreator<BaseServiceInfo, UriBasedServiceData> getFallbackServiceInfoCreator() {
	return new FallbackBaseServiceInfoCreator();
}