Search in sources :

Example 21 with Version

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

the class TestVersion method constructFromStringInvalidMajorNegative.

@Test
public void constructFromStringInvalidMajorNegative() {
    expectedException.expect(IllegalStateException.class);
    expectedException.expectMessage(Matchers.is("major \"-1\" can not be negative, version \"-1\"."));
    version = new Version("-1");
}
Also used : Version(org.apache.servicecomb.foundation.common.Version) Test(org.junit.Test)

Example 22 with Version

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

the class TestVersion method constructFromStringInvalidEmpty.

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

Example 23 with Version

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

the class TestVersion method constructFromStringNormalOnlyMajor.

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

Example 24 with Version

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

the class TestVersion method constructFromNumber.

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

Example 25 with Version

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

the class TestVersion method constructFromStringNormalOnlyMajorMinor.

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

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