use of org.commonjava.maven.galley.model.SimpleLocation in project indy by Commonjava.
the class ContentControllerTest method detectHtml_SingleHtmlElementBeginsOnLine.
@Test
public void detectHtml_SingleHtmlElementBeginsOnLine() throws Exception {
final ConcreteResource res = new ConcreteResource(new SimpleLocation("test:uri"), "file.html");
final Transfer tx = fixture.getCache().getTransfer(res);
PrintWriter writer = null;
try {
writer = new PrintWriter(new OutputStreamWriter(tx.openOutputStream(TransferOperation.GENERATE)));
writer.print("<html ng-app=\"foo\"");
writer.flush();
} finally {
IOUtils.closeQuietly(writer);
}
assertThat(content.isHtmlContent(tx), equalTo(true));
}
use of org.commonjava.maven.galley.model.SimpleLocation in project indy by Commonjava.
the class ExpiringMemoryNotFoundCacheTest method expireUsingConfiguredValue_DirectCheckDoesntAffectAggregateChecks.
@Test
public void expireUsingConfiguredValue_DirectCheckDoesntAffectAggregateChecks() throws Exception {
final DefaultIndyConfiguration config = new DefaultIndyConfiguration();
config.setNotFoundCacheTimeoutSeconds(1);
final ExpiringMemoryNotFoundCache nfc = new ExpiringMemoryNotFoundCache(config);
final ConcreteResource res = new ConcreteResource(new SimpleLocation("test:uri"), "/path/to/expired/object");
nfc.addMissing(res);
assertThat(nfc.isMissing(res), equalTo(true));
Thread.sleep(TimeUnit.SECONDS.toMillis(1));
Set<String> locMissing = nfc.getMissing(res.getLocation());
assertThat(locMissing == null || locMissing.isEmpty(), equalTo(true));
Map<Location, Set<String>> allMissing = nfc.getAllMissing();
assertThat(allMissing == null || allMissing.isEmpty(), equalTo(true));
assertThat(nfc.isMissing(res), equalTo(false));
locMissing = nfc.getMissing(res.getLocation());
assertThat(locMissing == null || locMissing.isEmpty(), equalTo(true));
allMissing = nfc.getAllMissing();
assertThat(allMissing == null || allMissing.isEmpty(), equalTo(true));
}
Aggregations