use of com.alibaba.nacos.api.naming.remote.request.AbstractNamingRequest in project nacos by alibaba.
the class NamingGrpcResourceParserTest method testParseWithFullContextForNamingRequest.
@Test
@Secured()
public void testParseWithFullContextForNamingRequest() throws NoSuchMethodException {
Secured secured = getMethodSecure();
AbstractNamingRequest request = mockNamingRequest("testNs", "testG", "testS");
Resource actual = resourceParser.parse(request, secured);
assertEquals("testNs", actual.getNamespaceId());
assertEquals("testG", actual.getGroup());
assertEquals("testS", actual.getName());
assertEquals(Constants.Naming.NAMING_MODULE, actual.getType());
assertEquals(MockNamingRequest.class.getSimpleName(), actual.getProperties().getProperty(com.alibaba.nacos.plugin.auth.constant.Constants.Resource.REQUEST_CLASS));
}
use of com.alibaba.nacos.api.naming.remote.request.AbstractNamingRequest in project nacos by alibaba.
the class GrpcProtocolAuthServiceTest method mockNamingRequest.
private void mockNamingRequest() {
namingRequest = new AbstractNamingRequest() {
};
namingRequest.setNamespace("testNNs");
namingRequest.setGroupName("testNG");
namingRequest.setServiceName("testS");
}
use of com.alibaba.nacos.api.naming.remote.request.AbstractNamingRequest in project nacos by alibaba.
the class NamingGrpcResourceParserTest method testParseWithoutNamespaceForNamingRequest.
@Test
@Secured()
public void testParseWithoutNamespaceForNamingRequest() throws NoSuchMethodException {
Secured secured = getMethodSecure();
AbstractNamingRequest request = mockNamingRequest(null, "testG", "testS");
Resource actual = resourceParser.parse(request, secured);
assertNull(actual.getNamespaceId());
assertEquals("testG", actual.getGroup());
assertEquals("testS", actual.getName());
assertEquals(Constants.Naming.NAMING_MODULE, actual.getType());
assertEquals(MockNamingRequest.class.getSimpleName(), actual.getProperties().getProperty(com.alibaba.nacos.plugin.auth.constant.Constants.Resource.REQUEST_CLASS));
}
use of com.alibaba.nacos.api.naming.remote.request.AbstractNamingRequest in project nacos by alibaba.
the class NamingGrpcResourceParserTest method testParseWithoutDataIdForNamingRequest.
@Test
@Secured()
public void testParseWithoutDataIdForNamingRequest() throws NoSuchMethodException {
Secured secured = getMethodSecure();
AbstractNamingRequest request = mockNamingRequest("testNs", "testG", null);
Resource actual = resourceParser.parse(request, secured);
assertEquals("testNs", actual.getNamespaceId());
assertEquals("testG", actual.getGroup());
assertEquals(StringUtils.EMPTY, actual.getName());
assertEquals(Constants.Naming.NAMING_MODULE, actual.getType());
assertEquals(MockNamingRequest.class.getSimpleName(), actual.getProperties().getProperty(com.alibaba.nacos.plugin.auth.constant.Constants.Resource.REQUEST_CLASS));
}
use of com.alibaba.nacos.api.naming.remote.request.AbstractNamingRequest in project nacos by alibaba.
the class NamingGrpcResourceParserTest method testParseWithoutGroupForNamingRequest.
@Test
@Secured()
public void testParseWithoutGroupForNamingRequest() throws NoSuchMethodException {
Secured secured = getMethodSecure();
AbstractNamingRequest request = mockNamingRequest("testNs", null, "testS");
Resource actual = resourceParser.parse(request, secured);
assertEquals("testNs", actual.getNamespaceId());
assertEquals(StringUtils.EMPTY, actual.getGroup());
assertEquals("testS", actual.getName());
assertEquals(Constants.Naming.NAMING_MODULE, actual.getType());
assertEquals(MockNamingRequest.class.getSimpleName(), actual.getProperties().getProperty(com.alibaba.nacos.plugin.auth.constant.Constants.Resource.REQUEST_CLASS));
}
Aggregations