Search in sources :

Example 1 with Variable

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

the class RequiredObjectsPayloadGenerator_Test method toStructAssignmentParamsTest.

@Test
public void toStructAssignmentParamsTest() {
    final ImmutableList<VariableInterface> expected = ImmutableList.of(new SimpleVariable("bucketName"), new Variable("content", "buildDs3ObjectListStream(objects)"));
    final ImmutableList<VariableInterface> result = generator.toStructAssignmentParams(testRequest);
    assertThat(result.size(), is(expected.size()));
    expected.forEach(var -> assertThat(result, hasItem(var)));
}
Also used : Variable(com.spectralogic.ds3autogen.go.models.request.Variable) SimpleVariable(com.spectralogic.ds3autogen.go.models.request.SimpleVariable) VariableInterface(com.spectralogic.ds3autogen.go.models.request.VariableInterface) SimpleVariable(com.spectralogic.ds3autogen.go.models.request.SimpleVariable) Test(org.junit.Test)

Example 2 with Variable

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

the class ReaderRequestPayloadGenerator_Test method getStructAssignmentVariableTest.

@Test
public void getStructAssignmentVariableTest() {
    final Variable result = generator.getStructAssignmentVariable();
    assertThat(result.getName(), is("content"));
    assertThat(result.getAssignment(), is("content"));
}
Also used : Variable(com.spectralogic.ds3autogen.go.models.request.Variable) Test(org.junit.Test)

Example 3 with Variable

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

the class PutObjectRequestGenerator_Test method toStructAssignmentParams_Test.

@Test
public void toStructAssignmentParams_Test() {
    final ImmutableList<VariableInterface> expectedVars = ImmutableList.of(new SimpleVariable("bucketName"), new SimpleVariable("objectName"), new SimpleVariable("content"), new Variable("checksum", "networking.NewNoneChecksum()"), new Variable("headers", "&http.Header{}"));
    final ImmutableList<VariableInterface> result = generator.toStructAssignmentParams(getRequestCreateObject());
    assertThat(result.size(), is(expectedVars.size()));
    expectedVars.forEach(expected -> assertThat(result, hasItem(expected)));
}
Also used : Variable(com.spectralogic.ds3autogen.go.models.request.Variable) SimpleVariable(com.spectralogic.ds3autogen.go.models.request.SimpleVariable) VariableInterface(com.spectralogic.ds3autogen.go.models.request.VariableInterface) SimpleVariable(com.spectralogic.ds3autogen.go.models.request.SimpleVariable) Test(org.junit.Test)

Example 4 with Variable

use of com.spectralogic.ds3autogen.go.models.request.Variable 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 5 with Variable

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

the class DeleteObjectsRequestGenerator_Test method getStructAssignmentVariableTest.

@Test
public void getStructAssignmentVariableTest() {
    final Variable result = generator.getStructAssignmentVariable();
    assertThat(result.getName(), is("content"));
    assertThat(result.getAssignment(), is("buildDeleteObjectsPayload(objectNames)"));
}
Also used : Variable(com.spectralogic.ds3autogen.go.models.request.Variable) Test(org.junit.Test)

Aggregations

Variable (com.spectralogic.ds3autogen.go.models.request.Variable)10 Test (org.junit.Test)10 SimpleVariable (com.spectralogic.ds3autogen.go.models.request.SimpleVariable)6 VariableInterface (com.spectralogic.ds3autogen.go.models.request.VariableInterface)3 Ds3Param (com.spectralogic.ds3autogen.api.models.apispec.Ds3Param)2