From e00ee7abe6b639de841058eb79e6a5d438f9fd41 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 23 Dec 2025 16:43:43 +0800 Subject: [PATCH] add redland test case --- .../redland/tc_redland_fun001.yaml | 37 ++++++ .../redland/tc_redland_fun002.yaml | 38 ++++++ tests/system_base/redland/rss.rdf | 111 ++++++++++++++++++ .../system_base/redland/tc_redland_fun001.py | 66 +++++++++++ .../system_base/redland/tc_redland_fun002.py | 71 +++++++++++ tests/system_base/redland/test.rdf | 14 +++ 6 files changed, 337 insertions(+) create mode 100644 docs/system_base/redland/tc_redland_fun001.yaml create mode 100644 docs/system_base/redland/tc_redland_fun002.yaml create mode 100644 tests/system_base/redland/rss.rdf create mode 100644 tests/system_base/redland/tc_redland_fun001.py create mode 100644 tests/system_base/redland/tc_redland_fun002.py create mode 100644 tests/system_base/redland/test.rdf diff --git a/docs/system_base/redland/tc_redland_fun001.yaml b/docs/system_base/redland/tc_redland_fun001.yaml new file mode 100644 index 00000000..55c046bd --- /dev/null +++ b/docs/system_base/redland/tc_redland_fun001.yaml @@ -0,0 +1,37 @@ +作者: douzhichong +优先级: P1 +支持架构: noarch +执行方式: 自动 +测试类型: 功能测试 +通用标签: local,redland +用例描述: Redland RDF处理器基本功能测试 +修改人: douzhichong + +前置条件: +- 系统已安装redland软件包 +- 已准备rss.rdf测试文件 + +测试步骤: +- 检查rdfproc -h命令能够显示使用帮助信息 +- 检查rdfproc --help命令能够显示使用帮助信息 +- 测试rdfproc -c参数能够创建并序列化RDF存储 +- 测试rdfproc --contexts参数能够创建并序列化RDF存储 +- 验证rdfproc -n参数能够新建存储并添加三元组数据 +- 验证rdfproc --new参数能够新建存储并添加三元组数据 +- 测试rdfproc -o参数能够指定输出格式为RDF/XML并打印存储内容 +- 测试rdfproc --output参数能够指定输出格式为NTriples并打印存储内容 +- 检查通过管道输入密码时rdfproc -p参数能够添加三元组数据 +- 检查通过管道输入密码时rdfproc --password参数能够添加三元组数据 + +期望结果: +- rdfproc -h命令能够正确显示"Usage: rdfproc [options]"帮助信息 +- rdfproc --help命令能够正确显示"Usage: rdfproc [options]"帮助信息 +- rdfproc -c参数能够成功执行并生成test-contexts.db文件 +- rdfproc --contexts参数能够成功执行并生成test1-contexts.db文件 +- rdfproc -n参数能够成功执行并生成test2-so2p.db文件 +- rdfproc --new参数能够成功执行并生成test3-so2p.db文件 +- rdfproc -o参数能够成功执行并生成test4-so2p.db文件 +- rdfproc --output参数能够成功执行并生成test5-so2p.db文件 +- rdfproc -p参数能够通过管道密码成功执行并生成test6-so2p.db文件 +- rdfproc --password参数能够通过管道密码成功执行并生成test7-so2p.db文件 + diff --git a/docs/system_base/redland/tc_redland_fun002.yaml b/docs/system_base/redland/tc_redland_fun002.yaml new file mode 100644 index 00000000..0bdbde60 --- /dev/null +++ b/docs/system_base/redland/tc_redland_fun002.yaml @@ -0,0 +1,38 @@ +作者: douzhichong +优先级: P1 +支持架构: noarch +执行方式: 自动 +测试类型: 功能测试 +通用标签: local,redland +用例描述: Redland RDF处理器高级功能测试 +修改人: douzhichong + +前置条件: +- 系统已安装redland软件包 +- 已准备所有.rdf格式测试文件 + +测试步骤: +- 测试rdfproc -q参数能够以安静模式添加三元组数据 +- 测试rdfproc --quiet参数能够以安静模式添加三元组数据 +- 验证rdfproc -r参数能够指定JSON格式输出查询结果 +- 验证rdfproc --results参数能够指定JSON格式输出查询结果 +- 检查rdfproc -s参数能够指定hash存储类型解析RDF文件 +- 检查rdfproc --storage参数能够指定hash存储类型解析RDF文件 +- 测试rdfproc -t参数能够指定存储选项并打印详细信息 +- 测试rdfproc --storage-options参数能够指定存储选项并打印详细信息 +- 验证rdfproc -v参数能够显示版本信息 +- 验证rdfproc --version参数能够显示版本信息 +- 测试redland-db-upgrade命令能够成功升级数据库 + +期望结果: +- rdfproc -q参数能够成功执行并生成test-po2s.db文件 +- rdfproc --quiet参数能够成功执行并生成test1-po2s.db文件 +- rdfproc -r参数能够成功执行并生成test2-po2s.db文件 +- rdfproc --results参数能够成功执行并生成test3-po2s.db文件 +- rdfproc -s参数能够成功执行并生成testDbd-po2s.db文件 +- rdfproc --storage参数能够成功执行并生成testDbd1-po2s.db文件 +- rdfproc -t参数能够成功执行并生成testDbd2-po2s.db文件 +- rdfproc --storage-options参数能够成功执行并生成testDbd3-po2s.db文件 +- rdfproc -v命令能够正确显示版本数字信息 +- rdfproc --version命令能够正确显示版本数字信息 +- redland-db-upgrade命令能够成功执行并生成newtest-po2s.db文件 diff --git a/tests/system_base/redland/rss.rdf b/tests/system_base/redland/rss.rdf new file mode 100644 index 00000000..0ea5de27 --- /dev/null +++ b/tests/system_base/redland/rss.rdf @@ -0,0 +1,111 @@ + + + + Dave Beckett's RDF Resource Guide + http://planetrdf.com/guide/ + A comprehensive guide to resources about RDF. + Dave Beckett + 2005-09-23 + daily + 1 + 2001-01-01T12:00+00:00 + + + + + + + + + + + + + + + + + Metadesk RDF authoring tool + Metadesk RDF authoring tool + http://planetrdf.com/guide/#2005-02-26-00:00:00 + from ISI, USA. An authoring tool emphasising entry of facts, rather than construction of ontologies. MS Windows only binary (Java jars and DLLs). License: unknown + from ISI, USA. An authoring tool emphasising entry of facts, rather than construction of ontologies. MS Windows only binary (Java jars and DLLs). License: unknown + 2005-02-26 + + + NG4J - Named Graphs API for Jena + NG4J - Named Graphs API for Jena + http://planetrdf.com/guide/#2005-02-24-00:00:00 + by Chris Bizer. An extension to the Java Jena Semantic Web framework for parsing, manipulating and serializing sets of Named Graph. Includes APIs for named graph operations, readers, writers and parsers and serializers for the TriG and TriX formats. See also the Named Graph Paper (PDF) and the sourceforge project for downloads. License: BSD. Version 0.4 announced + by Chris Bizer. An extension to the Java Jena Semantic Web framework for parsing, manipulating and serializing sets of Named Graph. Includes APIs for named graph operations, readers, writers and parsers and serializers for the TriG and TriX formats. See also the Named Graph Paper (PDF) and the sourceforge project for downloads. License: BSD. Version 0.4 announced + 2005-02-24 + + + pOWL Semantic Web Development Platform + pOWL Semantic Web Development Platform + http://planetrdf.com/guide/#2004-12-13-00:00:00 + by Sören Auer. A PHP toolkit for the semantic web consisting of the RAP RDF API, RDFS and OWL support from pOWL including editing and querying with RDQL and full-text, multiple languages, versioning support, plug-ins and a web application framework. License: GPL. Version 0.8 released + by Sören Auer. A PHP toolkit for the semantic web consisting of the RAP RDF API, RDFS and OWL support from pOWL including editing and querying with RDQL and full-text, multiple languages, versioning support, plug-ins and a web application framework. License: GPL. Version 0.8 released + 2004-12-13 + + + SMART: System for Managing Applications based on RDF Technology + SMART: System for Managing Applications based on RDF Technology + http://planetrdf.com/guide/#2004-11-12-00:00:00 + by Andrey Guskov and Vladimir Shraibman. An application to aid the creation of documents described with RDF, implemented as Java servlets using Jena and GraphViz (optionally). License: unknown. Version 1.5.2 released + by Andrey Guskov and Vladimir Shraibman. An application to aid the creation of documents described with RDF, implemented as Java servlets using Jena and GraphViz (optionally). License: unknown. Version 1.5.2 released + 2004-11-12 + + + Ontaria + Ontaria + http://planetrdf.com/guide/#2004-09-23-00:00:00 + by Sandro Hawke. A web-based browser for ontologies and other RDF data. First announced + by Sandro Hawke. A web-based browser for ontologies and other RDF data. First announced + 2004-09-23 + + + RDF Gateway + RDF Gateway + http://planetrdf.com/guide/#2003-03-05-13:47:00 + by Intellidimension - a semantic web platform for MS Windows XP/NT/2000 allowing managing of data as RDF including an application server, web server and deductive RDF database. The main features are an SQL-style RDF query language, inference engine, datatypes, full text search, application development environment with ASP-like server pages, integration of many external data sources, web and non-web interfaces. Commercial application with 60-day evaluation version. Version 2.1 with many changes announced + by Intellidimension - a semantic web platform for MS Windows XP/NT/2000 allowing managing of data as RDF including an application server, web server and deductive RDF database. The main features are an SQL-style RDF query language, inference engine, datatypes, full text search, application development environment with ASP-like server pages, integration of many external data sources, web and non-web interfaces. Commercial application with 60-day evaluation version. Version 2.1 with many changes announced + 2004-09-15 + + + Swoogle + Swoogle + http://planetrdf.com/guide/#2004-09-15-00:00:00 + crawler-based indexing and retrieval service for the semantic web from Tim Finin, UMBC, USA + crawler-based indexing and retrieval service for the semantic web from Tim Finin, UMBC, USA + 2004-09-15 + + + RAP - RDF API for PHP + RAP - RDF API for PHP + http://planetrdf.com/guide/#2003-03-05-13:42:00 + by Chris Bizer. A pure PHP package for manipulating RDF models, querying them with RDQL, parsing/serializing the RDF/XML, N3 and N-Triples syntaxes and providing a network server for NetAPI. See also the online demo. License: GPL. Version 0.8.1 with speed improvements, improved indexing and searching, new unit test suite and other bug fixes announced + by Chris Bizer. A pure PHP package for manipulating RDF models, querying them with RDQL, parsing/serializing the RDF/XML, N3 and N-Triples syntaxes and providing a network server for NetAPI. See also the online demo. License: GPL. Version 0.8.1 with speed improvements, improved indexing and searching, new unit test suite and other bug fixes announced + 2004-08-24 + + + VIVID (Visual Variable-depth Information Display) + VIVID (Visual Variable-depth Information Display) + http://planetrdf.com/guide/#2004-09-21-00:00:00 + browser for OWL and RDF using densely-packed presentations by Baoshi Yan, ISI, USA. License: unknown. Version 1.01 announced + browser for OWL and RDF using densely-packed presentations by Baoshi Yan, ISI, USA. License: unknown. Version 1.01 announced + 2004-08-20 + + + RDFStore Perl/C RDF API and Storage + RDFStore Perl/C RDF API and Storage + http://planetrdf.com/guide/#2001-09-05-11:04:00 + by Alberto Reggiori. A system for managing RDF model databases, storing them in databases, natively, free-text searching and indexing, parsing and serialising, querying with RDQL. See also the demos, native store description and downloads area. Version 0.50 with major rewrite into mostly C, new native store and indexing model announced + by Alberto Reggiori. A system for managing RDF model databases, storing them in databases, natively, free-text searching and indexing, parsing and serialising, querying with RDQL. See also the demos, native store description and downloads area. Version 0.50 with major rewrite into mostly C, new native store and indexing model announced + 2004-08-19 + + + diff --git a/tests/system_base/redland/tc_redland_fun001.py b/tests/system_base/redland/tc_redland_fun001.py new file mode 100644 index 00000000..768bfc26 --- /dev/null +++ b/tests/system_base/redland/tc_redland_fun001.py @@ -0,0 +1,66 @@ +""" +@File: tc_redland_fun001.py +@Time: 2025/12/23 16:30:20 +@Author: douzhichong +@Version: 1.0 +@Contact: douzhichong@inspur.com +@License: Mulan PSL v2 +@Modify: douzhichong +""" +import subprocess + +from common.basetest import LocalTest + + +class Test(LocalTest): + """ + See tc_redland_fun001.yaml for details + + :avocado: tags=P1,noarch,local,redland + """ + PARAM_DIC = {"pkg_name": "redland"} + + def setUp(self): + super().setUp(self.PARAM_DIC) + self.cmd('mkdir redland') + self.cmd("cp ./tests/system_base/redland/rss.rdf ./redland/") + + def test(self): + code, result = self.cmd("rdfproc -h 2>&1 | fgrep 'Usage: rdfproc [options]'") + self.assertFalse(code, "Check rdfproc -h failed") + + code, result = self.cmd("rdfproc --help 2>&1 | fgrep 'Usage: rdfproc [options]'") + self.assertFalse(code, "Check rdfproc --help failed") + + code, result = self.cmd("cd redland && rdfproc -c test serialize ntriples && test -f test-contexts.db") + self.assertFalse(code, "Check rdfproc -c test serialize ntriples failed") + + code, result = self.cmd( + "cd redland && rdfproc --contexts test1 serialize ntriples && test -f test1-contexts.db") + self.assertFalse(code, "Check rdfproc --contexts test1 serialize ntriples failed") + + code, result = self.cmd("cd redland && rdfproc -n test2 add SUBJECT PREDICATE OBJECT && test -f test2-so2p.db") + self.assertFalse(code, "Check rdfproc -n test2 add SUBJECT PREDICATE OBJECT failed") + + code, result = self.cmd( + "cd redland && rdfproc --new test3 add SUBJECT PREDICATE OBJECT && test -f test3-so2p.db") + self.assertFalse(code, "Check rdfproc --new test3 add SUBJECT PREDICATE OBJECT failed") + + code, result = self.cmd("cd redland && rdfproc -o rdfxml test4 print && test -f test4-so2p.db") + self.assertFalse(code, "Check rdfproc -o rdfxml test4 print failed") + + code, result = self.cmd("cd redland && rdfproc --output ntriples test5 print && test -f test5-so2p.db") + self.assertFalse(code, "Check rdfproc --output ntriples test5 print failed") + + code, result = self.cmd( + "cd redland && echo 'test123' | rdfproc -p test6 add SUBJECT PREDICATE OBJECT && test -f test6-so2p.db") + self.assertFalse(code, "Check echo test123 | rdfproc -p test6 add SUBJECT PREDICATE OBJECT failed") + + code, result = self.cmd( + "cd redland && echo 'test123' | rdfproc --password test7 add SUBJECT PREDICATE OBJECT && test -f test7-so2p.db") + self.assertFalse(code, "Check echo test123 | rdfproc --password test7 add SUBJECT PREDICATE OBJECT failed") + + def tearDown(self): + self.cmd('rm -rf redland') + super().tearDown(self.PARAM_DIC) + diff --git a/tests/system_base/redland/tc_redland_fun002.py b/tests/system_base/redland/tc_redland_fun002.py new file mode 100644 index 00000000..73341aaa --- /dev/null +++ b/tests/system_base/redland/tc_redland_fun002.py @@ -0,0 +1,71 @@ +""" +@File: tc_redland_fun002.py +@Time: 2025/12/23 16:30:20 +@Author: douzhichong +@Version: 1.0 +@Contact: douzhichong@inspur.com +@License: Mulan PSL v2 +@Modify: douzhichong +""" +import subprocess + +from common.basetest import LocalTest + + +class Test(LocalTest): + """ + See tc_redland_fun002.yaml for details + + :avocado: tags=P1,noarch,local,redland + """ + PARAM_DIC = {"pkg_name": "redland"} + + def setUp(self): + super().setUp(self.PARAM_DIC) + self.cmd('mkdir redland') + self.cmd("cp ./tests/system_base/redland/*.rdf ./redland/") + + def test(self): + code, result = self.cmd("cd redland && rdfproc -q test add SUBJECT PREDICATE OBJECT && test -f test-po2s.db") + self.assertFalse(code, "Check rdfproc -q test add SUBJECT PREDICATE OBJECT failed") + + code, result = self.cmd( + "cd redland && rdfproc --quiet test1 add SUBJECT PREDICATE OBJECT && test -f test1-po2s.db") + self.assertFalse(code, "Check rdfproc -q test add SUBJECT PREDICATE OBJECT failed") + + code, result = self.cmd( + "cd redland && rdfproc -r json test2 find SUBJECT PREDICATE OBJECT && test -f test2-po2s.db") + self.assertFalse(code, "Check rdfproc -q test add SUBJECT PREDICATE OBJECT failed") + + code, result = self.cmd( + "cd redland && rdfproc --results json test3 find SUBJECT PREDICATE OBJECT && test -f test3-po2s.db") + self.assertFalse(code, "Check rdfproc -q test add SUBJECT PREDICATE OBJECT failed") + + code, result = self.cmd("cd redland && rdfproc -s hashes testDbd parse test.rdf && test -f testDbd-po2s.db") + self.assertFalse(code, "Check rdfproc -q test add SUBJECT PREDICATE OBJECT failed") + + code, result = self.cmd( + "cd redland && rdfproc --storage hashes testDbd1 parse test.rdf && test -f testDbd1-po2s.db") + self.assertFalse(code, "Check rdfproc -q test add SUBJECT PREDICATE OBJECT failed") + + code, result = self.cmd( + "cd redland && rdfproc -t \"hash-type='bdb',dir='.'\" testDbd2 print -V && test -f testDbd2-po2s.db") + self.assertFalse(code, "Check rdfproc -q test add SUBJECT PREDICATE OBJECT failed") + + code, result = self.cmd( + "cd redland && rdfproc --storage-options \"hash-type='bdb',dir='.'\" testDbd3 print --verbose && test -f testDbd3-po2s.db") + self.assertFalse(code, "Check rdfproc -q test add SUBJECT PREDICATE OBJECT failed") + + code, result = self.cmd("cd redland && rdfproc -v | grep '[[:digit:]]'") + self.assertFalse(code, "Check rdfproc -v failed") + + code, result = self.cmd("cd redland && rdfproc --version | grep '[[:digit:]]'") + self.assertFalse(code, "Check rdfproc --version failed") + + code, result = self.cmd("cd redland && redland-db-upgrade test newtest && test -f newtest-po2s.db") + self.assertFalse(code, "Check redland-db-upgrade test newtest failed") + + def tearDown(self): + self.cmd('rm -rf redland') + super().tearDown(self.PARAM_DIC) + diff --git a/tests/system_base/redland/test.rdf b/tests/system_base/redland/test.rdf new file mode 100644 index 00000000..b75af00d --- /dev/null +++ b/tests/system_base/redland/test.rdf @@ -0,0 +1,14 @@ + + + Jan Grant + Dave Beckett + + + World Wide Web Consortium + + + + + + -- Gitee