Using payload type as Map throws compile time error

47 views
Skip to first unread message

shashank singh

unread,
Jun 16, 2017, 9:03:40 AM6/16/17
to indeedeng-proctor-users
Hi All
My spec json looks like this 
{
  "tests": {
    "trendTest": {
      "buckets": {
        "control": 0,
        "experimental": 1
      },
      "fallbackValue": 0,
      "payload": {
      "type": "map"                                // working for type = stringValue
      }
    }
  }
}

Ran - mvn proctor:generate -e  

[ERROR] Failed to execute goal com.indeed:proctor-maven-plugin:1.1.39:generate (default-cli) on project core: Execution default-cli of goal com.indeed:proctor-maven-plugin:1.1.39:generate failed. NullPointerException -> [Help 1]

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.indeed:proctor-maven-plugin:1.1.39:generate (default-cli) on project core: Execution default-cli of goal com.indeed:proctor-maven-plugin:1.1.39:generate failed.

....

Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal com.indeed:proctor-maven-plugin:1.1.39:generate failed.

at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)

at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)

... 20 more

Caused by: java.lang.NullPointerException

at com.indeed.proctor.consumer.gen.TestGroupsGenerator.populateRootMap(TestGroupsGenerator.java:159)


Basically for my buckets I plan to have have payload as json object basically using map type.

Also how it should look in bucket
"buckets": [
    {
      "name": "control",
      "value": 0,
      "description": "default behavior",
      "payload": {
        "stringValue": "controlPayload"        // how to use map here ?
      }
    }
  ]


dependency pom - 

proctor-common        : 1.1.39

proctor-consumer      : 1.1.39

proctor-codegen       : 1.1.39

proctor-maven-plugin  : 1.1.38

util-core             : 1.0.24


<plugin>

<groupId>com.indeed</groupId>

<artifactId>proctor-maven-plugin</artifactId>

<version>1.1.39</version>

<executions>

<execution>

<id>proctor-generate</id>

<goals>

<goal>generate</goal>

</goals>

</execution>

</executions>

</plugin>



sho...@indeed.com

unread,
Jun 19, 2017, 2:54:21 AM6/19/17
to indeedeng-proctor-users
Hi, shashank.

Thanks for reaching out to us!

If you want to use map payload type, please specify a schema of a payload you are going to use in specification json file.
This is a example of specification file.
 {
 
"tests": {
   
"trendTest": {
     
"buckets": {
       
"control": 0,
       
"experimental": 1
     
},
     
"fallbackValue": 0,
     
"payload": {

       
"type": "map",
       
"schema": {
         
"fieldname1" : "stringValue",
         
"fieldname2" : "stringValue"
       
}
     
},
   
}
 
}
}

Then, you can describe a content of payloads with the specification in test matrix file as follows
"buckets": [
   
{
       
"name": "control",
       
"value": 0,
       
"description": "default behavior",
       
"payload" : {

           
"map" : {
               
"fieldname1": "controlPayload",
               
"fieldname2": "value2",
           
}
       
}
   
}
]

If you want to see more example of specification and proctor matrix with map payload type, proctor-codegen-test module might be useful.
Reply all
Reply to author
Forward
0 new messages