Search in sources :

Example 6 with Version

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

the class TestVersion method constructFromStringInvalidMinorNegative.

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

Example 7 with Version

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

the class TestVersion method constructFromStringNormal.

@Test
public void constructFromStringNormal() {
    version = new Version("1.1.1.1");
    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.getBuild());
}
Also used : Version(org.apache.servicecomb.foundation.common.Version) Test(org.junit.Test)

Example 8 with Version

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

the class TestVersion method constructFromStringInvalidMajorDot.

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

Example 9 with Version

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

the class VersionRuleStartFromParser method parse.

@Override
public VersionRule parse(String strVersionRule) {
    int pos = strVersionRule.indexOf('+');
    if (pos <= 0 || pos != strVersionRule.length() - 1) {
        return null;
    }
    Version from = new Version(strVersionRule.substring(0, pos));
    return new StartFromVersionRule(from.getVersion() + "+", from);
}
Also used : Version(org.apache.servicecomb.foundation.common.Version)

Example 10 with Version

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

the class TestVersionUtils method getOrCreate.

@Test
public void getOrCreate() {
    Version v = VersionUtils.getOrCreate("1.0.0");
    Assert.assertEquals("1.0.0.0", v.getVersion());
    Assert.assertSame(v, VersionUtils.getOrCreate("1.0.0"));
}
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