Search in sources :

Example 6 with Variable

use of com.spectralogic.ds3autogen.java.models.Variable in project ds3_autogen by SpectraLogic.

the class BulkRequestGenerator_Test method toClassVariableArguments_Test.

@Test
public void toClassVariableArguments_Test() {
    final Ds3Request request = createSimpleTestDs3Request();
    final ImmutableList<Variable> result = generator.toClassVariableArguments(request);
    assertThat(result.size(), is(4));
    assertThat(result.get(0).getName(), is("ObjectName"));
    assertThat(result.get(1).getName(), is("JobId"));
    assertThat(result.get(2).getName(), is("NotificationEndPoint"));
    assertThat(result.get(3).getName(), is("RequestType"));
}
Also used : Variable(com.spectralogic.ds3autogen.java.models.Variable) RequestGeneratorTestHelper.createSimpleTestDs3Request(com.spectralogic.ds3autogen.java.test.helpers.RequestGeneratorTestHelper.createSimpleTestDs3Request) Ds3Request(com.spectralogic.ds3autogen.api.models.apispec.Ds3Request) Test(org.junit.Test)

Example 7 with Variable

use of com.spectralogic.ds3autogen.java.models.Variable in project ds3_autogen by SpectraLogic.

the class JavaHelper_Test method removeVariable_FullList_Test.

@Test
public void removeVariable_FullList_Test() {
    final ImmutableList<Variable> variables = ImmutableList.of(new Variable("Name", "Type", false), new Variable("Name2", "Type2", false));
    final ImmutableList<Variable> nullVarName = removeVariable(variables, null);
    assertThat(nullVarName.size(), is(2));
    final ImmutableList<Variable> emptyVarName = removeVariable(variables, "");
    assertThat(emptyVarName.size(), is(2));
    final ImmutableList<Variable> result = removeVariable(variables, "Name");
    assertThat(result.size(), is(1));
    assertThat(result.get(0).getName(), is("Name2"));
}
Also used : Variable(com.spectralogic.ds3autogen.java.models.Variable) Test(org.junit.Test)

Example 8 with Variable

use of com.spectralogic.ds3autogen.java.models.Variable in project ds3_autogen by SpectraLogic.

the class GetObjectRequestGenerator method toClassVariableArguments.

/**
     * Gets all the class variables to properly generate the variables and their
     * getter functions. This consists of all constructor arguments and optional
     * arguments being converted into variables, including the Channel variable.
     */
@Override
public ImmutableList<Variable> toClassVariableArguments(final Ds3Request ds3Request) {
    final ImmutableList.Builder<Variable> builder = ImmutableList.builder();
    builder.add(new Variable("Channel", "WritableByteChannel", true));
    for (final Arguments arg : toConstructorArgumentsList(ds3Request)) {
        builder.add(new Variable(arg.getName(), arg.getType(), true));
    }
    for (final Arguments arg : toOptionalArgumentsList(ds3Request.getOptionalQueryParams())) {
        builder.add(new Variable(arg.getName(), arg.getType(), false));
    }
    return builder.build();
}
Also used : Variable(com.spectralogic.ds3autogen.java.models.Variable) ImmutableList(com.google.common.collect.ImmutableList) Arguments(com.spectralogic.ds3autogen.api.models.Arguments) Helper.removeVoidArguments(com.spectralogic.ds3autogen.utils.Helper.removeVoidArguments)

Aggregations

Variable (com.spectralogic.ds3autogen.java.models.Variable)8 Test (org.junit.Test)6 Ds3Request (com.spectralogic.ds3autogen.api.models.apispec.Ds3Request)3 RequestGeneratorTestHelper.createSimpleTestDs3Request (com.spectralogic.ds3autogen.java.test.helpers.RequestGeneratorTestHelper.createSimpleTestDs3Request)3 ImmutableList (com.google.common.collect.ImmutableList)2 Arguments (com.spectralogic.ds3autogen.api.models.Arguments)2 Helper.removeVoidArguments (com.spectralogic.ds3autogen.utils.Helper.removeVoidArguments)2 Ds3ModelPartialDataFixture.createEmptyDs3Request (com.spectralogic.ds3autogen.testutil.Ds3ModelPartialDataFixture.createEmptyDs3Request)1