blob: fe1db99f3350bdfe926dc5a45eb0227399e0f47a [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* Description : Room Occupants Test
* Expected Res : Success
* Date : Sep 2016
* Author : Steven Jacobs
*/
drop dataverse channels if exists;
create dataverse channels;
use channels;
create type userLocation as {
userId: int,
roomNumber: int
};
create type watchedUser as {
userId: int,
name: string
};
create type roomSecurity as {
roomNumber: int,
securityGuardName: string,
securityGuardNumber: string
};
create dataset watchedUsers(watchedUser)
primary key userId;
create dataset roomSecurityAssignments(roomSecurity)
primary key roomNumber;
upsert into roomSecurityAssignments([
{"roomNumber":123, "securityGuardName":"Mike", "securityGuardNumber":"555_4815"},
{"roomNumber":222, "securityGuardName":"Steven", "securityGuardNumber":"555_1623"},
{"roomNumber":350, "securityGuardName":"Vassilis", "securityGuardNumber":"555_1234"}]
);
upsert into watchedUsers([
{"userId":1, "name":"suspectNumber1"}]
);
create dataset UserLocations(userLocation)
primary key userId;
create function RoomOccupants(room) {
(select location.userId
from UserLocations location
where location.roomNumber = room)
};
create broker brokerA at "http://www.notifyA.com";
create broker brokerB at "http://www.notifyB.com";
create repetitive channel roomRecords using RoomOccupants@1 period duration("PT5S");