Search in sources :

Example 1 with Variable

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

the class StreamRequestPayloadGenerator method toClassVariableArguments.

/**
     * Gets all the class variables to properly generate the variables and their
     * getter functions, including Stream and Channel
     */
@Override
public ImmutableList<Variable> toClassVariableArguments(final Ds3Request ds3Request) {
    final ImmutableList.Builder<Variable> builder = ImmutableList.builder();
    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));
    }
    builder.add(new Variable("Stream", "InputStream", true));
    builder.add(new Variable("Channel", "SeekableByteChannel", 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)

Example 2 with Variable

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

the class BaseRequestGenerator_Test method convertAllUuidClassVariables_FullList_Test.

@Test
public void convertAllUuidClassVariables_FullList_Test() {
    final ImmutableList<Variable> variables = ImmutableList.of(new Variable("Var", "String", true), new Variable("Var", "UUID", true), new Variable("Var", "UUID", false), new Variable("Var", "Integer", true));
    final ImmutableList<Variable> result = convertAllUuidClassVariables(variables);
    assertThat(result.size(), is(4));
    for (final Variable var : result) {
        assertThat(var.getType(), not(is("UUID")));
    }
}
Also used : Variable(com.spectralogic.ds3autogen.java.models.Variable) Test(org.junit.Test)

Example 3 with Variable

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

the class BaseRequestGenerator_Test method convertUuidClassVariable_Test.

@Test
public void convertUuidClassVariable_Test() {
    final Variable uuidVar = convertUuidClassVariable(new Variable("UuidVar", "UUID", true));
    assertThat(uuidVar.getType(), is("String"));
    final Variable intVar = convertUuidClassVariable(new Variable("IntVar", "int", true));
    assertThat(intVar.getType(), is("int"));
}
Also used : Variable(com.spectralogic.ds3autogen.java.models.Variable) Test(org.junit.Test)

Example 4 with Variable

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

the class CreateNotificationRequestGenerator_Test method toClassVariableArguments_Test.

@Test
public void toClassVariableArguments_Test() {
    final Ds3Request request = createSimpleTestDs3Request();
    final ImmutableList<Variable> result = generator.toClassVariableArguments(request);
    assertThat(result.size(), is(5));
    assertThat(result.get(0).getName(), is("BucketName"));
    assertThat(result.get(1).getName(), is("ObjectName"));
    assertThat(result.get(2).getName(), is("JobId"));
    assertThat(result.get(3).getName(), is("Priority"));
    assertThat(result.get(4).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 5 with Variable

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

the class BaseRequestGenerator_Test method toClassVariableArguments_Test.

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

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