use of org.geotoolkit.sml.xml.v100.Link in project candlepin by candlepin.
the class RootResourceTest method getResourceEntry.
@Test
public void getResourceEntry() {
Link result = rootResource.resourceLink(FooResource.class, null);
assertEquals("foo", result.getRel());
assertEquals("/foo", result.getHref());
}
use of org.geotoolkit.sml.xml.v100.Link in project candlepin by candlepin.
the class RootResourceTest method getMethodEntryWithSlash.
@Test
public void getMethodEntryWithSlash() throws NoSuchMethodException {
Method m = FooResource.class.getMethod("methodWithSlash");
Link result = rootResource.methodLink("hello_world", m);
assertEquals("hello_world", result.getRel());
assertEquals("/foo/slash", result.getHref());
}
use of org.geotoolkit.sml.xml.v100.Link in project candlepin by candlepin.
the class RootResourceTest method getMethodEntryWithOutSlash.
@Test
public void getMethodEntryWithOutSlash() throws NoSuchMethodException {
Method m = FooResource.class.getMethod("methodWithoutSlash");
Link result = rootResource.methodLink("hello_world", m);
assertEquals("hello_world", result.getRel());
assertEquals("/foo/noslash", result.getHref());
}
use of org.geotoolkit.sml.xml.v100.Link in project candlepin by candlepin.
the class RootResourceTest method testLinkedAnnotation.
@Test
void testLinkedAnnotation() throws NoSuchMethodException {
Method m = FooResource.class.getMethod("methodWithLinkedAnnotation");
Link result = rootResource.methodLink("annotated_method", m);
assertEquals("annotated_method", result.getRel());
assertEquals("/foo/linked", result.getHref());
}
use of org.geotoolkit.sml.xml.v100.Link in project dishevelled-bio by heuermh.
the class IdentifyGfa1 method call.
@Override
public Integer call() throws Exception {
BufferedReader reader = null;
PrintWriter writer = null;
try {
reader = reader(inputGfa1File);
writer = writer(outputGfa1File);
final PrintWriter w = writer;
final AtomicLong count = new AtomicLong();
Gfa1Reader.stream(reader, new Gfa1Listener() {
@Override
public boolean record(final Gfa1Record gfa1Record) {
String id = String.valueOf(count.getAndIncrement());
if (gfa1Record instanceof Containment) {
Containment containment = (Containment) gfa1Record;
Gfa1Writer.write(new Containment(containment.getContainer(), containment.getContained(), containment.getPosition(), containment.getOverlap(), addId(id, containment.getAnnotations())), w);
} else if (gfa1Record instanceof Link) {
Link link = (Link) gfa1Record;
Gfa1Writer.write(new Link(link.getSource(), link.getTarget(), link.getOverlap(), addId(id, link.getAnnotations())), w);
} else if (gfa1Record instanceof Traversal) {
Traversal traversal = (Traversal) gfa1Record;
Gfa1Writer.write(new Traversal(traversal.getPathName(), traversal.getOrdinal(), traversal.getSource(), traversal.getTarget(), traversal.getOverlap(), addId(id, traversal.getAnnotations())), w);
} else {
Gfa1Writer.write(gfa1Record, w);
}
return true;
}
});
return 0;
} finally {
try {
reader.close();
} catch (Exception e) {
// ignore
}
try {
writer.close();
} catch (Exception e) {
// ignore
}
}
}
Aggregations