Search in sources :

Example 1 with DefaultServiceDiscoveryFactory

use of io.crnk.core.module.discovery.DefaultServiceDiscoveryFactory in project crnk-framework by crnk-project.

the class CdiServiceDiscoveryTest method testFactory.

@Test
public void testFactory() {
    DefaultServiceDiscoveryFactory factory = new DefaultServiceDiscoveryFactory();
    ServiceDiscovery instance = factory.getInstance();
    Assert.assertNotNull(instance);
    Assert.assertEquals(CdiServiceDiscovery.class, instance.getClass());
    List<?> repositories = instance.getInstancesByType(Repository.class);
    Assert.assertEquals(1, repositories.size());
    Assert.assertTrue(repositories.get(0) instanceof ProjectRepository);
    repositories = instance.getInstancesByAnnotation(JsonApiResourceRepository.class);
    Assert.assertEquals(1, repositories.size());
    Assert.assertTrue(repositories.get(0) instanceof TaskRepository);
}
Also used : ProjectRepository(io.crnk.internal.boot.cdi.model.ProjectRepository) DefaultServiceDiscoveryFactory(io.crnk.core.module.discovery.DefaultServiceDiscoveryFactory) JsonApiResourceRepository(io.crnk.legacy.repository.annotations.JsonApiResourceRepository) TaskRepository(io.crnk.internal.boot.cdi.model.TaskRepository) CdiServiceDiscovery(io.crnk.cdi.internal.CdiServiceDiscovery) ServiceDiscovery(io.crnk.core.module.discovery.ServiceDiscovery) Test(org.junit.Test)

Example 2 with DefaultServiceDiscoveryFactory

use of io.crnk.core.module.discovery.DefaultServiceDiscoveryFactory in project crnk-framework by crnk-project.

the class CdiTransactionRunnerTest method setup.

@Before
public void setup() {
    DefaultServiceDiscoveryFactory factory = new DefaultServiceDiscoveryFactory();
    ServiceDiscovery instance = factory.getInstance();
    List<TransactionRunner> runners = instance.getInstancesByType(TransactionRunner.class);
    Assert.assertEquals(1, runners.size());
    runner = runners.get(0);
}
Also used : DefaultServiceDiscoveryFactory(io.crnk.core.module.discovery.DefaultServiceDiscoveryFactory) CdiTransactionRunner(io.crnk.cdi.internal.CdiTransactionRunner) TransactionRunner(io.crnk.core.engine.transaction.TransactionRunner) ServiceDiscovery(io.crnk.core.module.discovery.ServiceDiscovery) Before(org.junit.Before)

Aggregations

DefaultServiceDiscoveryFactory (io.crnk.core.module.discovery.DefaultServiceDiscoveryFactory)2 ServiceDiscovery (io.crnk.core.module.discovery.ServiceDiscovery)2 CdiServiceDiscovery (io.crnk.cdi.internal.CdiServiceDiscovery)1 CdiTransactionRunner (io.crnk.cdi.internal.CdiTransactionRunner)1 TransactionRunner (io.crnk.core.engine.transaction.TransactionRunner)1 ProjectRepository (io.crnk.internal.boot.cdi.model.ProjectRepository)1 TaskRepository (io.crnk.internal.boot.cdi.model.TaskRepository)1 JsonApiResourceRepository (io.crnk.legacy.repository.annotations.JsonApiResourceRepository)1 Before (org.junit.Before)1 Test (org.junit.Test)1