use of com.baeldung.protobuf.BaeldungTraining.Course in project tutorials by eugenp.
the class Application method createTestCourses.
@Bean
public CourseRepository createTestCourses() {
Map<Integer, Course> courses = new HashMap<>();
Course course1 = Course.newBuilder().setId(1).setCourseName("REST with Spring").addAllStudent(createTestStudents()).build();
Course course2 = Course.newBuilder().setId(2).setCourseName("Learn Spring Security").addAllStudent(new ArrayList<>()).build();
courses.put(course1.getId(), course1);
courses.put(course2.getId(), course2);
return new CourseRepository(courses);
}
use of com.baeldung.protobuf.BaeldungTraining.Course in project tutorials by eugenp.
the class ApplicationIntegrationTest method convertProtobufMessageStreamToJsonString.
private String convertProtobufMessageStreamToJsonString(InputStream protobufStream) throws IOException {
JsonFormat jsonFormat = new JsonFormat();
Course course = Course.parseFrom(protobufStream);
return jsonFormat.printToString(course);
}
Aggregations