Search in sources :

Example 1 with TaskRepository

use of io.crnk.internal.boot.cdi.model.TaskRepository 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)

Aggregations

CdiServiceDiscovery (io.crnk.cdi.internal.CdiServiceDiscovery)1 DefaultServiceDiscoveryFactory (io.crnk.core.module.discovery.DefaultServiceDiscoveryFactory)1 ServiceDiscovery (io.crnk.core.module.discovery.ServiceDiscovery)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 Test (org.junit.Test)1