use of io.crnk.legacy.locator.SampleJsonServiceLocator in project crnk-framework by crnk-project.
the class CrnkFeatureTest method testQuerySpecConstructor.
@Test
public void testQuerySpecConstructor() {
ObjectMapper objectMapper = new ObjectMapper();
QuerySpecDeserializer querySpecDeserializer = new DefaultQuerySpecDeserializer();
SampleJsonServiceLocator serviceLocator = new SampleJsonServiceLocator();
CrnkFeature feature = new CrnkFeature(objectMapper, querySpecDeserializer, serviceLocator);
Assert.assertSame(objectMapper, feature.getObjectMapper());
Assert.assertSame(querySpecDeserializer, feature.getBoot().getQuerySpecDeserializer());
}
use of io.crnk.legacy.locator.SampleJsonServiceLocator in project crnk-framework by crnk-project.
the class JpaExceptionMapperTests method setup.
@Before
public void setup() {
boot = new CrnkBoot();
boot.addModule(JpaModule.newClientModule());
boot.setServiceUrlProvider(new ConstantServiceUrlProvider("http://localhost"));
boot.setServiceDiscovery(new ReflectionsServiceDiscovery("io.crnk.jpa.mock.model", new SampleJsonServiceLocator()));
boot.boot();
}
use of io.crnk.legacy.locator.SampleJsonServiceLocator in project crnk-framework by crnk-project.
the class AnnotatedRelationshipEntryBuilderTest method onInstanceOfAnnotatedRelationshipRepositoryShouldReturnTargetClass.
@Test
public void onInstanceOfAnnotatedRelationshipRepositoryShouldReturnTargetClass() {
// GIVEN
final AnnotatedRelationshipEntryBuilder builder = new AnnotatedRelationshipEntryBuilder(moduleRegistry, new RepositoryInstanceBuilder(new SampleJsonServiceLocator(), SimpleRelationshipRepository.class));
// WHEN
final String targetResourceType = builder.getTargetResourceType();
// THEN
assertThat(targetResourceType).isEqualTo("projects");
}
use of io.crnk.legacy.locator.SampleJsonServiceLocator in project crnk-framework by crnk-project.
the class FallbackServiceDiscoveryFactoryTest method returnDefaultDiscoveryIfAvailable.
@Test
public void returnDefaultDiscoveryIfAvailable() {
PropertiesProvider propertiesProvider = new NullPropertiesProvider();
DefaultServiceDiscoveryFactory defaultFactory = new DefaultServiceDiscoveryFactory();
FallbackServiceDiscoveryFactory fallbackFactory = new FallbackServiceDiscoveryFactory(defaultFactory, new SampleJsonServiceLocator(), propertiesProvider);
Assert.assertTrue(fallbackFactory.getInstance() instanceof TestServiceDiscovery);
}
use of io.crnk.legacy.locator.SampleJsonServiceLocator in project crnk-framework by crnk-project.
the class FallbackServiceDiscoveryFactoryTest method fallbackToEmptyDiscoveryIfNoPackageAndDefaultAvailable.
@Test
public void fallbackToEmptyDiscoveryIfNoPackageAndDefaultAvailable() {
PropertiesProvider propertiesProvider = Mockito.mock(PropertiesProvider.class);
ServiceDiscoveryFactory defaultFactory = new ServiceDiscoveryFactory() {
@Override
public ServiceDiscovery getInstance() {
return null;
}
};
FallbackServiceDiscoveryFactory fallbackFactory = new FallbackServiceDiscoveryFactory(defaultFactory, new SampleJsonServiceLocator(), propertiesProvider);
Assert.assertTrue(fallbackFactory.getInstance() instanceof EmptyServiceDiscovery);
}
Aggregations