@Test public void testViewExistingOfficeFileWithCacheHit() throws Exception { ResourceReference resourceReference = new ResourceReference("http: when(this.resourceReferenceSerializer.serialize(resourceReference)).thenReturn( "url:" + resourceReference.getReference()); OfficeDocumentView officeDocumentView = new OfficeDocumentView(resourceReference, new XDOM(new ArrayList<Block>()), new HashSet<File>()); when( externalCache.get(STRING_DOCUMENT_REFERENCE + "/url:http: .thenReturn(officeDocumentView); Assert.assertNotNull(mocker.getComponentUnderTest().createView(resourceReference, DEFAULT_VIEW_PARAMETERS)); }
@Override public XDOM createView(ResourceReference reference, Map<String, ?> parameters) throws Exception { OfficeDocumentView view; if (reference.getType().equals(ResourceType.ATTACHMENT) || reference.getType().equals(ResourceType.UNKNOWN)) { AttachmentReference attachmentReference = this.attachmentResolver.resolve(reference.getReference()); view = getView(reference, attachmentReference, parameters); } else { view = getView(reference, parameters); } return view.getXDOM().clone(); }
DefaultOfficeResourceViewer implements OfficeResourceViewer, Initializable { @Override public XDOM createView(ResourceReference reference, Map<String, ?> parameters) throws Exception { OfficeDocumentView view; if (reference.getType().equals(ResourceType.ATTACHMENT) || reference.getType().equals(ResourceType.UNKNOWN)) { AttachmentReference attachmentReference = this.attachmentResolver.resolve(reference.getReference()); view = getView(reference, attachmentReference, parameters); } else { view = getView(reference, parameters); } return view.getXDOM().clone(); } }
DefaultOfficeResourceViewer implements OfficeResourceViewer, Initializable { @Override public XDOM createView(ResourceReference reference, Map<String, ?> parameters) throws Exception { OfficeDocumentView view; if (reference.getType().equals(ResourceType.ATTACHMENT) || reference.getType().equals(ResourceType.UNKNOWN)) { AttachmentReference attachmentReference = this.attachmentResolver.resolve(reference.getReference()); view = getView(reference, attachmentReference, parameters); } else { view = getView(reference, parameters); } return view.getXDOM().clone(); }  }
DefaultOfficeResourceViewer implements OfficeResourceViewer, Initializable { @Override public XDOM createView(ResourceReference reference, Map<String, ?> parameters) throws Exception { OfficeDocumentView view; if (reference.getType().equals(ResourceType.ATTACHMENT) || reference.getType().equals(ResourceType.UNKNOWN)) { AttachmentReference attachmentReference = this.attachmentResolver.resolve(reference.getReference()); view = getView(reference, attachmentReference, parameters); } else { view = getView(reference, parameters); } return view.getXDOM().clone(); }  @Override void initialize(); @Override XDOM createView(ResourceReference reference, Map<String, ?> parameters); }
DefaultOfficeResourceViewer implements OfficeResourceViewer, Initializable { @Override public XDOM createView(ResourceReference reference, Map<String, ?> parameters) throws Exception { OfficeDocumentView view; if (reference.getType().equals(ResourceType.ATTACHMENT) || reference.getType().equals(ResourceType.UNKNOWN)) { AttachmentReference attachmentReference = this.attachmentResolver.resolve(reference.getReference()); view = getView(reference, attachmentReference, parameters); } else { view = getView(reference, parameters); } return view.getXDOM().clone(); }  @Override void initialize(); @Override XDOM createView(ResourceReference reference, Map<String, ?> parameters);  }