-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove @parallel because otherwise misformated annotation values don'…
…t break startup
- Loading branch information
1 parent
46be486
commit 876728e
Showing
4 changed files
with
123 additions
and
2 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
...e/src/test/java/info/novatec/micronaut/zeebe/client/example/AnnotationPropertiesTest.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 2022 original authors | ||
* | ||
* 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 | ||
* | ||
* https://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 info.novatec.micronaut.zeebe.client.example; | ||
|
||
import io.micronaut.context.ApplicationContext; | ||
import io.micronaut.runtime.server.EmbeddedServer; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.time.format.DateTimeParseException; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.junit.jupiter.api.Assertions.assertThrows; | ||
|
||
/** | ||
* @author Tobias Schäfer | ||
*/ | ||
class AnnotationPropertiesTest { | ||
|
||
@Test | ||
void testValidAnnotation() { | ||
Map<String, Object> properties = new HashMap<>(); | ||
properties.put("handlerWithInvalidAnnotationPropertiesEnabled", false); | ||
try (EmbeddedServer embeddedServer = ApplicationContext.run(EmbeddedServer.class, properties)) { | ||
assertThat(embeddedServer.isRunning()).isTrue(); | ||
assertThat(embeddedServer.getApplicationContext().containsBean(HandlerWithAllAnnotationProperties.class)).isTrue(); | ||
} | ||
} | ||
|
||
@Test | ||
void testInvalidAnnotation() { | ||
Map<String, Object> properties = new HashMap<>(); | ||
properties.put("handlerWithInvalidAnnotationPropertiesEnabled", true); | ||
assertThrows(DateTimeParseException.class, () -> ApplicationContext.run(EmbeddedServer.class, properties)); | ||
} | ||
|
||
} |
35 changes: 35 additions & 0 deletions
35
.../java/info/novatec/micronaut/zeebe/client/example/HandlerWithAllAnnotationProperties.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,35 @@ | ||
/* | ||
* Copyright 2022 original authors | ||
* | ||
* 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 | ||
* | ||
* https://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 info.novatec.micronaut.zeebe.client.example; | ||
|
||
import info.novatec.micronaut.zeebe.client.feature.ZeebeWorker; | ||
import io.camunda.zeebe.client.api.response.ActivatedJob; | ||
import io.camunda.zeebe.client.api.worker.JobClient; | ||
import jakarta.inject.Singleton; | ||
|
||
/** | ||
* This handler contains all possible annotation properties. It will never be called but the values will be parsed on startup. | ||
* | ||
* @author Tobias Schäfer | ||
*/ | ||
@Singleton | ||
public class HandlerWithAllAnnotationProperties { | ||
|
||
@ZeebeWorker(type = "some-random-type", timeout = "PT1S", requestTimeout = "PT2S", pollInterval = "PT3S", maxJobsActive = 99) | ||
public void doSomething(JobClient client, ActivatedJob job) { | ||
throw new UnsupportedOperationException(""); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
...a/info/novatec/micronaut/zeebe/client/example/HandlerWithInvalidAnnotationProperties.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,37 @@ | ||
/* | ||
* Copyright 2022 original authors | ||
* | ||
* 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 | ||
* | ||
* https://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 info.novatec.micronaut.zeebe.client.example; | ||
|
||
import info.novatec.micronaut.zeebe.client.feature.ZeebeWorker; | ||
import io.camunda.zeebe.client.api.response.ActivatedJob; | ||
import io.camunda.zeebe.client.api.worker.JobClient; | ||
import io.micronaut.context.annotation.Requires; | ||
import jakarta.inject.Singleton; | ||
|
||
/** | ||
* This handler contains an invalid annotation properties which will make the startup fail. | ||
* | ||
* @author Tobias Schäfer | ||
*/ | ||
@Singleton | ||
@Requires(property = "handlerWithInvalidAnnotationPropertiesEnabled", value="true") | ||
public class HandlerWithInvalidAnnotationProperties { | ||
|
||
@ZeebeWorker(type = "some-random-type-invalid", timeout = "TwentySeconds") | ||
public void doSomething(JobClient client, ActivatedJob job) { | ||
throw new UnsupportedOperationException(""); | ||
} | ||
} |
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