use of org.apache.servicecomb.core.provider.consumer.ReferenceConfig in project incubator-servicecomb-java-chassis by apache.
the class CseClientHttpRequest method createRequestMeta.
private RequestMeta createRequestMeta(String httpMetod, URI uri) {
String microserviceName = uri.getAuthority();
ReferenceConfig referenceConfig = ReferenceConfigUtils.getForInvoke(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.consumerLocateOperation(path, httpMetod);
RestOperationMeta swaggerRestOperation = locator.getOperation();
Map<String, String> pathParams = locator.getPathVarMap();
return new RequestMeta(referenceConfig, swaggerRestOperation, pathParams);
}
use of org.apache.servicecomb.core.provider.consumer.ReferenceConfig in project incubator-servicecomb-java-chassis by apache.
the class TestRequestMeta method testGetReferenceConfig.
@Test
public void testGetReferenceConfig() {
ReferenceConfig value = requestmeta.getReferenceConfig();
Assert.assertNotNull(value);
}
use of org.apache.servicecomb.core.provider.consumer.ReferenceConfig in project incubator-servicecomb-java-chassis by apache.
the class EdgeInvocation method createInvocation.
@Override
protected void createInvocation() {
ReferenceConfig referenceConfig = new ReferenceConfig();
referenceConfig.setMicroserviceMeta(latestMicroserviceVersionMeta.getMicroserviceMeta());
referenceConfig.setMicroserviceVersionRule(microserviceVersionRule.getVersionRule().getVersionRule());
referenceConfig.setTransport(Const.ANY_TRANSPORT);
this.invocation = InvocationFactory.forConsumer(referenceConfig, restOperationMeta.getOperationMeta(), null);
this.invocation.setResponseExecutor(new ReactiveResponseExecutor());
}
use of org.apache.servicecomb.core.provider.consumer.ReferenceConfig in project incubator-servicecomb-java-chassis by apache.
the class MockUtil method mockConsumerProviderManager.
public void mockConsumerProviderManager() {
ConsumerProviderManager consumerProviderManager = new MockUp<ConsumerProviderManager>() {
@Mock
public ReferenceConfig getReferenceConfig(String microserviceName) {
return new ReferenceConfig(CseContext.getInstance().getConsumerSchemaFactory(), "test", "test", "test");
}
}.getMockInstance();
CseContext.getInstance().setConsumerProviderManager(consumerProviderManager);
}
Aggregations