Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Gradle plugin to build protocol tests #263

Merged
merged 2 commits into from
Jan 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ Then, apply the Smithy Gradle Plugin in your `build.gradle.kts` file and run

```kotlin
plugins {
java
id("software.amazon.smithy").version("0.4.2")
id("software.amazon.smithy").version("0.4.3")
}
```

Expand Down
6 changes: 3 additions & 3 deletions docs/source/guides/building-models/gradle-plugin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The following example configures a project to use the Smithy Gradle plugin:
.. code-tab:: kotlin

plugins {
id("software.amazon.smithy").version("0.4.2")
id("software.amazon.smithy").version("0.4.3")
}


Expand Down Expand Up @@ -138,7 +138,7 @@ The following example ``build.gradle.kts`` will build a Smithy model using a
.. code-tab:: kotlin

plugins {
id("software.amazon.smithy").version("0.4.2")
id("software.amazon.smithy").version("0.4.3")
}

// The SmithyExtension is used to customize the build. This example
Expand Down Expand Up @@ -184,7 +184,7 @@ build that uses the "external" projection.
.. code-tab:: kotlin

plugins {
id("software.amazon.smithy").version("0.4.2")
id("software.amazon.smithy").version("0.4.3")
}

buildscript {
Expand Down
2 changes: 1 addition & 1 deletion docs/source/guides/converting-to-openapi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ specification from a Smithy model using a buildscript dependency:

plugins {
java
id("software.amazon.smithy").version("0.4.2")
id("software.amazon.smithy").version("0.4.3")
}

buildscript {
Expand Down
9 changes: 7 additions & 2 deletions smithy-aws-protocol-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ description = "Defines protocol tests for AWS HTTP protocols."
extra["displayName"] = "Smithy :: AWS :: Protocol Tests"
extra["moduleName"] = "software.amazon.smithy.aws.protocoltests"

plugins {
id("software.amazon.smithy").version("0.4.3")
}

dependencies {
api(project(":smithy-protocol-test-traits"))
api(project(":smithy-aws-traits"))
compile(project(":smithy-cli"))
implementation(project(":smithy-protocol-test-traits"))
implementation(project(":smithy-aws-traits"))
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
package software.amazon.smithy.aws.traits;

import org.junit.jupiter.api.Test;
import software.amazon.smithy.model.Model;
import software.amazon.smithy.model.loader.ModelAssembler;
import java.util.concurrent.Callable;
import java.util.stream.Stream;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import software.amazon.smithy.model.validation.testrunner.SmithyTestCase;
import software.amazon.smithy.model.validation.testrunner.SmithyTestSuite;

public class TestRunnerTest {
@Test
public void testRunner() {
ModelAssembler assembler = Model.assembler(getClass().getClassLoader())
.discoverModels(getClass().getClassLoader());
@ParameterizedTest(name = "{0}")
@MethodSource("source")
public void testRunner(String filename, Callable<SmithyTestCase.Result> callable) throws Exception {
callable.call();
}

System.out.println(SmithyTestSuite.runner()
.setModelAssemblerFactory(assembler::copy)
.addTestCasesFromUrl(TestRunnerTest.class.getResource("errorfiles"))
.run());
public static Stream<?> source() {
return SmithyTestSuite.defaultParameterizedTestSource(TestRunnerTest.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,25 @@ void applyAllProjections(
} else {
parallelProjectionNameOrder.add(name);
parallelProjections.add(() -> {
ProjectionResult projectionResult = applyProjection(name, config, resolvedModel);
projectionResultConsumer.accept(projectionResult);
executeSerialProjection(resolvedModel, name, config,
projectionResultConsumer, projectionExceptionConsumer);
return null;
});
}
}

if (!parallelProjections.isEmpty()) {
// Common case of only executing a single plugin per/projection.
if (parallelProjections.size() == 1) {
try {
parallelProjections.get(0).call();
} catch (Throwable e) {
if (e instanceof RuntimeException) {
throw (RuntimeException) e;
} else {
throw new RuntimeException(e);
}
}
} else if (!parallelProjections.isEmpty()) {
executeParallelProjections(parallelProjections, parallelProjectionNameOrder, projectionExceptionConsumer);
}
}
Expand Down
Loading