Search in sources :

Example 16 with Link

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());
}
Also used : Link(org.candlepin.dto.api.v1.Link) Test(org.junit.jupiter.api.Test)

Example 17 with Link

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());
}
Also used : Method(java.lang.reflect.Method) Link(org.candlepin.dto.api.v1.Link) Test(org.junit.jupiter.api.Test)

Example 18 with Link

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());
}
Also used : Method(java.lang.reflect.Method) Link(org.candlepin.dto.api.v1.Link) Test(org.junit.jupiter.api.Test)

Example 19 with Link

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());
}
Also used : Method(java.lang.reflect.Method) Link(org.candlepin.dto.api.v1.Link) Test(org.junit.jupiter.api.Test)

Example 20 with Link

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
        }
    }
}
Also used : Gfa1Record(org.dishevelled.bio.assembly.gfa1.Gfa1Record) AtomicLong(java.util.concurrent.atomic.AtomicLong) BufferedReader(java.io.BufferedReader) Traversal(org.dishevelled.bio.assembly.gfa1.Traversal) Gfa1Listener(org.dishevelled.bio.assembly.gfa1.Gfa1Listener) Link(org.dishevelled.bio.assembly.gfa1.Link) CommandLineParseException(org.dishevelled.commandline.CommandLineParseException) PrintWriter(java.io.PrintWriter) Containment(org.dishevelled.bio.assembly.gfa1.Containment)

Aggregations

Link (org.candlepin.dto.api.v1.Link)8 Link (org.apache.tapestry5.Link)6 PrintWriter (java.io.PrintWriter)5 Method (java.lang.reflect.Method)5 Link (org.dishevelled.bio.assembly.gfa1.Link)5 Link (de.micromata.opengis.kml.v_2_2_0.Link)4 NetworkLink (de.micromata.opengis.kml.v_2_2_0.NetworkLink)4 HashMap (java.util.HashMap)4 Gfa1Adapter (org.dishevelled.bio.assembly.gfa1.Gfa1Adapter)4 Test (org.junit.jupiter.api.Test)4 Kml (de.micromata.opengis.kml.v_2_2_0.Kml)3 Map (java.util.Map)3 UriBuilder (javax.ws.rs.core.UriBuilder)3 JSONObject (org.apache.tapestry5.json.JSONObject)3 CommandLineParseException (org.dishevelled.commandline.CommandLineParseException)3 BufferedReader (java.io.BufferedReader)2 URI (java.net.URI)2 ArrayList (java.util.ArrayList)2 Path (javax.ws.rs.Path)2 AfterRender (org.apache.tapestry5.annotations.AfterRender)2