Project

General

Profile

Revision 990226a3

ID990226a3d7f7a3c440075720508c52c60f886d9b
Parent 11fcf6af
Child b7fa2296

Added by Andreas Kohlbecker over 3 years ago

fixing problems with startH2Server and providing feedback to developers on start up

View differences:

cdmlib-test/src/main/java/eu/etaxonomy/cdm/test/integration/CdmIntegrationTest.java
72 72
    protected static final Logger logger = Logger.getLogger(CdmIntegrationTest.class);
73 73

  
74 74
    private static final String PROPERTY_H2_SERVER = "h2Server";
75
    private static final String H2_SERVER_RUNNING = "h2ServerIsRunning";
75 76

  
76 77
    /**
77 78
     * List of the tables which are initially being populated during term loading. {@link PersistentTermInitializer}
......
141 142
    @Before
142 143
    public void startH2Server() throws Exception {
143 144

  
144
        if(System.getProperty(PROPERTY_H2_SERVER) != null){
145
        if(System.getProperty(PROPERTY_H2_SERVER) != null && System.getProperty(H2_SERVER_RUNNING) == null){
145 146
            try {
147
                // printing to System.out, so that developers get feedback always
148
                System.out.println("####################################################");
149
                System.out.println("  Starting h2 web server ...");
146 150
                List<String> args = new ArrayList<String>();
151
                Integer port = null;
147 152
                try {
148
                    Integer port = Integer.parseInt(System.getProperty(PROPERTY_H2_SERVER));
153
                    port = Integer.parseInt(System.getProperty(PROPERTY_H2_SERVER));
149 154
                    args.add("-webPort");
150 155
                    args.add(port.toString());
151 156
                } catch (Exception e) {
152
                    // will start at port 8082 by default
157
                    // the default port is 8082
153 158
                }
154 159
                Server.createWebServer(args.toArray(new String[]{})).start();
160
                System.setProperty(H2_SERVER_RUNNING, "true");
161
                System.out.println("  you can connect to the h2 web server by opening");
162
                System.out.println("  http://localhost:" + (port != null ? port : "8082") + "/ in your browser");
163
                System.out.println("#####################################################");
155 164
            } catch (SQLException e) {
156 165
                e.printStackTrace();
157 166
            }

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)