@@ -0,0 +1,2121 @@
+package org.kurento.tree.test;%0A%0Aimport static org.hamcrest.CoreMatchers.is;%0Aimport static org.junit.Assert.assertThat;%0A%0Aimport java.io.IOException;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0Aimport java.util.concurrent.ArrayBlockingQueue;%0Aimport java.util.concurrent.BlockingQueue;%0A%0Aimport org.junit.Test;%0Aimport org.junit.experimental.categories.Category;%0Aimport org.kurento.commons.testing.SystemFunctionalTests;%0Aimport org.kurento.test.services.KurentoMediaServerManager;%0Aimport org.kurento.test.services.KurentoServicesTestHelper;%0Aimport org.kurento.tree.server.app.KmsRegistrar;%0Aimport org.kurento.tree.server.app.KurentoTreeServerApp;%0Aimport org.springframework.boot.SpringApplication;%0Aimport org.springframework.boot.autoconfigure.EnableAutoConfiguration;%0Aimport org.springframework.context.ConfigurableApplicationContext;%0A%0A@Category(SystemFunctionalTests.class)%0Apublic class TreeCloudRegisterRealMediaServerTest %7B%0A%0A%09private static final int NUM_KMSS = 3;%0A%0A%09@EnableAutoConfiguration%0A%09static class TestConfiguration extends KurentoTreeServerApp %7B%0A%0A%09%09public KmsRegistrar registrar() %7B%0A%09%09%09return new KmsRegistrar() %7B%0A%09%09%09%09@Override%0A%09%09%09%09public void register(String wsUri) %7B%0A%09%09%09%09%09registeredKmss.add(wsUri);%0A%09%09%09%09%7D%0A%09%09%09%7D;%0A%09%09%7D%0A%09%7D%0A%0A%09private static BlockingQueue%3CString%3E registeredKmss = new ArrayBlockingQueue%3C%3E(%0A%09%09%0910);%0A%0A%09@Test%0A%09public void registrarTest() throws IOException, InterruptedException %7B%0A%0A%09%09int port = KurentoServicesTestHelper.getAppHttpPort();%0A%0A%09%09System.setProperty(KurentoTreeServerApp.KMSS_URIS_PROPERTY, %22%5B%5D%22);%0A%0A%09%09ConfigurableApplicationContext context = SpringApplication.run(%0A%09%09%09%09TestConfiguration.class, %22--server.port=%22 + port);%0A%09%09context.start();%0A%0A%09%09List%3CKurentoMediaServerManager%3E kmss = new ArrayList%3C%3E();%0A%0A%09%09for (int i = 0; i %3C NUM_KMSS; i++) %7B%0A%0A%09%09%09int wsPort = 10000 + 2 * i;%0A%09%09%09int httpPort = 10000 + 2 * i + 1;%0A%0A%09%09%09String createdKmsUri = %22ws://localhost:%22 + wsPort + %22/kurento%22;%0A%0A%09%09%09kmss.add(KurentoMediaServerManager.createWithWsTransport(%0A%09%09%09%09%09createdKmsUri, httpPort));%0A%0A%09%09%09String kmsUri = registeredKmss.take();%0A%0A%09%09%09assertThat(kmsUri, is(createdKmsUri));%0A%09%09%7D%0A%0A%09%09context.close();%0A%09%7D%0A%7D%0A

Test for KMS registering