Search in sources :

Example 6 with Parameter

use of com.spectralogic.ds3autogen.c.models.Parameter in project ds3_autogen by SpectraLogic.

the class Parameter_Test method testSetQueryParamSignatureString.

@Test
public void testSetQueryParamSignatureString() {
    final Parameter parm = new Parameter(ParameterModifier.CONST, "ds3_str", "bucket_id", ParameterPointerType.SINGLE_POINTER, false);
    final String parmSig = ParameterHelper.generateSetQueryParamSignature(parm);
    assertThat(parmSig, is("void ds3_request_set_bucket_id(const ds3_request* request, const char * const value)"));
}
Also used : Parameter(com.spectralogic.ds3autogen.c.models.Parameter) Test(org.junit.Test)

Example 7 with Parameter

use of com.spectralogic.ds3autogen.c.models.Parameter in project ds3_autogen by SpectraLogic.

the class Parameter_Test method testParameterToStringWithPointer.

@Test
public void testParameterToStringWithPointer() {
    final Parameter param1 = new Parameter(ParameterModifier.NONE, "ds3_error", "ds3Error", ParameterPointerType.SINGLE_POINTER, false);
    assertThat(param1.toString(), is("ds3_error* ds3Error"));
}
Also used : Parameter(com.spectralogic.ds3autogen.c.models.Parameter) Test(org.junit.Test)

Example 8 with Parameter

use of com.spectralogic.ds3autogen.c.models.Parameter in project ds3_autogen by SpectraLogic.

the class Parameter_Test method testSetQueryParamSignatureUint64_t.

@Test
public void testSetQueryParamSignatureUint64_t() {
    final Parameter parm = new Parameter(ParameterModifier.CONST, "uint64_t", "offset", ParameterPointerType.NONE, false);
    final String parmSig = ParameterHelper.generateSetQueryParamSignature(parm);
    assertThat(parmSig, is("void ds3_request_set_offset(const ds3_request* request, const uint64_t value)"));
}
Also used : Parameter(com.spectralogic.ds3autogen.c.models.Parameter) Test(org.junit.Test)

Example 9 with Parameter

use of com.spectralogic.ds3autogen.c.models.Parameter in project ds3_autogen by SpectraLogic.

the class RequestConverter_Test method testGetRequestParameterListWithResponseType.

@Test
public void testGetRequestParameterListWithResponseType() throws IOException {
    final ImmutableList<Parameter> paramList = RequestConverter.getParamList("ds3_get_service_response", new Ds3DocSpecEmptyImpl());
    assertEquals(paramList.size(), 3);
    assertEquals(RequestHelper.paramListToString(paramList), "const ds3_client* client, const ds3_request* request, ds3_get_service_response** response");
}
Also used : Ds3DocSpecEmptyImpl(com.spectralogic.ds3autogen.docspec.Ds3DocSpecEmptyImpl) Parameter(com.spectralogic.ds3autogen.c.models.Parameter) Test(org.junit.Test)

Example 10 with Parameter

use of com.spectralogic.ds3autogen.c.models.Parameter in project ds3_autogen by SpectraLogic.

the class RequestConverter method getOptionalQueryParams.

private static ImmutableList<Parameter> getOptionalQueryParams(final Ds3Request ds3Request, final Ds3DocSpec docSpec) {
    final ImmutableList.Builder<Parameter> optionalArgsBuilder = ImmutableList.builder();
    if (isEmpty(ds3Request.getOptionalQueryParams())) {
        return optionalArgsBuilder.build();
    }
    for (final Ds3Param ds3Param : ds3Request.getOptionalQueryParams()) {
        final Parameter optionalQueryParam = ParameterConverter.toParameter(ds3Param, false, toParamDocs(Helper.unqualifiedName(ds3Param.getName()), docSpec));
        LOG.debug("\tOptional QueryParam: " + optionalQueryParam.toString());
        optionalArgsBuilder.add(optionalQueryParam);
    }
    return optionalArgsBuilder.build();
}
Also used : Ds3Param(com.spectralogic.ds3autogen.api.models.apispec.Ds3Param) ImmutableList(com.google.common.collect.ImmutableList) Parameter(com.spectralogic.ds3autogen.c.models.Parameter)

Aggregations

Parameter (com.spectralogic.ds3autogen.c.models.Parameter)14 Test (org.junit.Test)10 ImmutableList (com.google.common.collect.ImmutableList)3 Ds3Param (com.spectralogic.ds3autogen.api.models.apispec.Ds3Param)3 Ds3DocSpecEmptyImpl (com.spectralogic.ds3autogen.docspec.Ds3DocSpecEmptyImpl)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 Ds3DocSpec (com.spectralogic.ds3autogen.api.models.docspec.Ds3DocSpec)1