-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce cache injection and NoOpCache
- Loading branch information
Showing
28 changed files
with
656 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
48 changes: 48 additions & 0 deletions
48
.../deployment/src/test/java/io/quarkus/cache/test/deployment/UnknownFieldCacheNameTest.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,48 @@ | ||
package io.quarkus.cache.test.deployment; | ||
|
||
import static org.junit.jupiter.api.Assertions.fail; | ||
|
||
import javax.enterprise.context.ApplicationScoped; | ||
import javax.enterprise.context.Dependent; | ||
import javax.enterprise.inject.spi.DeploymentException; | ||
import javax.inject.Inject; | ||
|
||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.cache.Cache; | ||
import io.quarkus.cache.CacheName; | ||
import io.quarkus.cache.CacheResult; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class UnknownFieldCacheNameTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest TEST = new QuarkusUnitTest() | ||
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class).addClasses(CachedService.class, TestBean.class)) | ||
.setExpectedException(DeploymentException.class); | ||
|
||
@Test | ||
public void shouldNotBeInvoked() { | ||
fail("This method should not be invoked"); | ||
} | ||
|
||
@ApplicationScoped | ||
static class CachedService { | ||
|
||
@CacheResult(cacheName = "test-cache") | ||
public Object getObject(Object key) { | ||
return new Object(); | ||
} | ||
} | ||
|
||
@Dependent | ||
static class TestBean { | ||
|
||
@Inject | ||
@CacheName("unknown-cache") | ||
Cache cache; | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
...t/src/test/java/io/quarkus/cache/test/deployment/UnknownMethodParameterCacheNameTest.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,46 @@ | ||
package io.quarkus.cache.test.deployment; | ||
|
||
import static org.junit.jupiter.api.Assertions.fail; | ||
|
||
import javax.enterprise.context.ApplicationScoped; | ||
import javax.enterprise.context.Dependent; | ||
import javax.enterprise.inject.spi.DeploymentException; | ||
|
||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.cache.Cache; | ||
import io.quarkus.cache.CacheName; | ||
import io.quarkus.cache.CacheResult; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class UnknownMethodParameterCacheNameTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest TEST = new QuarkusUnitTest() | ||
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class).addClasses(CachedService.class, TestBean.class)) | ||
.setExpectedException(DeploymentException.class); | ||
|
||
@Test | ||
public void shouldNotBeInvoked() { | ||
fail("This method should not be invoked"); | ||
} | ||
|
||
@ApplicationScoped | ||
static class CachedService { | ||
|
||
@CacheResult(cacheName = "test-cache") | ||
public Object getObject(Object key) { | ||
return new Object(); | ||
} | ||
} | ||
|
||
@Dependent | ||
static class TestBean { | ||
|
||
public void unknownCacheName(@CacheName("unknown-cache") Cache cache) { | ||
} | ||
} | ||
} |
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.