use of org.apache.servicecomb.core.definition.SchemaMeta in project java-chassis by ServiceComb.
the class TestIgnoreStaticMethod method ignoreStaticMethod_pojo.
@Test
public void ignoreStaticMethod_pojo() {
SchemaMeta schemaMeta = microserviceMeta.findSchemaMeta("ignoreStaticMethodPojoSchema");
OperationMeta add = schemaMeta.findOperation("add");
Assert.assertNotNull(add);
OperationMeta sub = schemaMeta.findOperation("staticSub");
Assert.assertNull(sub);
}
use of org.apache.servicecomb.core.definition.SchemaMeta in project java-chassis by ServiceComb.
the class TestIgnoreStaticMethod method ignoreStaticMethod_Springmvc.
@Test
public void ignoreStaticMethod_Springmvc() {
SchemaMeta schemaMeta = microserviceMeta.findSchemaMeta("ignoreStaticMethodSpringmvcSchema");
OperationMeta add = schemaMeta.findOperation("add");
Assert.assertNotNull(add);
OperationMeta sub = schemaMeta.findOperation("staticSub");
Assert.assertNull(sub);
}
use of org.apache.servicecomb.core.definition.SchemaMeta in project java-chassis by ServiceComb.
the class TestIgnoreMethod method ignoreMethodPojo_apiOperation.
@Test
public void ignoreMethodPojo_apiOperation() {
SchemaMeta schemaMeta = microserviceMeta.findSchemaMeta("ignoreMethodPojo");
Assert.assertNull(schemaMeta.findOperation("hideByApiOperation"));
}
use of org.apache.servicecomb.core.definition.SchemaMeta in project java-chassis by ServiceComb.
the class GateRestTemplate method getUrlPrefix.
private String getUrlPrefix(String gateName, String producerName, String schemaId) {
MicroserviceVersionRule microserviceVersionRule = DiscoveryManager.INSTANCE.getAppManager().getOrCreateMicroserviceVersionRule(RegistrationManager.INSTANCE.getMicroservice().getAppId(), gateName, DefinitionConst.VERSION_RULE_ALL);
MicroserviceInstance microserviceInstance = microserviceVersionRule.getInstances().values().stream().findFirst().get();
URIEndpointObject edgeAddress = new URIEndpointObject(microserviceInstance.getEndpoints().get(0));
String urlSchema = "http";
if (edgeAddress.isSslEnabled()) {
urlSchema = "https";
}
MicroserviceReferenceConfig microserviceReferenceConfig = SCBEngine.getInstance().createMicroserviceReferenceConfig(producerName);
MicroserviceMeta microserviceMeta = microserviceReferenceConfig.getLatestMicroserviceMeta();
SchemaMeta schemaMeta = microserviceMeta.ensureFindSchemaMeta(schemaId);
return String.format("%s://%s:%d/rest/%s%s", urlSchema, edgeAddress.getHostOrIp(), edgeAddress.getPort(), producerName, schemaMeta.getSwagger().getBasePath());
}
use of org.apache.servicecomb.core.definition.SchemaMeta in project java-chassis by ServiceComb.
the class ITSCBAsyncRestTemplate method ensureProviderBasePath.
private void ensureProviderBasePath(String producerName) {
MicroserviceManager microserviceManager = DiscoveryManager.INSTANCE.getAppManager().getOrCreateMicroserviceManager(RegistrationManager.INSTANCE.getMicroservice().getAppId());
MicroserviceVersions producerMicroserviceVersions = microserviceManager.getOrCreateMicroserviceVersions(producerName);
Optional<MicroserviceVersion> latestMicroserviceVersion = producerMicroserviceVersions.getVersions().values().stream().max(Comparator.comparing(MicroserviceVersion::getVersion));
latestMicroserviceVersion.ifPresent(microserviceVersion -> {
MicroserviceMeta microserviceMeta = microserviceVersion.getVendorExtensions().get(CORE_MICROSERVICE_META);
SchemaMeta schemaMeta = microserviceMeta.ensureFindSchemaMeta(schemaId);
basePath = schemaMeta.getSwagger().getBasePath();
});
latestMicroserviceVersion.orElseThrow(() -> new IllegalStateException("cannot find producer: " + producerName));
}
Aggregations