Search in sources :

Example 26 with Version

use of org.apache.servicecomb.foundation.common.Version in project java-chassis by ServiceComb.

the class TestVersion method constructFromStringInvalidTooManyPart.

@Test
public void constructFromStringInvalidTooManyPart() {
    expectedException.expect(IllegalStateException.class);
    expectedException.expectMessage(Matchers.is("Invalid version \"1.1.1.1.\"."));
    version = new Version("1.1.1.1.");
}
Also used : Version(org.apache.servicecomb.foundation.common.Version) Test(org.junit.Test)

Example 27 with Version

use of org.apache.servicecomb.foundation.common.Version in project java-chassis by ServiceComb.

the class TestVersion method constructFromStringOnlyMajorMinorPatch.

@Test
public void constructFromStringOnlyMajorMinorPatch() {
    version = new Version("1.1.1");
    Assert.assertEquals("1.1.1.0", version.getVersion());
    Assert.assertEquals(1, version.getMajor());
    Assert.assertEquals(1, version.getMinor());
    Assert.assertEquals(1, version.getPatch());
    Assert.assertEquals(0, version.getBuild());
}
Also used : Version(org.apache.servicecomb.foundation.common.Version) Test(org.junit.Test)

Example 28 with Version

use of org.apache.servicecomb.foundation.common.Version in project java-chassis by ServiceComb.

the class MicroserviceVersion method init.

protected void init(MicroserviceVersions microserviceVersions, Microservice microservice, String microserviceName, Collection<MicroserviceInstance> instances) {
    this.appManager = microserviceVersions.getAppManager();
    this.microserviceVersions = microserviceVersions;
    this.microservice = microservice;
    this.microserviceName = microserviceName;
    this.instances = instances;
    this.version = new Version(microservice.getVersion());
}
Also used : Version(org.apache.servicecomb.foundation.common.Version)

Aggregations

Version (org.apache.servicecomb.foundation.common.Version)28 Test (org.junit.Test)20 Microservice (org.apache.servicecomb.registry.api.registry.Microservice)4 MicroserviceInstance (org.apache.servicecomb.registry.api.registry.MicroserviceInstance)3 ArrayList (java.util.ArrayList)2 MicroserviceVersion (org.apache.servicecomb.registry.consumer.MicroserviceVersion)2 Arrays (java.util.Arrays)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1 Mock (mockit.Mock)1 MockUp (mockit.MockUp)1 EnvironmentConfiguration (org.apache.commons.configuration.EnvironmentConfiguration)1 DiscoveryManager (org.apache.servicecomb.registry.DiscoveryManager)1 FindInstancesResponse (org.apache.servicecomb.registry.api.registry.FindInstancesResponse)1 MicroserviceInstances (org.apache.servicecomb.registry.api.registry.MicroserviceInstances)1 AppManager (org.apache.servicecomb.registry.consumer.AppManager)1 MicroserviceVersionRule (org.apache.servicecomb.registry.consumer.MicroserviceVersionRule)1 MicroserviceVersions (org.apache.servicecomb.registry.consumer.MicroserviceVersions)1