Hello,
Below is a snippet of my proto file
message UnitType {
enum E {
// Default - do not use
UNDEFINED = 0;
INTEGER = 1;
DECIMAL = 2;
}
}
message AdditionalKey {
string name = 1;
// If expected_values is empty, the value of the additional key can be
anything.
// Otherwise, it should be one of the expected_values.
repeated string expected_values = 2;
}
// Definition of an accumulator for validation on writes
message Definition {
UnitType.E unit_type = 1;
// The stage in the adjudication pipeline that creates accumulators of
this definition.
UnitType.E stage = 3;
repeated AdditionalKey additional_keys = 2;
}
message ReadAccumulatorDefinitionsResponse {
// definitions is a map of accumulator name to corresponding definition.
// accumulator names that were not found in the database
// will not be included in the definitions map.
map<string, Definition> definitions = 1;
}
I am trying to construct a test.java class for setting values to instances
of the above messages and the code snippet is as follows: -
package accumulators;
import static org.testng.Assert.assertNotNull;
import com.OscarHealth.accumulators.ReadAccumulatorNamesRequest;
import com.OscarHealth.accumulators.UnitType;
import com.OscarHealth.accumulators.UnitType.Builder;
import com.OscarHealth.accumulators.UnitType.E;
public class accumulatorsTest {
public static void main(String[] args) {
// TODO Auto-generated method stub
/* ReadAccumulatorNamesRequest.Builder builder =
ReadAccumulatorNamesRequest.newBuilder();
ReadAccumulatorNamesRequest req1 = builder
.setStagesValue(2, 10)
.build();
assertNotNull(req1); */
UnitType.Builder build = UnitType.newBuilder();
UnitType req2 = ((Builder) build
.getDefaultInstanceForType()
.getField(null))
.build();
}
}
However, I am not really sure on the correct values to be passed while
setting Enaums & Map data types.
Kindly suggest and guide me here
--
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/protobuf/9a299e6b-3b9b-4831-89e3-95ebaaa6791dn%40googlegroups.com.