@Test public void resolveTypeDocument() throws ComponentLookupException { assertEquals(new DocumentReference(WIKI, SPACE, PAGE), this.mocker.getComponentUnderTest().resolve(documentResource(WIKI + ':' + SPACE + '.' + PAGE, true), null)); assertEquals(new DocumentReference(CURRENT_WIKI, SPACE, PAGE), this.mocker.getComponentUnderTest().resolve(documentResource(SPACE + '.' + PAGE, true), null)); assertEquals(new DocumentReference(CURRENT_WIKI, CURRENT_SPACE, PAGE), this.mocker.getComponentUnderTest().resolve(documentResource(PAGE, true), null)); assertEquals(new DocumentReference(CURRENT_WIKI, CURRENT_SPACE, CURRENT_PAGE), this.mocker.getComponentUnderTest().resolve(documentResource("", true), null)); when(this.currentEntityReferenceResolver.resolve(eq(WIKI + ':' + SPACE + '.' + PAGE), eq(EntityType.DOCUMENT), any())).thenReturn(new DocumentReference(WIKI, SPACE, PAGE)); ResourceReference withBaseReference = documentResource("", true); withBaseReference.addBaseReference(WIKI + ':' + SPACE + '.' + PAGE); assertEquals(new DocumentReference(WIKI, SPACE, PAGE), this.mocker.getComponentUnderTest().resolve(withBaseReference, null)); assertEquals(new DocumentReference(WIKI, SPACE, PAGE), this.mocker.getComponentUnderTest() .resolve(documentResource("", true), null, new DocumentReference(WIKI, SPACE, PAGE))); }
@Override public EntityReference resolve(ResourceReference resourceReference, EntityType type, Object... parameters) { if (resourceReference == null) { return null; } if (this.componentManagerProvider.get().hasComponent(TYPE_RESOURCEREFERENCE, resourceReference.getType().getScheme())) { EntityReferenceResolver<ResourceReference> resolver; try { resolver = this.componentManagerProvider.get().getInstance(TYPE_RESOURCEREFERENCE, resourceReference.getType().getScheme()); } catch (ComponentLookupException e) { throw new RuntimeException( String.format("Unknown error when trying to load resolver for reference [%s]", resourceReference), e); } return resolver.resolve(resourceReference, type, parameters); } return null; }
DefaultResourceReferenceEntityReferenceResolver implements EntityReferenceResolver<ResourceReference> { @Override public EntityReference resolve(ResourceReference resourceReference, EntityType type, Object... parameters) { if (resourceReference == null) { return null; } if (this.componentManagerProvider.get().hasComponent(TYPE_RESOURCEREFERENCE, resourceReference.getType().getScheme())) { EntityReferenceResolver<ResourceReference> resolver; try { resolver = this.componentManagerProvider.get().getInstance(TYPE_RESOURCEREFERENCE, resourceReference.getType().getScheme()); } catch (ComponentLookupException e) { throw new RuntimeException( String.format("Unknown error when trying to load resolver for reference [%s]", resourceReference), e); } return resolver.resolve(resourceReference, type, parameters); } return null; } }
DefaultResourceReferenceEntityReferenceResolver implements EntityReferenceResolver<ResourceReference> { @Override public EntityReference resolve(ResourceReference resourceReference, EntityType type, Object... parameters) { if (resourceReference == null) { return null; } if (this.componentManagerProvider.get().hasComponent(TYPE_RESOURCEREFERENCE, resourceReference.getType().getScheme())) { EntityReferenceResolver<ResourceReference> resolver; try { resolver = this.componentManagerProvider.get().getInstance(TYPE_RESOURCEREFERENCE, resourceReference.getType().getScheme()); } catch (ComponentLookupException e) { throw new RuntimeException( String.format("Unknown error when trying to load resolver for reference [%s]", resourceReference), e); } return resolver.resolve(resourceReference, type, parameters); } return null; }  }
DefaultResourceReferenceEntityReferenceResolver implements EntityReferenceResolver<ResourceReference> { @Override public EntityReference resolve(ResourceReference resourceReference, EntityType type, Object... parameters) { if (resourceReference == null) { return null; } if (this.componentManagerProvider.get().hasComponent(TYPE_RESOURCEREFERENCE, resourceReference.getType().getScheme())) { EntityReferenceResolver<ResourceReference> resolver; try { resolver = this.componentManagerProvider.get().getInstance(TYPE_RESOURCEREFERENCE, resourceReference.getType().getScheme()); } catch (ComponentLookupException e) { throw new RuntimeException( String.format("Unknown error when trying to load resolver for reference [%s]", resourceReference), e); } return resolver.resolve(resourceReference, type, parameters); } return null; }  @Override EntityReference resolve(ResourceReference resourceReference, EntityType type, Object... parameters); }
DefaultResourceReferenceEntityReferenceResolver implements EntityReferenceResolver<ResourceReference> { @Override public EntityReference resolve(ResourceReference resourceReference, EntityType type, Object... parameters) { if (resourceReference == null) { return null; } if (this.componentManagerProvider.get().hasComponent(TYPE_RESOURCEREFERENCE, resourceReference.getType().getScheme())) { EntityReferenceResolver<ResourceReference> resolver; try { resolver = this.componentManagerProvider.get().getInstance(TYPE_RESOURCEREFERENCE, resourceReference.getType().getScheme()); } catch (ComponentLookupException e) { throw new RuntimeException( String.format("Unknown error when trying to load resolver for reference [%s]", resourceReference), e); } return resolver.resolve(resourceReference, type, parameters); } return null; }  @Override EntityReference resolve(ResourceReference resourceReference, EntityType type, Object... parameters); static final ParameterizedType TYPE_RESOURCEREFERENCE; }