Search in sources :

Example 26 with Ds3Param

use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Param in project ds3_autogen by SpectraLogic.

the class RequestConverter_Test method testConvertDs3ParameterWithDocumentation.

@Test
public void testConvertDs3ParameterWithDocumentation() {
    final Ds3DocSpec docSpec = getTestDocSpec();
    final String paramName = "BucketName";
    final Ds3Param testDs3Param = new Ds3Param(paramName, "Ds3Bucket", false);
    final Parameter testParameter = ParameterConverter.toParameter(testDs3Param, true, RequestConverter.toParamDocs(paramName, docSpec));
    assertEquals(testParameter.getDocumentation(), "This is how you use bucket name");
}
Also used : Ds3Param(com.spectralogic.ds3autogen.api.models.apispec.Ds3Param) Ds3DocSpec(com.spectralogic.ds3autogen.api.models.docspec.Ds3DocSpec) Parameter(com.spectralogic.ds3autogen.c.models.Parameter) Test(org.junit.Test)

Example 27 with Ds3Param

use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Param in project ds3_autogen by SpectraLogic.

the class RequestConverterUtil_Test method toArgument_Test.

@Test
public void toArgument_Test() {
    final Ds3Param simpleParam = new Ds3Param("ArgName", "SimpleType", false);
    final Arguments simpleArg = toArgument(simpleParam);
    assertThat(simpleArg.getName(), is("ArgName"));
    assertThat(simpleArg.getType(), is("SimpleType"));
    final Ds3Param pathParam = new Ds3Param("ArgName", "com.spectralogic.test.TypeWithPath", false);
    final Arguments pathArg = toArgument(pathParam);
    assertThat(pathArg.getName(), is("ArgName"));
    assertThat(pathArg.getType(), is("TypeWithPath"));
}
Also used : Ds3Param(com.spectralogic.ds3autogen.api.models.apispec.Ds3Param) Test(org.junit.Test)

Example 28 with Ds3Param

use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Param in project ds3_autogen by SpectraLogic.

the class RequestGeneratorUtil_Test method removeVoidParams_FullList_Test.

@Test
public void removeVoidParams_FullList_Test() {
    final ImmutableList<Ds3Param> params = ImmutableList.of(new Ds3Param("Param1", "Type1", false), new Ds3Param("Param2", "void", false), new Ds3Param("Param3", "int", false), new Ds3Param("Param4", "VOID", false));
    final ImmutableList<Ds3Param> result = removeVoidDs3Params(params);
    assertThat(result.size(), is(2));
    result.forEach(param -> assertThat(param.getType(), not("void")));
}
Also used : Ds3Param(com.spectralogic.ds3autogen.api.models.apispec.Ds3Param) Test(org.junit.Test)

Example 29 with Ds3Param

use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Param in project ds3_autogen by SpectraLogic.

the class RequestGeneratorUtil_Test method toQueryParamVar_Test.

@Test
public void toQueryParamVar_Test() {
    final ImmutableList<Variable> expected = ImmutableList.of(new Variable("param_one", "strconv.Itoa(paramOne)"), new Variable("param_two", "strconv.FormatFloat(paramTwo, 'f', -1, 64)"), new Variable("param_three", "paramThree"), new Variable("param_four", "\"\""));
    final ImmutableList<Ds3Param> params = ImmutableList.of(new Ds3Param("ParamOne", "int", false), new Ds3Param("ParamTwo", "float64", false), new Ds3Param("ParamThree", "string", false), new Ds3Param("ParamFour", "void", false));
    assertThat(expected.size(), is(params.size()));
    for (int i = 0; i < params.size(); i++) {
        final Variable result = toQueryParamVar(params.get(i));
        assertThat(result, is(expected.get(i)));
    }
}
Also used : Ds3Param(com.spectralogic.ds3autogen.api.models.apispec.Ds3Param) Variable(com.spectralogic.ds3autogen.go.models.request.Variable) SimpleVariable(com.spectralogic.ds3autogen.go.models.request.SimpleVariable) Test(org.junit.Test)

Example 30 with Ds3Param

use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Param in project ds3_autogen by SpectraLogic.

the class RequestGeneratorUtil_Test method toQueryParamVarList_FullList_Test.

@Test
public void toQueryParamVarList_FullList_Test() {
    final ImmutableList<Variable> expected = ImmutableList.of(new Variable("param_one", "strconv.Itoa(paramOne)"), new Variable("param_two", "strconv.FormatFloat(paramTwo, 'f', -1, 64)"), new Variable("param_three", "paramThree"), new Variable("param_four", "\"\""), new Variable("type", "typeName.String()"));
    final ImmutableList<Ds3Param> params = ImmutableList.of(new Ds3Param("ParamOne", "int", false), new Ds3Param("ParamTwo", "float64", false), new Ds3Param("ParamThree", "string", false), new Ds3Param("ParamFour", "void", false), new Ds3Param("Operation", "RestOperationType", false), new Ds3Param("Type", "com.test.TypeName", false));
    final ImmutableList<Variable> result = toQueryParamVarList(params);
    assertThat(result.size(), is(expected.size()));
    for (int i = 0; i < result.size(); i++) {
        assertThat(result.get(i), is(expected.get(i)));
    }
}
Also used : Ds3Param(com.spectralogic.ds3autogen.api.models.apispec.Ds3Param) Variable(com.spectralogic.ds3autogen.go.models.request.Variable) SimpleVariable(com.spectralogic.ds3autogen.go.models.request.SimpleVariable) Test(org.junit.Test)

Aggregations

Ds3Param (com.spectralogic.ds3autogen.api.models.apispec.Ds3Param)39 Test (org.junit.Test)37 Ds3Request (com.spectralogic.ds3autogen.api.models.apispec.Ds3Request)10 Arguments (com.spectralogic.ds3autogen.api.models.Arguments)8 RequestGeneratorTestHelper.createSimpleTestDs3Request (com.spectralogic.ds3autogen.java.test.helpers.RequestGeneratorTestHelper.createSimpleTestDs3Request)8 NetNullableVariable (com.spectralogic.ds3autogen.net.model.common.NetNullableVariable)8 Ds3DocSpecEmptyImpl (com.spectralogic.ds3autogen.docspec.Ds3DocSpecEmptyImpl)5 QueryParam (com.spectralogic.ds3autogen.java.models.QueryParam)5 Ds3ModelPartialDataFixture.createEmptyDs3Request (com.spectralogic.ds3autogen.testutil.Ds3ModelPartialDataFixture.createEmptyDs3Request)5 ImmutableList (com.google.common.collect.ImmutableList)3 Parameter (com.spectralogic.ds3autogen.c.models.Parameter)3 SimpleVariable (com.spectralogic.ds3autogen.go.models.request.SimpleVariable)3 WithConstructor (com.spectralogic.ds3autogen.go.models.request.WithConstructor)3 RequestConstructor (com.spectralogic.ds3autogen.java.models.RequestConstructor)3 Request (com.spectralogic.ds3autogen.c.models.Request)2 Variable (com.spectralogic.ds3autogen.go.models.request.Variable)2 TestFileUtilsImpl (com.spectralogic.ds3autogen.utils.TestFileUtilsImpl)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 HashMap (java.util.HashMap)2 Ds3Type (com.spectralogic.ds3autogen.api.models.apispec.Ds3Type)1