Search in sources :

Example 6 with VersionRule

use of org.apache.servicecomb.registry.version.VersionRule in project java-chassis by ServiceComb.

the class LocalServiceRegistryClientImpl method getMicroserviceId.

@Override
public String getMicroserviceId(String appId, String microserviceName, String strVersionRule, String environment) {
    VersionRule versionRule = VersionRuleUtils.getOrCreate(strVersionRule);
    Microservice latest = findLatest(appId, microserviceName, versionRule);
    return latest != null ? latest.getServiceId() : null;
}
Also used : Microservice(org.apache.servicecomb.registry.api.registry.Microservice) VersionRule(org.apache.servicecomb.registry.version.VersionRule)

Example 7 with VersionRule

use of org.apache.servicecomb.registry.version.VersionRule in project java-chassis by ServiceComb.

the class TestCompatiblePathVersionMapper method createVersionRule_32767.

@Test
public void createVersionRule_32767() {
    VersionRule versionRule = mapper.getOrCreate("v32767");
    Assert.assertEquals("32767.0.0.0+", versionRule.getVersionRule());
}
Also used : VersionRule(org.apache.servicecomb.registry.version.VersionRule) Test(org.junit.Test)

Example 8 with VersionRule

use of org.apache.servicecomb.registry.version.VersionRule in project java-chassis by ServiceComb.

the class TestCompatiblePathVersionMapper method getOrCreate.

@Test
public void getOrCreate() {
    VersionRule versionRule = mapper.getOrCreate("v1");
    Assert.assertEquals("1.0.0.0-2.0.0.0", versionRule.getVersionRule());
}
Also used : VersionRule(org.apache.servicecomb.registry.version.VersionRule) Test(org.junit.Test)

Aggregations

VersionRule (org.apache.servicecomb.registry.version.VersionRule)8 Test (org.junit.Test)6 FixedVersionRule (org.apache.servicecomb.registry.version.VersionRuleFixedParser.FixedVersionRule)4 LatestVersionRule (org.apache.servicecomb.registry.version.VersionRuleLatestParser.LatestVersionRule)4 RangeVersionRule (org.apache.servicecomb.registry.version.VersionRuleRangeParser.RangeVersionRule)4 StartFromVersionRule (org.apache.servicecomb.registry.version.VersionRuleStartFromParser.StartFromVersionRule)4 Microservice (org.apache.servicecomb.registry.api.registry.Microservice)2 ArrayList (java.util.ArrayList)1 Version (org.apache.servicecomb.foundation.common.Version)1 FindInstancesResponse (org.apache.servicecomb.registry.api.registry.FindInstancesResponse)1 MicroserviceInstance (org.apache.servicecomb.registry.api.registry.MicroserviceInstance)1 MicroserviceInstances (org.apache.servicecomb.registry.api.registry.MicroserviceInstances)1