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;
15 import org.eclipse.jetty.client.HttpClient;
16 import org.eclipse.jetty.client.api.ContentResponse;
17 import org.junit.After;
18 import org.junit.Before;
19 import org.junit.Test;
20 import org.slf4j.Logger;
21 import org.slf4j.LoggerFactory;
23 public class MaintTest {
24 private static final Logger LOG = LoggerFactory.getLogger(MaintTest.class);
25 private Main main = new Main();
26 private HttpClient client = new HttpClient();
29 @SuppressWarnings("checkstyle:Illegalcatch")
33 } catch (Exception e) {
34 LOG.error("An error occured during test init", e);
35 fail("cannot init test ");
40 @SuppressWarnings("checkstyle:Illegalcatch")
45 } catch (Exception e) {
46 LOG.error("An error occured during test shutdown", e);
51 public void startNoConfigFileTest() throws Exception {
52 main.start(new String[0], true);
53 ContentResponse response = client.GET("http://localhost:8181/restconf/config/ietf-network:networks/network/openroadm-topology");
54 assertEquals("Response code should be 200", 200, response.getStatus());
58 public void startConfigFileTest() throws Exception {
59 File configFile = new File("src/test/resources/config.json");
60 String[] args = {configFile.getAbsolutePath()};
61 main.start(args, true);
62 ContentResponse response = client.GET("http://localhost:8888/restconfCustom/config/ietf-network:networks/network/openroadm-topology");
63 assertEquals("Response code should be 200", 200, response.getStatus());