@Test public void resolveTypeSpace() throws ComponentLookupException { assertEquals(new SpaceReference(WIKI, SPACE), this.mocker.getComponentUnderTest().resolve(spaceResource(WIKI + ':' + SPACE, true), null)); assertEquals(new SpaceReference(CURRENT_WIKI, SPACE), this.mocker.getComponentUnderTest().resolve(spaceResource(SPACE, true), null)); assertEquals(new SpaceReference(CURRENT_WIKI, CURRENT_SPACE), this.mocker.getComponentUnderTest().resolve(spaceResource("", true), null)); when(this.currentEntityReferenceResolver.resolve(eq(WIKI + ':' + SPACE + '.' + PAGE), eq(EntityType.DOCUMENT), any())).thenReturn(new DocumentReference(WIKI, SPACE, PAGE)); ResourceReference withBaseReference = spaceResource("", true); withBaseReference.addBaseReference(WIKI + ':' + SPACE + '.' + PAGE); assertEquals(new SpaceReference(WIKI, SPACE), this.mocker.getComponentUnderTest().resolve(withBaseReference, null)); assertEquals(new SpaceReference(WIKI, SPACE), this.mocker.getComponentUnderTest() .resolve(spaceResource("", 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; }