|
Packit |
51d0f7 |
#!/bin/bash
|
|
Packit |
51d0f7 |
|
|
Packit |
51d0f7 |
#
|
|
Packit |
51d0f7 |
# NetLabel Tools test script
|
|
Packit |
51d0f7 |
#
|
|
Packit |
51d0f7 |
|
|
Packit |
51d0f7 |
#
|
|
Packit |
51d0f7 |
# This program is free software: you can redistribute it and/or modify
|
|
Packit |
51d0f7 |
# it under the terms of version 2 of the GNU General Public License as
|
|
Packit |
51d0f7 |
# published by the Free Software Foundation.
|
|
Packit |
51d0f7 |
#
|
|
Packit |
51d0f7 |
# This program is distributed in the hope that it will be useful,
|
|
Packit |
51d0f7 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
51d0f7 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit |
51d0f7 |
# GNU General Public License for more details.
|
|
Packit |
51d0f7 |
#
|
|
Packit |
51d0f7 |
# You should have received a copy of the GNU General Public License
|
|
Packit |
51d0f7 |
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
Packit |
51d0f7 |
#
|
|
Packit |
51d0f7 |
|
|
Packit |
51d0f7 |
function doi_remove() {
|
|
Packit |
51d0f7 |
local rc=1
|
|
Packit |
51d0f7 |
while [[ $rc -ne 0 && $rc -lt 3 ]]; do
|
|
Packit |
51d0f7 |
$GLBL_NETLABELCTL cipso del doi:$1
|
|
Packit |
51d0f7 |
[[ $? -ne 0 ]] && rc=$(($rc+1)) || rc=0
|
|
Packit |
51d0f7 |
sleep 1
|
|
Packit |
51d0f7 |
done
|
|
Packit |
51d0f7 |
[[ $rc -ne 0 ]] && exit 1
|
|
Packit |
51d0f7 |
}
|
|
Packit |
51d0f7 |
|
|
Packit |
51d0f7 |
# add the pass-through DOIs
|
|
Packit |
51d0f7 |
$GLBL_NETLABELCTL cipso add pass doi:100 tags:1 \
|
|
Packit |
51d0f7 |
levels:1=2,3=4,5=6 \
|
|
Packit |
51d0f7 |
categories:10=11,12=13,14=15
|
|
Packit |
51d0f7 |
[[ $? -ne 0 ]] && exit 1
|
|
Packit |
51d0f7 |
$GLBL_NETLABELCTL cipso add pass doi:101 tags:1,2 \
|
|
Packit |
51d0f7 |
levels:1=2,3=4,5=6 \
|
|
Packit |
51d0f7 |
categories:10=11,12=13,14=15
|
|
Packit |
51d0f7 |
[[ $? -ne 0 ]] && exit 1
|
|
Packit |
51d0f7 |
$GLBL_NETLABELCTL cipso add pass doi:102 tags:1,2,5 \
|
|
Packit |
51d0f7 |
levels:1=2,3=4,5=6 \
|
|
Packit |
51d0f7 |
categories:10=11,12=13,14=15
|
|
Packit |
51d0f7 |
[[ $? -ne 0 ]] && exit 1
|
|
Packit |
51d0f7 |
|
|
Packit |
51d0f7 |
# verify the DOIs
|
|
Packit |
51d0f7 |
[[ "$($GLBL_NETLABELCTL cipso list doi:100)" != "tags:1" ]] && exit 1
|
|
Packit |
51d0f7 |
[[ "$($GLBL_NETLABELCTL cipso list doi:101)" != "tags:1,2" ]] && exit 1
|
|
Packit |
51d0f7 |
[[ "$($GLBL_NETLABELCTL cipso list doi:102)" != "tags:1,2,5" ]] && exit 1
|
|
Packit |
51d0f7 |
|
|
Packit |
51d0f7 |
# remove the DOIs
|
|
Packit |
51d0f7 |
doi_remove 100
|
|
Packit |
51d0f7 |
doi_remove 101
|
|
Packit |
51d0f7 |
doi_remove 102
|
|
Packit |
51d0f7 |
|
|
Packit |
51d0f7 |
exit 0
|