Search in sources :

Example 1 with Framework

use of org.apache.servicecomb.registry.api.registry.Framework in project java-chassis by ServiceComb.

the class TestFramework method testInitializedValues.

@Test
public void testInitializedValues() {
    Framework framework = new Framework();
    framework.setName("JAVA-CHASSIS");
    framework.setVersion("x.x.x");
    Assert.assertEquals("JAVA-CHASSIS", framework.getName());
    Assert.assertEquals("x.x.x", framework.getVersion());
}
Also used : Framework(org.apache.servicecomb.registry.api.registry.Framework) Test(org.junit.Test)

Example 2 with Framework

use of org.apache.servicecomb.registry.api.registry.Framework in project java-chassis by ServiceComb.

the class TestFramework method testDefaultValues.

@Test
public void testDefaultValues() {
    Framework framework = new Framework();
    Assert.assertNull(framework.getName());
    Assert.assertNull(framework.getVersion());
}
Also used : Framework(org.apache.servicecomb.registry.api.registry.Framework) Test(org.junit.Test)

Example 3 with Framework

use of org.apache.servicecomb.registry.api.registry.Framework in project java-chassis by ServiceComb.

the class TestMicroService method initMicroservice.

private void initMicroservice() {
    oMicroservice.setAppId("testAppID");
    oMicroservice.setDescription("This is the test");
    oMicroservice.setLevel("INFO");
    oMicroservice.setServiceId("testServiceID");
    oMicroservice.setServiceName("testServiceName");
    oMicroservice.setStatus(MicroserviceInstanceStatus.DOWN.toString());
    oMicroservice.setVersion("1.0.0");
    oMapProperties.put("proxy", "fakeProxy");
    oListSchemas.add("testSchemas");
    oMicroservice.setProperties(oMapProperties);
    oMicroservice.setSchemas(oListSchemas);
    oMicroservice.getPaths().add(new BasePath());
    Framework framework = new Framework();
    framework.setName("JAVA-CHASSIS");
    framework.setVersion("x.x.x");
    oMicroservice.setFramework(framework);
    oMicroservice.setRegisterBy("SDK");
    oMicroservice.setEnvironment("development");
}
Also used : BasePath(org.apache.servicecomb.registry.api.registry.BasePath) Framework(org.apache.servicecomb.registry.api.registry.Framework)

Example 4 with Framework

use of org.apache.servicecomb.registry.api.registry.Framework in project java-chassis by ServiceComb.

the class MicroserviceVersionRule method printData.

private void printData(MicroserviceVersionRuleData data, int inputVersionCount, int inputInstanceCount) {
    String latestVersion = data.latestVersion == null ? null : data.latestVersion.getVersion().getVersion();
    if (data.getInstances().isEmpty()) {
        LOGGER.info("update instances to be empty caused by version rule, appId={}, microserviceName={}, versionRule={}" + ", latestVersion={}, inputVersionCount={}, inputInstanceCount={}", appId, microserviceName, versionRule.getVersionRule(), latestVersion, inputVersionCount, inputInstanceCount);
        return;
    }
    StringBuilder sb = new StringBuilder();
    StringBuilderUtils.appendLine(sb, "update instances, appId=%s, microserviceName=%s, versionRule=%s" + ", latestVersion=%s, inputVersionCount=%s, inputInstanceCount=%s", appId, microserviceName, versionRule.getVersionRule(), latestVersion, inputVersionCount, inputInstanceCount);
    int idx = 0;
    for (MicroserviceInstance instance : data.getInstances().values()) {
        MicroserviceVersion microserviceVersion = data.versions.get(instance.getServiceId());
        Microservice microservice = microserviceVersion.getMicroservice();
        Framework framework = microservice.getFramework();
        String frameworkName = framework == null ? "unknown" : framework.getName();
        String frameworkVersion = framework == null ? "unknown" : framework.getVersion();
        StringBuilderUtils.appendLine(sb, "  %d.instanceId=%s, status=%s, version=%s, endpoints=%s, environment=%s, framework.name=%s, framework.version=%s", idx, instance.getInstanceId(), instance.getStatus(), microserviceVersion.getVersion(), instance.getEndpoints(), microservice.getEnvironment(), frameworkName, frameworkVersion);
        idx++;
    }
    LOGGER.info(StringBuilderUtils.deleteLast(sb, 1).toString());
}
Also used : Microservice(org.apache.servicecomb.registry.api.registry.Microservice) MicroserviceInstance(org.apache.servicecomb.registry.api.registry.MicroserviceInstance) Framework(org.apache.servicecomb.registry.api.registry.Framework)

Aggregations

Framework (org.apache.servicecomb.registry.api.registry.Framework)4 Test (org.junit.Test)2 BasePath (org.apache.servicecomb.registry.api.registry.BasePath)1 Microservice (org.apache.servicecomb.registry.api.registry.Microservice)1 MicroserviceInstance (org.apache.servicecomb.registry.api.registry.MicroserviceInstance)1