forked from camunda/camunda-bpm-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(engine-rest): retry server start when port still bound (camunda#…
…3536) * Supports retrying server startups when the address is still bound. Occasionally, the OS can take more time to release the port physically after we stop our test server instance. Before we start it again for the next test class, we might have to wait and retry. related to camunda#3535
- Loading branch information
Showing
8 changed files
with
190 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
...est/src/test/java/org/camunda/bpm/engine/rest/util/container/AbstractServerBootstrap.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH | ||
* under one or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information regarding copyright | ||
* ownership. Camunda licenses this file to you under the Apache License, | ||
* Version 2.0; 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. | ||
*/ | ||
package org.camunda.bpm.engine.rest.util.container; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.util.Properties; | ||
import org.camunda.bpm.engine.rest.AbstractRestServiceTest; | ||
|
||
public abstract class AbstractServerBootstrap { | ||
|
||
protected static final String PORT_PROPERTY = "rest.http.port"; | ||
protected static final String ROOT_RESOURCE_PATH = "/rest-test"; | ||
protected static final String PROPERTIES_FILE = "/testconfig.properties"; | ||
|
||
protected static final int STARTUP_RETRIES = 3; | ||
|
||
public abstract void stop(); | ||
|
||
public void start() { | ||
startServer(STARTUP_RETRIES); | ||
} | ||
|
||
protected abstract void startServer(int startUpRetries); | ||
|
||
protected Properties readProperties() { | ||
InputStream propStream = null; | ||
Properties properties = new Properties(); | ||
|
||
try { | ||
propStream = AbstractRestServiceTest.class.getResourceAsStream(PROPERTIES_FILE); | ||
properties.load(propStream); | ||
} catch (IOException e) { | ||
throw new ServerBootstrapException(e); | ||
} finally { | ||
try { | ||
propStream.close(); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
return properties; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.