use of com.google.cloud.video.livestream.v1.Event in project requery by requery.
the class UpsertTest method testUpsertUpdate.
@Test
public void testUpsertUpdate() {
Event event = new Event();
UUID id = UUID.randomUUID();
event.setId(id);
event.setName("event1");
data.insert(event);
Event event2 = new Event();
event2.setId(id);
event2.setName("event2");
data.upsert(event2);
List<Event> events = data.select(Event.class).get().toList();
assertTrue(events.size() == 1);
assertEquals("event2", events.iterator().next().getName());
}
use of com.google.cloud.video.livestream.v1.Event in project requery by requery.
the class UpsertTest method testUpsertOneToMany.
@Test
public void testUpsertOneToMany() {
Event event = new Event();
event.setId(UUID.randomUUID());
Place place = new Place();
place.setId(UUID.randomUUID().toString());
place.setName("place");
place.getEvents().add(event);
data.upsert(place);
}
use of com.google.cloud.video.livestream.v1.Event in project requery by requery.
the class UpsertTest method testUpsertInsertOneToMany.
@Test
public void testUpsertInsertOneToMany() {
Event event = new Event();
UUID id = UUID.randomUUID();
event.setId(id);
data.upsert(event);
assertNotNull(event);
Event event1 = new Event();
event1.setId(id);
Place place = new Place();
place.setId(UUID.randomUUID().toString());
place.setName("place");
place.getEvents().add(event1);
data.insert(place);
}
use of com.google.cloud.video.livestream.v1.Event in project requery by requery.
the class UpsertTest method testUpsertOneToManyEmptyCollection.
@Test
public void testUpsertOneToManyEmptyCollection() {
Event event1 = new Event();
event1.setId(UUID.randomUUID());
Place place = new Place();
place.setId(UUID.randomUUID().toString());
place.setName("place");
place.getEvents().add(event1);
place.getEvents().clear();
data.upsert(place);
}
use of com.google.cloud.video.livestream.v1.Event in project java-docs-samples by GoogleCloudPlatform.
the class CreateChannelEvent method createChannelEvent.
public static void createChannelEvent(String projectId, String location, String channelId, String eventId) throws IOException {
// the "close" method on the client to safely clean up any remaining background resources.
try (LivestreamServiceClient livestreamServiceClient = LivestreamServiceClient.create()) {
var createEventRequest = CreateEventRequest.newBuilder().setParent(ChannelName.of(projectId, location, channelId).toString()).setEventId(eventId).setEvent(Event.newBuilder().setAdBreak(AdBreakTask.newBuilder().setDuration(Duration.newBuilder().setSeconds(30).build()).build()).setExecuteNow(true).build()).build();
Event response = livestreamServiceClient.createEvent(createEventRequest);
System.out.println("Channel event: " + response.getName());
}
}
Aggregations