use of io.servicecomb.core.provider.consumer.ReferenceConfig in project java-chassis by ServiceComb.
the class MockUtil method mockConsumerProviderManager.
public void mockConsumerProviderManager() {
ConsumerProviderManager consumerProviderManager = new MockUp<ConsumerProviderManager>() {
@Mock
public ReferenceConfig getReferenceConfig(String microserviceName) {
return new ReferenceConfig("test", "test", "test");
}
}.getMockInstance();
CseContext.getInstance().setConsumerProviderManager(consumerProviderManager);
}
use of io.servicecomb.core.provider.consumer.ReferenceConfig in project java-chassis by ServiceComb.
the class TestRequestMeta method testGetReferenceConfig.
@Test
public void testGetReferenceConfig() {
ReferenceConfig value = requestmeta.getReferenceConfig();
Assert.assertNotNull(value);
}
use of io.servicecomb.core.provider.consumer.ReferenceConfig in project java-chassis by ServiceComb.
the class CseClientHttpRequest method createRequestMeta.
private RequestMeta createRequestMeta(String httpMetod, URI uri) {
String microserviceName = uri.getAuthority();
ReferenceConfig referenceConfig = CseContext.getInstance().getConsumerProviderManager().getReferenceConfig(microserviceName);
MicroserviceMeta microserviceMeta = referenceConfig.getMicroserviceMeta();
ServicePathManager servicePathManager = ServicePathManager.getServicePathManager(microserviceMeta);
if (servicePathManager == null) {
throw new Error(String.format("no schema defined for %s:%s", microserviceMeta.getAppId(), microserviceMeta.getName()));
}
OperationLocator locator = servicePathManager.locateOperation(uri.getPath(), httpMetod);
RestOperationMeta swaggerRestOperation = locator.getOperation();
Map<String, String> pathParams = locator.getPathVarMap();
return new RequestMeta(referenceConfig, swaggerRestOperation, pathParams);
}
Aggregations