use of org.apache.servicecomb.core.definition.SchemaMeta in project java-chassis by ServiceComb.
the class PojoConsumerMetaRefresher method refreshMeta.
protected PojoConsumerMeta refreshMeta() {
MicroserviceReferenceConfig microserviceReferenceConfig = scbEngine.createMicroserviceReferenceConfig(microserviceName);
MicroserviceMeta microserviceMeta = microserviceReferenceConfig.getLatestMicroserviceMeta();
SchemaMeta schemaMeta = findSchemaMeta(microserviceMeta);
if (schemaMeta == null) {
throw new IllegalStateException(String.format("Schema not exist, microserviceName=%s, schemaId=%s, consumer interface=%s; " + "new producer not running or not deployed.", microserviceName, schemaId, consumerIntf.getName()));
}
SwaggerConsumer swaggerConsumer = scbEngine.getSwaggerEnvironment().createConsumer(consumerIntf, schemaMeta.getSwagger());
return new PojoConsumerMeta(microserviceReferenceConfig, swaggerConsumer, schemaMeta);
}
use of org.apache.servicecomb.core.definition.SchemaMeta in project java-chassis by ServiceComb.
the class ITSCBRestTemplate method init.
public ITSCBRestTemplate init() {
String producerName = ITJUnitUtils.getProducerName();
MicroserviceReferenceConfig microserviceReferenceConfig = SCBEngine.getInstance().createMicroserviceReferenceConfig(producerName);
MicroserviceMeta microserviceMeta = microserviceReferenceConfig.getLatestMicroserviceMeta();
SchemaMeta schemaMeta = microserviceMeta.ensureFindSchemaMeta(schemaId);
basePath = schemaMeta.getSwagger().getBasePath();
urlPrefix = String.format("cse://%s%s", producerName, basePath);
instance = DiscoveryManager.INSTANCE.getAppManager().getOrCreateMicroserviceManager(RegistrationManager.INSTANCE.getMicroservice().getAppId()).getOrCreateMicroserviceVersions(producerName).getPulledInstances().get(0);
setUriTemplateHandler(new ITUriTemplateHandler(urlPrefix));
setRequestFactory(new ITClientHttpRequestFactory());
return this;
}
use of org.apache.servicecomb.core.definition.SchemaMeta in project java-chassis by ServiceComb.
the class TestIgnoreMethod method ignoreMethodSpringmvc_apiOperation.
@Test
public void ignoreMethodSpringmvc_apiOperation() {
SchemaMeta schemaMeta = microserviceMeta.findSchemaMeta("ignoreMethodSpringmvc");
Assert.assertNull(schemaMeta.findOperation("hideByApiOperation"));
}
use of org.apache.servicecomb.core.definition.SchemaMeta in project java-chassis by ServiceComb.
the class TestIgnoreMethod method ignoreMethodJaxrs_apiOperation.
@Test
public void ignoreMethodJaxrs_apiOperation() {
SchemaMeta schemaMeta = microserviceMeta.findSchemaMeta("ignoreMethodJaxrs");
Assert.assertNull(schemaMeta.findOperation("hideByApiOperation"));
}
use of org.apache.servicecomb.core.definition.SchemaMeta in project java-chassis by ServiceComb.
the class TestApiParam method check.
protected void check(String schemaId, String opName, String paramType) {
SchemaMeta schemaMeta = microserviceMeta.findSchemaMeta(schemaId);
OperationMeta operationMeta = schemaMeta.findOperation(opName);
parameter = operationMeta.getSwaggerOperation().getParameters().get(0);
Assert.assertEquals("desc of " + opName + " param", parameter.getDescription());
Assert.assertEquals(paramType, parameter.getIn());
}
Aggregations