2 * Copyright © 2020 Orange, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package io.lighty.controllers.tpce;
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.fail;
14 import org.eclipse.jetty.client.HttpClient;
15 import org.eclipse.jetty.client.api.ContentResponse;
16 import org.junit.After;
17 import org.junit.Before;
18 import org.junit.Test;
19 import org.slf4j.Logger;
20 import org.slf4j.LoggerFactory;
22 public class MaintTest {
23 private static final Logger LOG = LoggerFactory.getLogger(MaintTest.class);
24 private Main main = new Main();
25 private HttpClient client = new HttpClient();
28 @SuppressWarnings("checkstyle:Illegalcatch")
32 } catch (Exception e) {
33 LOG.error("An error occured during test init", e);
34 fail("cannot init test ");
39 @SuppressWarnings("checkstyle:Illegalcatch")
44 } catch (Exception e) {
45 LOG.error("An error occured during test shutdown", e);
50 public void startNoConfigFileTest() throws Exception {
51 main.start(new String[0], true);
52 ContentResponse response = client.GET("http://localhost:8181/restconf/config/ietf-network:networks/network/openroadm-topology");
53 assertEquals("Response code should be 200", 200, response.getStatus());
57 public void startConfigFileTest() throws Exception {
58 File configFile = new File("src/test/resources/config.json");
59 String[] args = {configFile.getAbsolutePath()};
60 main.start(args, true);
61 ContentResponse response = client.GET("http://localhost:8888/restconfCustom/config/ietf-network:networks/network/openroadm-topology");
62 assertEquals("Response code should be 200", 200, response.getStatus());