Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce micronaut-context subproject that micronaut-runtime depends…
… on (#4914)
- Loading branch information
1 parent
1601976
commit f81ecea
Showing
138 changed files
with
614 additions
and
426 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
dependencies { | ||
annotationProcessor project(":inject-java") | ||
annotationProcessor project(":graal") | ||
api project(':inject') | ||
api project(':aop') | ||
api dependencyVersion("validation") | ||
compileOnly dependencyVersion("reactive.streams") | ||
testCompileOnly project(":inject-groovy") | ||
testAnnotationProcessor project(":inject-java") | ||
testImplementation dependencyVersion("rxjava2") | ||
testImplementation project(":core-reactive") | ||
testImplementation project(":inject-java-test") | ||
} | ||
|
||
spotless { | ||
java { | ||
targetExclude '**/io/micronaut/scheduling/cron/CronExpression.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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
44 changes: 44 additions & 0 deletions
44
context/src/test/groovy/io/micronaut/runtime/event/annotation/AsyncListener.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,44 @@ | ||
/* | ||
* Copyright 2017-2020 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 io.micronaut.runtime.event.annotation; | ||
|
||
import io.micronaut.context.event.StartupEvent; | ||
import io.micronaut.scheduling.annotation.Async; | ||
import io.reactivex.Completable; | ||
|
||
import javax.inject.Singleton; | ||
import java.util.concurrent.CompletableFuture; | ||
|
||
@Singleton | ||
public class AsyncListener { | ||
|
||
boolean invoked = false; | ||
|
||
@EventListener | ||
@Async | ||
CompletableFuture<Boolean> onStartup(StartupEvent event) { | ||
try { | ||
Thread.currentThread().sleep(500); | ||
} catch (InterruptedException e) { | ||
e.printStackTrace(); | ||
} | ||
invoked = true; | ||
return CompletableFuture.completedFuture(invoked); | ||
} | ||
public boolean isInvoked() { | ||
return invoked; | ||
} | ||
} |
File renamed without changes.
46 changes: 46 additions & 0 deletions
46
context/src/test/groovy/io/micronaut/runtime/event/annotation/EventListenerSpec.groovy
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,46 @@ | ||
/* | ||
* Copyright 2017-2019 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 | ||
* | ||
* 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 io.micronaut.runtime.event.annotation | ||
|
||
import io.micronaut.context.ApplicationContext | ||
import spock.lang.Specification | ||
import spock.util.concurrent.PollingConditions | ||
|
||
class EventListenerSpec extends Specification { | ||
|
||
void "test listener is invoked"() { | ||
given: | ||
ApplicationContext ctx = ApplicationContext.run() | ||
|
||
when: | ||
TestListener t = ctx.getBean(TestListener) | ||
GroovyListener g = ctx.getBean(GroovyListener) | ||
AsyncListener a = ctx.getBean(AsyncListener) | ||
PollingConditions conditions = new PollingConditions(timeout: 1) | ||
|
||
then: | ||
t.invoked | ||
t.invocationCount == 1 | ||
g.invoked | ||
|
||
conditions.eventually { | ||
a.invoked | ||
} | ||
|
||
cleanup: | ||
ctx.close() | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.