Add tests of the API builder classes and methods.
Change-Id: I9c4ea2fa63ef83beed81f807fe3eb1c790708595
Signed-off-by: Lott, Christopher (cl778h) <cl778h@att.com>
--- /dev/null
+/*-
+ * ========================LICENSE_START=================================
+ * O-RAN-SC
+ * %%
+ * Copyright (C) 2019 AT&T Intellectual Property
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================LICENSE_END===================================
+ */
+package org.oransc.ric.portal.dashboard.config;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.oransc.ric.a1med.client.api.A1MediatorApi;
+
+public class A1MediatorConfigTest extends AbstractConfigTest {
+
+ @Test
+ public void builderTest() {
+ A1MediatorApiBuilder builder = new A1MediatorApiBuilder(instanceConfig, "suffix");
+ A1MediatorApi a1Api = builder.getA1MediatorApi(RICInstanceMockConfiguration.INSTANCE_KEY_1);
+ Assertions.assertNotNull(a1Api);
+ }
+
+}
--- /dev/null
+/*-
+ * ========================LICENSE_START=================================
+ * O-RAN-SC
+ * %%
+ * Copyright (C) 2020 AT&T Intellectual Property
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================LICENSE_END===================================
+ */
+package org.oransc.ric.portal.dashboard.config;
+
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.oransc.ric.portal.dashboard.model.RicInstanceList;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.junit.jupiter.SpringExtension;
+
+@ExtendWith(SpringExtension.class)
+@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
+@ActiveProfiles("test")
+public class AbstractConfigTest {
+
+ @Autowired
+ protected RicInstanceList instanceConfig;
+
+}
--- /dev/null
+/*-
+ * ========================LICENSE_START=================================
+ * O-RAN-SC
+ * %%
+ * Copyright (C) 2020 AT&T Intellectual Property
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================LICENSE_END===================================
+ */
+package org.oransc.ric.portal.dashboard.config;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.oransc.ric.plt.appmgr.client.api.HealthApi;
+import org.oransc.ric.plt.appmgr.client.api.XappApi;
+
+public class AppManagerConfigTest extends AbstractConfigTest {
+
+ @Test
+ public void builderTest() {
+ AppManagerApiBuilder builder = new AppManagerApiBuilder(instanceConfig, "suffix");
+ HealthApi healthApi = builder.getHealthApi(RICInstanceMockConfiguration.INSTANCE_KEY_1);
+ Assertions.assertNotNull(healthApi);
+ XappApi xappApi = builder.getXappApi(RICInstanceMockConfiguration.INSTANCE_KEY_1);
+ Assertions.assertNotNull(xappApi);
+ }
+
+}
--- /dev/null
+/*-
+ * ========================LICENSE_START=================================
+ * O-RAN-SC
+ * %%
+ * Copyright (C) 2020 AT&T Intellectual Property
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================LICENSE_END===================================
+ */
+package org.oransc.ric.portal.dashboard.config;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.oransc.ric.portal.dashboard.k8sapi.SimpleKubernetesClient;
+
+public class CaasIngressConfigTest extends AbstractConfigTest {
+
+ @Test
+ public void builderTest() {
+ SimpleKubernetesClientBuilder builder = new SimpleKubernetesClientBuilder(instanceConfig, "suffix");
+ SimpleKubernetesClient clientApi = builder
+ .getSimpleKubernetesClient(RICInstanceMockConfiguration.INSTANCE_KEY_1);
+ Assertions.assertNotNull(clientApi);
+ }
+
+}
--- /dev/null
+/*-
+ * ========================LICENSE_START=================================
+ * O-RAN-SC
+ * %%
+ * Copyright (C) 2020 AT&T Intellectual Property
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================LICENSE_END===================================
+ */
+package org.oransc.ric.portal.dashboard.config;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.oransc.ric.e2mgr.client.api.HealthCheckApi;
+import org.oransc.ric.e2mgr.client.api.NodebApi;
+
+public class E2ManagerConfigTest extends AbstractConfigTest {
+
+ @Test
+ public void builderTest() {
+ E2ManagerApiBuilder builder = new E2ManagerApiBuilder(instanceConfig, "suffix");
+ HealthCheckApi healthApi = builder.getHealthCheckApi(RICInstanceMockConfiguration.INSTANCE_KEY_1);
+ Assertions.assertNotNull(healthApi);
+ NodebApi nodebApi = builder.getNodebApi(RICInstanceMockConfiguration.INSTANCE_KEY_1);
+ Assertions.assertNotNull(nodebApi);
+ }
+
+}
m = new RanDetailsTransport(nodebIdentity, nodebResponse);
Assert.assertEquals(m.getNodebIdentity(), nodebIdentity);
Assert.assertEquals(m.getNodebStatus(), nodebResponse);
+ m.nodebIdentity(nodebIdentity).nodebStatus(nodebResponse);
+ Assert.assertEquals(m.getNodebIdentity(), nodebIdentity);
+ Assert.assertEquals(m.getNodebStatus(), nodebResponse);
}
private void checkSuccessTransport(SuccessTransport m) {
logger.info(m.toString());
}
+ private void checkRicInstanceKeyName(RicInstanceKeyName m) {
+ Assert.assertEquals(s1, m.getKey());
+ Assert.assertEquals(s2, m.getName());
+ }
+
+ @Test
+ public void testRicInstanceKeyName() {
+ RicInstanceKeyName m = new RicInstanceKeyName(s1, s1);
+ m = new RicInstanceKeyName();
+ m.setKey(s1);
+ m.setName(s2);
+ checkRicInstanceKeyName(m);
+ Assert.assertEquals(m, m);
+ Assert.assertNotEquals(1, m.hashCode());
+ logger.info(m.toString());
+ }
+
+ private void checkRicInstance(RicInstance m) {
+ Assert.assertEquals(s1, m.getAppUrlPrefix());
+ Assert.assertEquals(s2, m.getCaasUrlPrefix());
+ Assert.assertEquals(s3, m.getKey());
+ Assert.assertEquals(s4, m.getName());
+ }
+
+ @Test
+ public void testRicInstance() {
+ RicInstance m = new RicInstance();
+ m.setAppUrlPrefix(s1);
+ m.setCaasUrlPrefix(s2);
+ m.setKey(s3);
+ m.setName(s4);
+ checkRicInstance(m);
+ Assert.assertEquals(m, m);
+ Assert.assertNotEquals(1, m.hashCode());
+ logger.info(m.toString());
+ }
+
}