Search in sources :

Example 1 with ArgumentConfig

use of org.apache.dubbo.config.ArgumentConfig in project dubbo by alibaba.

the class ArgumentBuilderTest method build.

@Test
void build() {
    ArgumentBuilder builder = new ArgumentBuilder();
    builder.index(1).type("int").callback(true);
    ArgumentConfig argument1 = builder.build();
    ArgumentConfig argument2 = builder.build();
    Assertions.assertTrue(argument1.isCallback());
    Assertions.assertEquals("int", argument1.getType());
    Assertions.assertEquals(1, argument1.getIndex());
    Assertions.assertNotSame(argument1, argument2);
}
Also used : ArgumentConfig(org.apache.dubbo.config.ArgumentConfig) Test(org.junit.jupiter.api.Test)

Example 2 with ArgumentConfig

use of org.apache.dubbo.config.ArgumentConfig in project dubbo by alibaba.

the class MethodBuilderTest method addArgument.

@Test
void addArgument() {
    ArgumentConfig argument = new ArgumentConfig();
    MethodBuilder builder = new MethodBuilder();
    builder.addArgument(argument);
    Assertions.assertTrue(builder.build().getArguments().contains(argument));
    Assertions.assertEquals(1, builder.build().getArguments().size());
}
Also used : ArgumentConfig(org.apache.dubbo.config.ArgumentConfig) Test(org.junit.jupiter.api.Test)

Example 3 with ArgumentConfig

use of org.apache.dubbo.config.ArgumentConfig in project dubbo by alibaba.

the class MethodBuilderTest method addArguments.

@Test
void addArguments() {
    ArgumentConfig argument = new ArgumentConfig();
    MethodBuilder builder = new MethodBuilder();
    builder.addArguments(Collections.singletonList(argument));
    Assertions.assertTrue(builder.build().getArguments().contains(argument));
    Assertions.assertEquals(1, builder.build().getArguments().size());
}
Also used : ArgumentConfig(org.apache.dubbo.config.ArgumentConfig) Test(org.junit.jupiter.api.Test)

Example 4 with ArgumentConfig

use of org.apache.dubbo.config.ArgumentConfig in project dubbo by alibaba.

the class MethodBuilderTest method build.

@Test
void build() {
    ArgumentConfig argument = new ArgumentConfig();
    MethodBuilder builder = new MethodBuilder();
    builder.name("name").stat(1).retry(true).reliable(false).executes(2).deprecated(true).sticky(false).isReturn(true).oninvoke("on-invoke-object").oninvokeMethod("on-invoke-method").service("service").onreturn("on-return-object").onreturnMethod("on-return-method").serviceId("serviceId").onthrow("on-throw-object").onthrowMethod("on-throw-method").addArgument(argument);
    MethodConfig config = builder.build();
    MethodConfig config2 = builder.build();
    Assertions.assertTrue(config.isRetry());
    Assertions.assertFalse(config.isReliable());
    Assertions.assertTrue(config.getDeprecated());
    Assertions.assertFalse(config.getSticky());
    Assertions.assertTrue(config.isReturn());
    Assertions.assertEquals(1, config.getStat());
    Assertions.assertEquals(2, config.getExecutes());
    Assertions.assertEquals("on-invoke-object", config.getOninvoke());
    Assertions.assertEquals("on-invoke-method", config.getOninvokeMethod());
    Assertions.assertEquals("on-return-object", config.getOnreturn());
    Assertions.assertEquals("on-return-method", config.getOnreturnMethod());
    Assertions.assertEquals("on-throw-object", config.getOnthrow());
    Assertions.assertEquals("on-throw-method", config.getOnthrowMethod());
    Assertions.assertEquals("name", config.getName());
    Assertions.assertEquals("service", config.getService());
    Assertions.assertEquals("serviceId", config.getServiceId());
    Assertions.assertNotSame(config, config2);
}
Also used : MethodConfig(org.apache.dubbo.config.MethodConfig) ArgumentConfig(org.apache.dubbo.config.ArgumentConfig) Test(org.junit.jupiter.api.Test)

Example 5 with ArgumentConfig

use of org.apache.dubbo.config.ArgumentConfig in project dubbo by alibaba.

the class ArgumentBuilder method build.

public ArgumentConfig build() {
    ArgumentConfig argumentConfig = new ArgumentConfig();
    argumentConfig.setIndex(index);
    argumentConfig.setType(type);
    argumentConfig.setCallback(callback);
    return argumentConfig;
}
Also used : ArgumentConfig(org.apache.dubbo.config.ArgumentConfig)

Aggregations

ArgumentConfig (org.apache.dubbo.config.ArgumentConfig)5 Test (org.junit.jupiter.api.Test)4 MethodConfig (org.apache.dubbo.config.MethodConfig)1