@Test public void resolveTypeAttachment() throws ComponentLookupException { assertEquals( new AttachmentReference(ATTACHMENT, new DocumentReference(WIKI, Arrays.asList(SPACE, PAGE), DEFAULT_PAGE)), this.mocker.getComponentUnderTest() .resolve(attachmentResource(WIKI + ':' + SPACE + '.' + PAGE + '@' + ATTACHMENT, true), null)); assertEquals( new AttachmentReference(ATTACHMENT, new DocumentReference(CURRENT_WIKI, Arrays.asList(SPACE, PAGE), DEFAULT_PAGE)), this.mocker.getComponentUnderTest().resolve(attachmentResource(SPACE + '.' + PAGE + '@' + ATTACHMENT, true), null)); assertEquals( new AttachmentReference(ATTACHMENT, new DocumentReference(CURRENT_WIKI, Arrays.asList(CURRENT_SPACE, PAGE), DEFAULT_PAGE)), this.mocker.getComponentUnderTest().resolve(attachmentResource(PAGE + '@' + ATTACHMENT, true), null)); this.existingDocuments.add(new DocumentReference(WIKI, SPACE, PAGE)); assertEquals(new AttachmentReference(ATTACHMENT, new DocumentReference(WIKI, SPACE, PAGE)), this.mocker.getComponentUnderTest() .resolve(attachmentResource(WIKI + ':' + SPACE + '.' + PAGE + '@' + ATTACHMENT, true), null)); this.existingDocuments.add(new DocumentReference(CURRENT_WIKI, SPACE, PAGE)); assertEquals(new AttachmentReference(ATTACHMENT, new DocumentReference(CURRENT_WIKI, SPACE, PAGE)), this.mocker .getComponentUnderTest().resolve(attachmentResource(SPACE + '.' + PAGE + '@' + ATTACHMENT, true), null)); this.existingDocuments.add(new DocumentReference(CURRENT_WIKI, CURRENT_SPACE, PAGE)); assertEquals(new AttachmentReference(ATTACHMENT, new DocumentReference(CURRENT_WIKI, CURRENT_SPACE, PAGE)), this.mocker.getComponentUnderTest().resolve(attachmentResource(PAGE + '@' + ATTACHMENT, true), null)); assertEquals( new AttachmentReference(ATTACHMENT, new DocumentReference(CURRENT_WIKI, CURRENT_SPACE, CURRENT_PAGE)), this.mocker.getComponentUnderTest().resolve(attachmentResource(ATTACHMENT, true), null)); this.existingDocuments.add(new DocumentReference(CURRENT_WIKI, CURRENT_SPACE, CURRENT_PAGE)); assertEquals( new AttachmentReference(ATTACHMENT, new DocumentReference(CURRENT_WIKI, CURRENT_SPACE, CURRENT_PAGE)), this.mocker.getComponentUnderTest().resolve(attachmentResource(ATTACHMENT, true), null)); }
@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; }