Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* tck with testNG Co-authored-by: brunobat <brunobat@gmail.com> Co-authored-by: Andrew Rouse <anrouse@uk.ibm.com>
- Loading branch information
1 parent
cf69a44
commit 68f452f
Showing
18 changed files
with
558 additions
and
302 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
target/ | ||
.vscode/ | ||
*.DS_Store | ||
.project | ||
.classpath | ||
.settings | ||
.checkstyle | ||
bin/ |
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
77 changes: 77 additions & 0 deletions
77
...ing/tck/src/main/java/org/eclipse/microprofile/telemetry/tracing/tck/BasicHttpClient.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,77 @@ | ||
/* | ||
* Copyright (c) 2022 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* 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. | ||
* | ||
*/ | ||
package org.eclipse.microprofile.telemetry.tracing.tck; | ||
|
||
import java.net.HttpURLConnection; | ||
import java.net.URI; | ||
import java.net.URISyntaxException; | ||
import java.net.URL; | ||
|
||
import org.jboss.arquillian.test.api.ArquillianResource; | ||
|
||
/** | ||
* A really basic client for doing Http requests | ||
* <p> | ||
* For use when we don't want to use JAX-RS client or something else which has integration with telemetry | ||
*/ | ||
public class BasicHttpClient { | ||
|
||
private URI baseUri; | ||
|
||
/** | ||
* @param baseUrl | ||
* The base URL. Any path requested through this client will be appended to this URL. This should usually | ||
* be a URL injected using {@link ArquillianResource} | ||
*/ | ||
public BasicHttpClient(URL baseUrl) { | ||
try { | ||
baseUri = baseUrl.toURI(); | ||
} catch (URISyntaxException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
/** | ||
* Makes a GET request to a path and returns the response code | ||
* | ||
* @param path | ||
* the path to request, relative to the baseUrl | ||
* @return the response code | ||
*/ | ||
public int get(String path) { | ||
if (path.startsWith("/")) { | ||
path = path.substring(1); | ||
} | ||
try { | ||
URL spanUrl = baseUri.resolve(path).toURL(); | ||
HttpURLConnection connection = (HttpURLConnection) spanUrl.openConnection(); | ||
try { | ||
return connection.getResponseCode(); | ||
} catch (Exception e) { | ||
throw new RuntimeException("Exception retriving " + spanUrl, e); | ||
} finally { | ||
connection.disconnect(); | ||
} | ||
} catch (Exception e) { | ||
throw new RuntimeException("Exception retriving path " + path, e); | ||
} | ||
} | ||
|
||
} |
51 changes: 51 additions & 0 deletions
51
tracing/tck/src/main/java/org/eclipse/microprofile/telemetry/tracing/tck/ConfigAsset.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,51 @@ | ||
/* | ||
* Copyright (c) 2022 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* 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. | ||
* | ||
*/ | ||
package org.eclipse.microprofile.telemetry.tracing.tck; | ||
|
||
import java.io.ByteArrayInputStream; | ||
import java.io.ByteArrayOutputStream; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.util.Properties; | ||
|
||
import org.jboss.shrinkwrap.api.asset.Asset; | ||
|
||
public class ConfigAsset implements Asset { | ||
|
||
private Properties properties = new Properties(); | ||
|
||
@Override | ||
public InputStream openStream() { | ||
try { | ||
ByteArrayOutputStream os = new ByteArrayOutputStream(); | ||
properties.store(os, null); | ||
return new ByteArrayInputStream(os.toByteArray()); | ||
} catch (IOException e) { | ||
// Shouldn't happen since we're only using in memory streams | ||
throw new RuntimeException("Unexpected error saving properties", e); | ||
} | ||
} | ||
|
||
public ConfigAsset add(String key, String value) { | ||
properties.put(key, value); | ||
return this; | ||
} | ||
|
||
} |
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
32 changes: 32 additions & 0 deletions
32
tracing/tck/src/main/java/org/eclipse/microprofile/telemetry/tracing/tck/TestLibraries.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,32 @@ | ||
/* | ||
* Copyright (c) 2022 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* 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. | ||
* | ||
*/ | ||
package org.eclipse.microprofile.telemetry.tracing.tck; | ||
|
||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
|
||
public class TestLibraries { | ||
|
||
public static final JavaArchive AWAITILITY_LIB = ShrinkWrap.create(JavaArchive.class, "awaitility.jar") | ||
.addPackages(true, "org.awaitility", "org.hamcrest"); | ||
|
||
private TestLibraries() { | ||
} | ||
} |
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
Oops, something went wrong.