Search in sources :

Example 1 with ClassPathServiceRestMetadataReader

use of org.apache.dubbo.metadata.rest.ClassPathServiceRestMetadataReader in project dubbo by alibaba.

the class SpringMvcServiceRestMetadataResolverTest method testResolve.

@Test
public void testResolve() {
    // Generated by "dubbo-metadata-processor"
    ClassPathServiceRestMetadataReader reader = new ClassPathServiceRestMetadataReader("META-INF/dubbo/spring-mvc-servoce-rest-metadata.json");
    List<ServiceRestMetadata> serviceRestMetadataList = reader.read();
    ServiceRestMetadata expectedServiceRestMetadata = serviceRestMetadataList.get(0);
    ServiceRestMetadata serviceRestMetadata = instance.resolve(SpringRestService.class);
    List<RestMethodMetadata> meta1 = new LinkedList<>(expectedServiceRestMetadata.getMeta());
    List<RestMethodMetadata> meta2 = new LinkedList<>(serviceRestMetadata.getMeta());
    for (int i = 0; i < meta1.size(); i++) {
        RestMethodMetadata restMethodMetadata = meta1.get(i);
        RestMethodMetadata restMethodMetadata2 = meta2.get(i);
        assertEquals(restMethodMetadata, restMethodMetadata2);
    }
    assertEquals(expectedServiceRestMetadata, serviceRestMetadata);
}
Also used : ServiceRestMetadata(org.apache.dubbo.metadata.rest.ServiceRestMetadata) ClassPathServiceRestMetadataReader(org.apache.dubbo.metadata.rest.ClassPathServiceRestMetadataReader) LinkedList(java.util.LinkedList) RestMethodMetadata(org.apache.dubbo.metadata.rest.RestMethodMetadata) Test(org.junit.jupiter.api.Test)

Example 2 with ClassPathServiceRestMetadataReader

use of org.apache.dubbo.metadata.rest.ClassPathServiceRestMetadataReader in project dubbo by alibaba.

the class JAXRSServiceRestMetadataResolverTest method testResolve.

@Test
public void testResolve() {
    // Generated by "dubbo-metadata-processor"
    ClassPathServiceRestMetadataReader reader = new ClassPathServiceRestMetadataReader("META-INF/dubbo/jax-rs-service-rest-metadata.json");
    List<ServiceRestMetadata> serviceRestMetadataList = reader.read();
    ServiceRestMetadata expectedServiceRestMetadata = serviceRestMetadataList.get(0);
    ServiceRestMetadata serviceRestMetadata = instance.resolve(StandardRestService.class);
    List<RestMethodMetadata> meta1 = new LinkedList<>(expectedServiceRestMetadata.getMeta());
    List<RestMethodMetadata> meta2 = new LinkedList<>(serviceRestMetadata.getMeta());
    for (int i = 0; i < meta1.size(); i++) {
        RestMethodMetadata restMethodMetadata = meta1.get(i);
        RestMethodMetadata restMethodMetadata2 = meta2.get(i);
        assertEquals(restMethodMetadata, restMethodMetadata2);
    }
    assertEquals(expectedServiceRestMetadata, serviceRestMetadata);
}
Also used : ServiceRestMetadata(org.apache.dubbo.metadata.rest.ServiceRestMetadata) ClassPathServiceRestMetadataReader(org.apache.dubbo.metadata.rest.ClassPathServiceRestMetadataReader) LinkedList(java.util.LinkedList) RestMethodMetadata(org.apache.dubbo.metadata.rest.RestMethodMetadata) Test(org.junit.jupiter.api.Test)

Aggregations

LinkedList (java.util.LinkedList)2 ClassPathServiceRestMetadataReader (org.apache.dubbo.metadata.rest.ClassPathServiceRestMetadataReader)2 RestMethodMetadata (org.apache.dubbo.metadata.rest.RestMethodMetadata)2 ServiceRestMetadata (org.apache.dubbo.metadata.rest.ServiceRestMetadata)2 Test (org.junit.jupiter.api.Test)2