1
0
Fork 0

Merge branch 'devel' of github.com:triAGENS/ArangoDB

Conflicts:
	Doxygen/arango.template
	Makefile.in
This commit is contained in:
Frank Celler 2012-08-31 18:03:26 +02:00
commit e48030d8cf
24 changed files with 522 additions and 1888 deletions

1
.gitignore vendored
View File

@ -101,6 +101,7 @@ Documentation/.setup-directories
Documentation/web/*.html
Documentation/wiki/
Documentation/xml/
Doxygen/
.DS_Store
*.gcda
*.gcno

View File

@ -8,40 +8,45 @@
### @brief directory setup
################################################################################
.PHONY: Documentation/js Documentation/js/system Documentation/js/modules
.PHONY: Doxygen/js Doxygen/js/system Doxygen/js/modules
BUILT_SOURCES += Documentation/.setup-directories
BUILT_SOURCES += Doxygen/.setup-directories
Documentation/.setup-directories:
@test -d Documentation/js || mkdir Documentation/js
@test -d Documentation/js/actions || mkdir Documentation/js/actions
@test -d Documentation/js/actions/system || mkdir Documentation/js/actions/system
@test -d Documentation/js/common || mkdir Documentation/js/common
@test -d Documentation/js/common/bootstrap || mkdir Documentation/js/common/bootstrap
@test -d Documentation/js/common/modules || mkdir Documentation/js/common/modules
@test -d Documentation/js/server || mkdir Documentation/js/server
@test -d Documentation/js/server/modules || mkdir Documentation/js/server/modules
@test -d Documentation/js/client || mkdir Documentation/js/client
@test -d Documentation/web || mkdir Documentation/web
Doxygen/.setup-directories:
@test -d Doxygen || mkdir Doxygen
@test -d Doxygen/js || mkdir Doxygen/js
@test -d Doxygen/js/actions || mkdir Doxygen/js/actions
@test -d Doxygen/js/actions/system || mkdir Doxygen/js/actions/system
@test -d Doxygen/js/common || mkdir Doxygen/js/common
@test -d Doxygen/js/common/bootstrap || mkdir Doxygen/js/common/bootstrap
@test -d Doxygen/js/common/modules || mkdir Doxygen/js/common/modules
@test -d Doxygen/js/server || mkdir Doxygen/js/server
@test -d Doxygen/js/server/modules || mkdir Doxygen/js/server/modules
@test -d Doxygen/js/client || mkdir Doxygen/js/client
@test -d Doxygen/web || mkdir Doxygen/web
@test -d Doxygen/web/images || mkdir Doxygen/web/images
@test -d Doxygen/wiki || mkdir Doxygen/wiki
@test -d Doxygen/latex || mkdir Doxygen/latex
@test -d Doxygen/latex/images || mkdir Doxygen/latex/images
@touch $@
Documentation/js/actions/system/%.c: @srcdir@/js/actions/system/%.js Documentation/.setup-directories
Doxygen/js/actions/system/%.c: @srcdir@/js/actions/system/%.js Doxygen/.setup-directories
@python @top_srcdir@/Documentation/Scripts/js2doxy.py $< > $@
Documentation/js/common/bootstrap/%.c: @srcdir@/js/common/bootstrap/%.js Documentation/.setup-directories
Doxygen/js/common/bootstrap/%.c: @srcdir@/js/common/bootstrap/%.js Doxygen/.setup-directories
@python @top_srcdir@/Documentation/Scripts/js2doxy.py $< > $@
Documentation/js/common/modules/%.c: @srcdir@/js/common/modules/%.js Documentation/.setup-directories
Doxygen/js/common/modules/%.c: @srcdir@/js/common/modules/%.js Doxygen/.setup-directories
@python @top_srcdir@/Documentation/Scripts/js2doxy.py $< > $@
Documentation/js/server/%.c: @srcdir@/js/server/%.js Documentation/.setup-directories
Doxygen/js/server/%.c: @srcdir@/js/server/%.js Doxygen/.setup-directories
@python @top_srcdir@/Documentation/Scripts/js2doxy.py $< > $@
Documentation/js/server/modules/%.c: @srcdir@/js/server/modules/%.js Documentation/.setup-directories
Doxygen/js/server/modules/%.c: @srcdir@/js/server/modules/%.js Doxygen/.setup-directories
@python @top_srcdir@/Documentation/Scripts/js2doxy.py $< > $@
Documentation/xml/%.md: Documentation/xml/%.xml
@python @top_srcdir@/Documentation/Scripts/xml2md.py $< > $@
Doxygen/xml/%.md: Doxygen/xml/%.xml
@python @top_srcdir@/Doxygen/Scripts/xml2md.py $< > $@
################################################################################
### @brief doxygen
@ -53,9 +58,10 @@ Documentation/arango-html.doxy: Documentation/arango.template
sed -e 's:GENERATE_HTML *= *NO:GENERATE_HTML = YES:' -e 's:ENABLED_SECTIONS *=:ENABLED_SECTIONS = HTML:' < $< > $@
$(MAKE) lib/BasicsC/voc-errors.h
doxygen: Documentation/arango-html.doxy $(DOXYGEN)
doxygen: Doxygen/.setup-directories Documentation/arango-html.doxy $(DOXYGEN)
doxygen Documentation/arango-html.doxy > /dev/null
@for w in $(WIKI); do @top_srcdir@/Documentation/Scripts/html2html.sh Documentation/html/$$w.html Documentation/web/$$w.html; done
@for w in $(WIKI); do @top_srcdir@/Documentation/Scripts/html2html.sh Doxygen/html/$$w.html Doxygen/web/$$w.html; done
cp -R @top_srcdir@/Documentation/web/images/* Doxygen/web/images
################################################################################
### @brief wiki
@ -68,9 +74,9 @@ Documentation/arango-xml.doxy: Documentation/arango.template
$(MAKE) lib/BasicsC/voc-errors.h
wiki: wiki2
@test -d Documentation/wiki || mkdir Documentation/wiki
@for w in $(WIKI); do python @top_srcdir@/Documentation/Scripts/xml2md.py Documentation/xml/$$w.xml > Documentation/xml/$$w.md; done
@for w in $(WIKI); do @top_srcdir@/Documentation/Scripts/fixmd.sh Documentation/xml/$$w.md; done
@test -d Doxygen/wiki || mkdir Doxygen/wiki
@for w in $(WIKI); do python @top_srcdir@/Documentation/Scripts/xml2md.py Doxygen/xml/$$w.xml > Doxygen/xml/$$w.md; done
@for w in $(WIKI); do @top_srcdir@/Documentation/Scripts/fixmd.sh Doxygen/xml/$$w.md; done
wiki2: Documentation/arango-xml.doxy $(DOXYGEN)
doxygen Documentation/arango-xml.doxy > /dev/null
@ -85,28 +91,31 @@ Documentation/arango-latex.doxy: Documentation/arango.template
sed -e 's:GENERATE_LATEX *= *NO:GENERATE_LATEX = YES:' -e 's:ENABLED_SECTIONS *=:ENABLED_SECTIONS = LATEX:' < $< > $@
$(MAKE) lib/BasicsC/voc-errors.h
latex: Documentation/arango-latex.doxy $(DOXYGEN)
latex: Doxygen/.setup-directories Documentation/arango-latex.doxy $(DOXYGEN)
doxygen Documentation/arango-latex.doxy > /dev/null
echo "\def\arangodbversion{@PACKAGE_VERSION@}" > Documentation/latex/version.tex
echo "\def\arangodbversion{@PACKAGE_VERSION@}" > Doxygen/latex/version.tex
python @top_srcdir@/Documentation/Scripts/tex2tex.py Documentation/latex/InstallManual.tex > Documentation/latex/InstallManual.inc.tex
cd Documentation/latex && pdflatex -interaction batchmode install-manual.tex || true
cp -R Documentation/latex/*.tex Doxygen/latex
cp -R Documentation/latex/images Doxygen/latex/images
python @top_srcdir@/Documentation/Scripts/tex2tex.py Documentation/latex/UserManual.tex > Documentation/latex/UserManual.inc.tex
cd Documentation/latex && pdflatex -interaction batchmode user-manual.tex || true
python @top_srcdir@/Documentation/Scripts/tex2tex.py Doxygen/latex/InstallManual.tex > Doxygen/latex/InstallManual.inc.tex
cd Doxygen/latex && pdflatex -interaction batchmode install-manual.tex || true
python @top_srcdir@/Documentation/Scripts/tex2tex.py Documentation/latex/ImplementorManual.tex > Documentation/latex/ImplementorManual.inc.tex
cd Documentation/latex && pdflatex -interaction batchmode implementor-manual.tex || true
python @top_srcdir@/Documentation/Scripts/tex2tex.py Doxygen/latex/UserManual.tex > Doxygen/latex/UserManual.inc.tex
cd Doxygen/latex && pdflatex -interaction batchmode user-manual.tex || true
python @top_srcdir@/Documentation/Scripts/tex2tex.py Documentation/latex/RefManual.tex > Documentation/latex/RefManual.inc.tex
cd Documentation/latex && pdflatex -interaction batchmode ref-manual.tex || true
python @top_srcdir@/Documentation/Scripts/tex2tex.py Doxygen/latex/ImplementorManual.tex > Doxygen/latex/ImplementorManual.inc.tex
cd Doxygen/latex && pdflatex -interaction batchmode implementor-manual.tex || true
python @top_srcdir@/Documentation/Scripts/tex2tex.py Documentation/latex/DbaManual.tex > Documentation/latex/DbaManual.inc.tex
cd Documentation/latex && pdflatex -interaction batchmode dba-manual.tex || true
python @top_srcdir@/Documentation/Scripts/tex2tex.py Doxygen/latex/RefManual.tex > Doxygen/latex/RefManual.inc.tex
cd Doxygen/latex && pdflatex -interaction batchmode ref-manual.tex || true
python @top_srcdir@/Documentation/Scripts/tex2tex.py Documentation/latex/ImpManual.tex > Documentation/latex/ImpManual.inc.tex
cd Documentation/latex && pdflatex -interaction batchmode imp-manual.tex || true
python @top_srcdir@/Documentation/Scripts/tex2tex.py Doxygen/latex/DbaManual.tex > Doxygen/latex/DbaManual.inc.tex
cd Doxygen/latex && pdflatex -interaction batchmode dba-manual.tex || true
python @top_srcdir@/Documentation/Scripts/tex2tex.py Doxygen/latex/ImpManual.tex > Doxygen/latex/ImpManual.inc.tex
cd Doxygen/latex && pdflatex -interaction batchmode imp-manual.tex || true
################################################################################
### @brief cleanup
@ -114,8 +123,8 @@ latex: Documentation/arango-latex.doxy $(DOXYGEN)
CLEANUP += \
$(DOXYGEN) \
$(addsuffix .md,$(addprefix Documentation/xml/,$(WIKI))) \
$(addsuffix .md,$(addprefix Documentation/wiki/,$(WIKI)))
$(addsuffix .md,$(addprefix Doxygen/xml/,$(WIKI))) \
$(addsuffix .md,$(addprefix Doxygen/wiki/,$(WIKI)))
################################################################################
## --SECTION-- END-OF-FILE

View File

@ -629,7 +629,7 @@ WARN_LOGFILE =
# with spaces.
INPUT = \
./Doxygen/js \
./Documentation/js \
./arangod \
./lib
@ -698,10 +698,10 @@ EXCLUDE_SYMBOLS =
# the \include command).
EXAMPLE_PATH = \
./Doxygen/Examples.Ahuacatl \
./Doxygen/Examples.ArangoDB \
./Doxygen/Examples.Durham \
./Doxygen/Examples.Fyn \
./Documentation/Examples.Ahuacatl \
./Documentation/Examples.ArangoDB \
./Documentation/Examples.Durham \
./Documentation/Examples.Fyn \
./Demos/Scripts
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
@ -864,13 +864,13 @@ HTML_FILE_EXTENSION = .html
# each generated HTML page. If it is left blank doxygen will generate a
# standard header.
HTML_HEADER = ./Doxygen/Scripts/arangodb_header.html
HTML_HEADER = ./Documentation/Scripts/arangodb_header.html
# The HTML_FOOTER tag can be used to specify a personal HTML footer for
# each generated HTML page. If it is left blank doxygen will generate a
# standard footer.
HTML_FOOTER = ./Doxygen/Scripts/arangodb_footer.html
HTML_FOOTER = ./Documentation/Scripts/arangodb_footer.html
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
# style sheet that is used by each HTML page. It can be used to
@ -879,7 +879,7 @@ HTML_FOOTER = ./Doxygen/Scripts/arangodb_footer.html
# the style sheet file to the HTML output directory, so don't put your own
# stylesheet in the HTML output directory as well, or it will be erased!
HTML_STYLESHEET = ./Doxygen/Scripts/arangodb.css
HTML_STYLESHEET = ./Documentation/Scripts/arangodb.css
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
# Doxygen will adjust the colors in the stylesheet and background images

View File

@ -629,7 +629,7 @@ WARN_LOGFILE =
# with spaces.
INPUT = \
./Doxygen/js \
./Documentation/js \
./arangod \
./lib
@ -698,10 +698,10 @@ EXCLUDE_SYMBOLS =
# the \include command).
EXAMPLE_PATH = \
./Doxygen/Examples.Ahuacatl \
./Doxygen/Examples.ArangoDB \
./Doxygen/Examples.Durham \
./Doxygen/Examples.Fyn \
./Documentation/Examples.Ahuacatl \
./Documentation/Examples.ArangoDB \
./Documentation/Examples.Durham \
./Documentation/Examples.Fyn \
./Demos/Scripts
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
@ -864,13 +864,13 @@ HTML_FILE_EXTENSION = .html
# each generated HTML page. If it is left blank doxygen will generate a
# standard header.
HTML_HEADER = ./Doxygen/Scripts/arangodb_header.html
HTML_HEADER = ./Documentation/Scripts/arangodb_header.html
# The HTML_FOOTER tag can be used to specify a personal HTML footer for
# each generated HTML page. If it is left blank doxygen will generate a
# standard footer.
HTML_FOOTER = ./Doxygen/Scripts/arangodb_footer.html
HTML_FOOTER = ./Documentation/Scripts/arangodb_footer.html
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
# style sheet that is used by each HTML page. It can be used to
@ -879,7 +879,7 @@ HTML_FOOTER = ./Doxygen/Scripts/arangodb_footer.html
# the style sheet file to the HTML output directory, so don't put your own
# stylesheet in the HTML output directory as well, or it will be erased!
HTML_STYLESHEET = ./Doxygen/Scripts/arangodb.css
HTML_STYLESHEET = ./Documentation/Scripts/arangodb.css
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
# Doxygen will adjust the colors in the stylesheet and background images

View File

@ -629,7 +629,7 @@ WARN_LOGFILE =
# with spaces.
INPUT = \
./Doxygen/js \
./Documentation/js \
./arangod \
./lib
@ -698,10 +698,10 @@ EXCLUDE_SYMBOLS =
# the \include command).
EXAMPLE_PATH = \
./Doxygen/Examples.Ahuacatl \
./Doxygen/Examples.ArangoDB \
./Doxygen/Examples.Durham \
./Doxygen/Examples.Fyn \
./Documentation/Examples.Ahuacatl \
./Documentation/Examples.ArangoDB \
./Documentation/Examples.Durham \
./Documentation/Examples.Fyn \
./Demos/Scripts
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
@ -864,13 +864,13 @@ HTML_FILE_EXTENSION = .html
# each generated HTML page. If it is left blank doxygen will generate a
# standard header.
HTML_HEADER = ./Doxygen/Scripts/arangodb_header.html
HTML_HEADER = ./Documentation/Scripts/arangodb_header.html
# The HTML_FOOTER tag can be used to specify a personal HTML footer for
# each generated HTML page. If it is left blank doxygen will generate a
# standard footer.
HTML_FOOTER = ./Doxygen/Scripts/arangodb_footer.html
HTML_FOOTER = ./Documentation/Scripts/arangodb_footer.html
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
# style sheet that is used by each HTML page. It can be used to
@ -879,7 +879,7 @@ HTML_FOOTER = ./Doxygen/Scripts/arangodb_footer.html
# the style sheet file to the HTML output directory, so don't put your own
# stylesheet in the HTML output directory as well, or it will be erased!
HTML_STYLESHEET = ./Doxygen/Scripts/arangodb.css
HTML_STYLESHEET = ./Documentation/Scripts/arangodb.css
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
# Doxygen will adjust the colors in the stylesheet and background images

View File

@ -629,7 +629,7 @@ WARN_LOGFILE =
# with spaces.
INPUT = \
@srcdir@/Doxygen/js \
@srcdir@/Documentation/js \
@srcdir@/arangod \
@srcdir@/lib
@ -698,10 +698,10 @@ EXCLUDE_SYMBOLS =
# the \include command).
EXAMPLE_PATH = \
@srcdir@/Doxygen/Examples.Ahuacatl \
@srcdir@/Doxygen/Examples.ArangoDB \
@srcdir@/Doxygen/Examples.Durham \
@srcdir@/Doxygen/Examples.Fyn \
@srcdir@/Documentation/Examples.Ahuacatl \
@srcdir@/Documentation/Examples.ArangoDB \
@srcdir@/Documentation/Examples.Durham \
@srcdir@/Documentation/Examples.Fyn \
@srcdir@/Demos/Scripts
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
@ -864,13 +864,13 @@ HTML_FILE_EXTENSION = .html
# each generated HTML page. If it is left blank doxygen will generate a
# standard header.
HTML_HEADER = @srcdir@/Doxygen/Scripts/arangodb_header.html
HTML_HEADER = @srcdir@/Documentation/Scripts/arangodb_header.html
# The HTML_FOOTER tag can be used to specify a personal HTML footer for
# each generated HTML page. If it is left blank doxygen will generate a
# standard footer.
HTML_FOOTER = @srcdir@/Doxygen/Scripts/arangodb_footer.html
HTML_FOOTER = @srcdir@/Documentation/Scripts/arangodb_footer.html
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
# style sheet that is used by each HTML page. It can be used to
@ -879,7 +879,7 @@ HTML_FOOTER = @srcdir@/Doxygen/Scripts/arangodb_footer.html
# the style sheet file to the HTML output directory, so don't put your own
# stylesheet in the HTML output directory as well, or it will be erased!
HTML_STYLESHEET = @srcdir@/Doxygen/Scripts/arangodb.css
HTML_STYLESHEET = @srcdir@/Documentation/Scripts/arangodb.css
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
# Doxygen will adjust the colors in the stylesheet and background images

File diff suppressed because it is too large Load Diff

View File

@ -9,11 +9,14 @@ OUTPUT_FOLDER="Doxygen/manuals/$(PACKAGE_VERSION)"
## publish
################################################################################
.PHONY: publish publish-wiki publish-html publish-pdf
.PHONY: publish publish-prepare publish-wiki publish-html publish-pdf
publish: publish-wiki publish-html publish-pdf
publish: publish-prepare publish-wiki publish-html publish-pdf
cd Doxygen/manuals && scp -r "$(PACKAGE_VERSION)" $(MANUAL_DST)
publish-prepare:
@test -d $(OUTPUT_FOLDER) || mkdir -p $(OUTPUT_FOLDER)
publish-wiki:
(cd Doxygen/wiki && git checkout --force -- . && git clean -f -d -x && git pull)
$(MAKE) wiki
@ -36,4 +39,4 @@ publish-pdf: $(OUTPUT_FOLDER)
scp arangod/Documentation/arangodb_1.0_shell_reference_card.pdf $(OUTPUT_FOLDER)
$(OUTPUT_FOLDER):
mkdir -p $(OUTPUT_FOLDER)/images
mkdir -p $(OUTPUT_FOLDER)/images

View File

@ -51,22 +51,22 @@ BUILT_SOURCES += $(MRUBY_HEADER)
################################################################################
DOXYGEN = \
Doxygen/js/actions/system/api-collection.c \
Doxygen/js/actions/system/api-cursor.c \
Doxygen/js/actions/system/api-edges.c \
Doxygen/js/actions/system/api-explain.c \
Doxygen/js/actions/system/api-index.c \
Doxygen/js/actions/system/api-query.c \
Doxygen/js/actions/system/api-simple.c \
Doxygen/js/actions/system/api-system.c \
Doxygen/js/common/bootstrap/modules.c \
Doxygen/js/common/bootstrap/print.c \
Doxygen/js/common/modules/graph.c \
Doxygen/js/common/modules/jsunity.c \
Doxygen/js/common/modules/simple-query-basics.c \
Doxygen/js/server/modules/actions.c \
Doxygen/js/server/modules/simple-query.c \
Doxygen/js/server/server.c
Documentation/js/actions/system/api-collection.c \
Documentation/js/actions/system/api-cursor.c \
Documentation/js/actions/system/api-edges.c \
Documentation/js/actions/system/api-explain.c \
Documentation/js/actions/system/api-index.c \
Documentation/js/actions/system/api-query.c \
Documentation/js/actions/system/api-simple.c \
Documentation/js/actions/system/api-system.c \
Documentation/js/common/bootstrap/modules.c \
Documentation/js/common/bootstrap/print.c \
Documentation/js/common/modules/graph.c \
Documentation/js/common/modules/jsunity.c \
Documentation/js/common/modules/simple-query-basics.c \
Documentation/js/server/modules/actions.c \
Documentation/js/server/modules/simple-query.c \
Documentation/js/server/server.c
################################################################################
### @brief wiki pages

View File

@ -1034,7 +1034,7 @@ top_srcdir = @top_srcdir@
BUILT_SOURCES = build.h $(JAVASCRIPT_HEADER) $(JAVASCRIPT_BROWSER) \
$(MRUBY_HEADER) etc/arangodb/arangod.conf \
etc/arangodb/arangoirb.conf etc/arangodb/arangosh.conf \
$(am__append_16) Documentation/.setup-directories \
$(am__append_16) Doxygen/.setup-directories \
@builddir@/.setup-js-directories $(am__append_17) \
$(am__append_19) $(am__append_20) $(am__append_22) \
$(PROTOBUF_FILES) $(am__append_24) $(am__append_25) \
@ -1056,11 +1056,10 @@ BUILT_SOURCES = build.h $(JAVASCRIPT_HEADER) $(JAVASCRIPT_BROWSER) \
### @brief cleanup
################################################################################
CLEANUP = bin/arango-password bin/arango-upgrade bin/arango-dfdb \
$(DOXYGEN) $(addsuffix .md,$(addprefix \
Documentation/xml/,$(WIKI))) $(addsuffix .md,$(addprefix \
Documentation/wiki/,$(WIKI))) $(JAVASCRIPT_HEADER) \
.setup-js-directories $(am__append_18) $(am__append_21) \
$(am__append_23) $(PROTOBUF_FILES)
$(DOXYGEN) $(addsuffix .md,$(addprefix Doxygen/xml/,$(WIKI))) \
$(addsuffix .md,$(addprefix Doxygen/wiki/,$(WIKI))) \
$(JAVASCRIPT_HEADER) .setup-js-directories $(am__append_18) \
$(am__append_21) $(am__append_23) $(PROTOBUF_FILES)
################################################################################
### @brief flex files
@ -1201,22 +1200,22 @@ MRUBY_HEADER = \
### @brief JavaScript files
################################################################################
DOXYGEN = \
Doxygen/js/actions/system/api-collection.c \
Doxygen/js/actions/system/api-cursor.c \
Doxygen/js/actions/system/api-edges.c \
Doxygen/js/actions/system/api-explain.c \
Doxygen/js/actions/system/api-index.c \
Doxygen/js/actions/system/api-query.c \
Doxygen/js/actions/system/api-simple.c \
Doxygen/js/actions/system/api-system.c \
Doxygen/js/common/bootstrap/modules.c \
Doxygen/js/common/bootstrap/print.c \
Doxygen/js/common/modules/graph.c \
Doxygen/js/common/modules/jsunity.c \
Doxygen/js/common/modules/simple-query-basics.c \
Doxygen/js/server/modules/actions.c \
Doxygen/js/server/modules/simple-query.c \
Doxygen/js/server/server.c
Documentation/js/actions/system/api-collection.c \
Documentation/js/actions/system/api-cursor.c \
Documentation/js/actions/system/api-edges.c \
Documentation/js/actions/system/api-explain.c \
Documentation/js/actions/system/api-index.c \
Documentation/js/actions/system/api-query.c \
Documentation/js/actions/system/api-simple.c \
Documentation/js/actions/system/api-system.c \
Documentation/js/common/bootstrap/modules.c \
Documentation/js/common/bootstrap/print.c \
Documentation/js/common/modules/graph.c \
Documentation/js/common/modules/jsunity.c \
Documentation/js/common/modules/simple-query-basics.c \
Documentation/js/server/modules/actions.c \
Documentation/js/server/modules/simple-query.c \
Documentation/js/server/server.c
################################################################################
@ -5341,7 +5340,8 @@ unittests-brief: \
unittests-shell-server-ahuacatl \
unittests-http-server \
unittests-ssl-server \
unittests-shell-client
unittests-shell-client \
unittests-import
unittests-verbose:
@echo "################################################################################"
@ -5484,6 +5484,34 @@ unittests-shell-client:
################################################################################
################################################################################
.PHONY: unittests-import
unittests-import:
$(MAKE) start-server PID=$(PID) SERVER_START="--server.endpoint unix://$(VOCDIR)/arango.sock --server.disable-authentication true" PROTO=unix
@echo
@echo "================================================================================"
@echo "<< IMPORT TESTS >>"
@echo "================================================================================"
@echo
$(VALGRIND) @builddir@/bin/arangosh $(CLIENT_OPT) --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --javascript.unit-tests @top_srcdir@/js/server/tests/import-setup.js || test "x$(FORCE)" == "x1"
for i in 1 2; do $(VALGRIND) @builddir@/bin/arangoimp --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --file UnitTests/import-$$i.json --collection UnitTestsImportJson$$i --create-collection true --type json || test "x$(FORCE)" == "x1"; done
for i in 1 2; do $(VALGRIND) @builddir@/bin/arangoimp --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --file UnitTests/import-$$i.csv --collection UnitTestsImportCsv$$i --create-collection true --type csv || test "x$(FORCE)" == "x1"; done
$(VALGRIND) @builddir@/bin/arangosh $(CLIENT_OPT) --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --javascript.unit-tests @top_srcdir@/js/server/tests/import.js || test "x$(FORCE)" == "x1"
$(VALGRIND) @builddir@/bin/arangosh $(CLIENT_OPT) --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --javascript.unit-tests @top_srcdir@/js/server/tests/import-setup.js || test "x$(FORCE)" == "x1"
kill `cat $(PIDFILE)`
while test -f $(PIDFILE); do sleep 1; done
@if [ "$(VALGRIND)" != "" ]; then sleep 60; fi
@rm -rf "$(VOCDIR)"
@echo
################################################################################
################################################################################
.PHONY: unittests-http-server
unittests-http-server:
@ -5579,38 +5607,43 @@ clean-local:
built-sources: build.h errorfiles $(JAVASCRIPT_HEADER)
.PHONY: Documentation/js Documentation/js/system Documentation/js/modules
.PHONY: Doxygen/js Doxygen/js/system Doxygen/js/modules
Documentation/.setup-directories:
@test -d Documentation/js || mkdir Documentation/js
@test -d Documentation/js/actions || mkdir Documentation/js/actions
@test -d Documentation/js/actions/system || mkdir Documentation/js/actions/system
@test -d Documentation/js/common || mkdir Documentation/js/common
@test -d Documentation/js/common/bootstrap || mkdir Documentation/js/common/bootstrap
@test -d Documentation/js/common/modules || mkdir Documentation/js/common/modules
@test -d Documentation/js/server || mkdir Documentation/js/server
@test -d Documentation/js/server/modules || mkdir Documentation/js/server/modules
@test -d Documentation/js/client || mkdir Documentation/js/client
@test -d Documentation/web || mkdir Documentation/web
Doxygen/.setup-directories:
@test -d Doxygen || mkdir Doxygen
@test -d Doxygen/js || mkdir Doxygen/js
@test -d Doxygen/js/actions || mkdir Doxygen/js/actions
@test -d Doxygen/js/actions/system || mkdir Doxygen/js/actions/system
@test -d Doxygen/js/common || mkdir Doxygen/js/common
@test -d Doxygen/js/common/bootstrap || mkdir Doxygen/js/common/bootstrap
@test -d Doxygen/js/common/modules || mkdir Doxygen/js/common/modules
@test -d Doxygen/js/server || mkdir Doxygen/js/server
@test -d Doxygen/js/server/modules || mkdir Doxygen/js/server/modules
@test -d Doxygen/js/client || mkdir Doxygen/js/client
@test -d Doxygen/web || mkdir Doxygen/web
@test -d Doxygen/web/images || mkdir Doxygen/web/images
@test -d Doxygen/wiki || mkdir Doxygen/wiki
@test -d Doxygen/latex || mkdir Doxygen/latex
@test -d Doxygen/latex/images || mkdir Doxygen/latex/images
@touch $@
Documentation/js/actions/system/%.c: @srcdir@/js/actions/system/%.js Documentation/.setup-directories
Doxygen/js/actions/system/%.c: @srcdir@/js/actions/system/%.js Doxygen/.setup-directories
@python @top_srcdir@/Documentation/Scripts/js2doxy.py $< > $@
Documentation/js/common/bootstrap/%.c: @srcdir@/js/common/bootstrap/%.js Documentation/.setup-directories
Doxygen/js/common/bootstrap/%.c: @srcdir@/js/common/bootstrap/%.js Doxygen/.setup-directories
@python @top_srcdir@/Documentation/Scripts/js2doxy.py $< > $@
Documentation/js/common/modules/%.c: @srcdir@/js/common/modules/%.js Documentation/.setup-directories
Doxygen/js/common/modules/%.c: @srcdir@/js/common/modules/%.js Doxygen/.setup-directories
@python @top_srcdir@/Documentation/Scripts/js2doxy.py $< > $@
Documentation/js/server/%.c: @srcdir@/js/server/%.js Documentation/.setup-directories
Doxygen/js/server/%.c: @srcdir@/js/server/%.js Doxygen/.setup-directories
@python @top_srcdir@/Documentation/Scripts/js2doxy.py $< > $@
Documentation/js/server/modules/%.c: @srcdir@/js/server/modules/%.js Documentation/.setup-directories
Doxygen/js/server/modules/%.c: @srcdir@/js/server/modules/%.js Doxygen/.setup-directories
@python @top_srcdir@/Documentation/Scripts/js2doxy.py $< > $@
Documentation/xml/%.md: Documentation/xml/%.xml
@python @top_srcdir@/Documentation/Scripts/xml2md.py $< > $@
Doxygen/xml/%.md: Doxygen/xml/%.xml
@python @top_srcdir@/Doxygen/Scripts/xml2md.py $< > $@
################################################################################
### @brief doxygen
@ -5622,9 +5655,10 @@ Documentation/arango-html.doxy: Documentation/arango.template
sed -e 's:GENERATE_HTML *= *NO:GENERATE_HTML = YES:' -e 's:ENABLED_SECTIONS *=:ENABLED_SECTIONS = HTML:' < $< > $@
$(MAKE) lib/BasicsC/voc-errors.h
doxygen: Documentation/arango-html.doxy $(DOXYGEN)
doxygen: Doxygen/.setup-directories Documentation/arango-html.doxy $(DOXYGEN)
doxygen Documentation/arango-html.doxy > /dev/null
@for w in $(WIKI); do @top_srcdir@/Documentation/Scripts/html2html.sh Documentation/html/$$w.html Documentation/web/$$w.html; done
@for w in $(WIKI); do @top_srcdir@/Documentation/Scripts/html2html.sh Doxygen/html/$$w.html Doxygen/web/$$w.html; done
cp -R @top_srcdir@/Documentation/web/images/* Doxygen/web/images
################################################################################
### @brief wiki
@ -5637,9 +5671,9 @@ Documentation/arango-xml.doxy: Documentation/arango.template
$(MAKE) lib/BasicsC/voc-errors.h
wiki: wiki2
@test -d Documentation/wiki || mkdir Documentation/wiki
@for w in $(WIKI); do python @top_srcdir@/Documentation/Scripts/xml2md.py Documentation/xml/$$w.xml > Documentation/xml/$$w.md; done
@for w in $(WIKI); do @top_srcdir@/Documentation/Scripts/fixmd.sh Documentation/xml/$$w.md; done
@test -d Doxygen/wiki || mkdir Doxygen/wiki
@for w in $(WIKI); do python @top_srcdir@/Documentation/Scripts/xml2md.py Doxygen/xml/$$w.xml > Doxygen/xml/$$w.md; done
@for w in $(WIKI); do @top_srcdir@/Documentation/Scripts/fixmd.sh Doxygen/xml/$$w.md; done
wiki2: Documentation/arango-xml.doxy $(DOXYGEN)
doxygen Documentation/arango-xml.doxy > /dev/null
@ -5654,28 +5688,31 @@ Documentation/arango-latex.doxy: Documentation/arango.template
sed -e 's:GENERATE_LATEX *= *NO:GENERATE_LATEX = YES:' -e 's:ENABLED_SECTIONS *=:ENABLED_SECTIONS = LATEX:' < $< > $@
$(MAKE) lib/BasicsC/voc-errors.h
latex: Documentation/arango-latex.doxy $(DOXYGEN)
latex: Doxygen/.setup-directories Documentation/arango-latex.doxy $(DOXYGEN)
doxygen Documentation/arango-latex.doxy > /dev/null
echo "\def\arangodbversion{@PACKAGE_VERSION@}" > Documentation/latex/version.tex
echo "\def\arangodbversion{@PACKAGE_VERSION@}" > Doxygen/latex/version.tex
python @top_srcdir@/Documentation/Scripts/tex2tex.py Documentation/latex/InstallManual.tex > Documentation/latex/InstallManual.inc.tex
cd Documentation/latex && pdflatex -interaction batchmode install-manual.tex || true
cp -R Documentation/latex/*.tex Doxygen/latex
cp -R Documentation/latex/images Doxygen/latex/images
python @top_srcdir@/Documentation/Scripts/tex2tex.py Documentation/latex/UserManual.tex > Documentation/latex/UserManual.inc.tex
cd Documentation/latex && pdflatex -interaction batchmode user-manual.tex || true
python @top_srcdir@/Documentation/Scripts/tex2tex.py Doxygen/latex/InstallManual.tex > Doxygen/latex/InstallManual.inc.tex
cd Doxygen/latex && pdflatex -interaction batchmode install-manual.tex || true
python @top_srcdir@/Documentation/Scripts/tex2tex.py Documentation/latex/ImplementorManual.tex > Documentation/latex/ImplementorManual.inc.tex
cd Documentation/latex && pdflatex -interaction batchmode implementor-manual.tex || true
python @top_srcdir@/Documentation/Scripts/tex2tex.py Doxygen/latex/UserManual.tex > Doxygen/latex/UserManual.inc.tex
cd Doxygen/latex && pdflatex -interaction batchmode user-manual.tex || true
python @top_srcdir@/Documentation/Scripts/tex2tex.py Documentation/latex/RefManual.tex > Documentation/latex/RefManual.inc.tex
cd Documentation/latex && pdflatex -interaction batchmode ref-manual.tex || true
python @top_srcdir@/Documentation/Scripts/tex2tex.py Doxygen/latex/ImplementorManual.tex > Doxygen/latex/ImplementorManual.inc.tex
cd Doxygen/latex && pdflatex -interaction batchmode implementor-manual.tex || true
python @top_srcdir@/Documentation/Scripts/tex2tex.py Documentation/latex/DbaManual.tex > Documentation/latex/DbaManual.inc.tex
cd Documentation/latex && pdflatex -interaction batchmode dba-manual.tex || true
python @top_srcdir@/Documentation/Scripts/tex2tex.py Doxygen/latex/RefManual.tex > Doxygen/latex/RefManual.inc.tex
cd Doxygen/latex && pdflatex -interaction batchmode ref-manual.tex || true
python @top_srcdir@/Documentation/Scripts/tex2tex.py Documentation/latex/ImpManual.tex > Documentation/latex/ImpManual.inc.tex
cd Documentation/latex && pdflatex -interaction batchmode imp-manual.tex || true
python @top_srcdir@/Documentation/Scripts/tex2tex.py Doxygen/latex/DbaManual.tex > Doxygen/latex/DbaManual.inc.tex
cd Doxygen/latex && pdflatex -interaction batchmode dba-manual.tex || true
python @top_srcdir@/Documentation/Scripts/tex2tex.py Doxygen/latex/ImpManual.tex > Doxygen/latex/ImpManual.inc.tex
cd Doxygen/latex && pdflatex -interaction batchmode imp-manual.tex || true
################################################################################
################################################################################

View File

@ -33,7 +33,8 @@ unittests-brief: \
unittests-shell-server-ahuacatl \
unittests-http-server \
unittests-ssl-server \
unittests-shell-client
unittests-shell-client \
unittests-import
unittests-verbose:
@echo "################################################################################"
@ -322,6 +323,35 @@ unittests-shell-client:
@rm -rf "$(VOCDIR)"
@echo
################################################################################
## IMPORT TESTS
################################################################################
.PHONY: unittests-import
unittests-import:
$(MAKE) start-server PID=$(PID) SERVER_START="--server.endpoint unix://$(VOCDIR)/arango.sock --server.disable-authentication true" PROTO=unix
@echo
@echo "================================================================================"
@echo "<< IMPORT TESTS >>"
@echo "================================================================================"
@echo
$(VALGRIND) @builddir@/bin/arangosh $(CLIENT_OPT) --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --javascript.unit-tests @top_srcdir@/js/server/tests/import-setup.js || test "x$(FORCE)" == "x1"
for i in 1 2; do $(VALGRIND) @builddir@/bin/arangoimp --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --file UnitTests/import-$$i.json --collection UnitTestsImportJson$$i --create-collection true --type json || test "x$(FORCE)" == "x1"; done
for i in 1 2; do $(VALGRIND) @builddir@/bin/arangoimp --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --file UnitTests/import-$$i.csv --collection UnitTestsImportCsv$$i --create-collection true --type csv || test "x$(FORCE)" == "x1"; done
$(VALGRIND) @builddir@/bin/arangosh $(CLIENT_OPT) --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --javascript.unit-tests @top_srcdir@/js/server/tests/import.js || test "x$(FORCE)" == "x1"
$(VALGRIND) @builddir@/bin/arangosh $(CLIENT_OPT) --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --javascript.unit-tests @top_srcdir@/js/server/tests/import-setup.js || test "x$(FORCE)" == "x1"
kill `cat $(PIDFILE)`
while test -f $(PIDFILE); do sleep 1; done
@if [ "$(VALGRIND)" != "" ]; then sleep 60; fi
@rm -rf "$(VOCDIR)"
@echo
################################################################################
## HTTP SERVER TESTS
################################################################################

6
UnitTests/import-1.csv Normal file
View File

@ -0,0 +1,6 @@
"id","a","b","c","d","e"
1,"1",1,"1.3",null,-5
2,null,"",3.1,-2.5,"ddd "" ' ffd"
3,"this","is"
4,let's,see,what,happens
Can't render this file because it has a wrong number of fields in line 5.

12
UnitTests/import-1.json Normal file
View File

@ -0,0 +1,12 @@
{"id": 1, "one":1, "two": 2, "three": 3}
{"id": 2, "a" : 1234, "b": "the quick fox", "jumped": "over the fox", "null": null }
{"id": 3, "spacing" : "is", "not": "important" }
{"id": 4, "a": true, "b": false, " c " : "h\"'ihi", "d" : "" }
{"id" : 5 }
{"id": 6, "this \" should be enough'"}
{"id": 7, "a" : 1234, "b": "the quick fox", "jumped: "over the fox", "null": null }
{"id" : 8, "i am" : broken }

2
UnitTests/import-2.csv Normal file
View File

@ -0,0 +1,2 @@
1,2,3,4,5,6
1 1 2 3 4 5 6

8
UnitTests/import-2.json Normal file
View File

@ -0,0 +1,8 @@
{"id": 1, "value" : -445.4 }
{"id": 2, "value" : 3.4e4 }
{"id": 3, "value" : null }

View File

@ -33,6 +33,8 @@
/// <ul>
/// <li>@ref AqlPurpose
/// </li>
/// <li>@ref AqlHowToUse
/// </li>
/// <li>@ref AqlQueryResults
/// </li>
/// <li>@ref AqlBasics
@ -108,6 +110,60 @@
///
/// For some example queries, please refer to the page @ref AqlExamples.
///
/// @section AqlHowToUse How to invoke AQL
///
/// You can run AQL queries from your application via the HTTP REST API. The
/// full API description is available at @ref HttpCursor.
///
/// You can also run AQL queries from arangosh. To do so, first create an ArangoStatement
/// object as follows:
/// @code
/// arangosh> stmt = db._createStatement( { "query": "FOR i IN [ 1, 2 ] RETURN i * 2" } );
/// [object ArangoStatement]
/// @endcode
///
/// To execute the query, use the @LIT{execute} method:
/// @code
/// arangosh> c = stmt.execute();
/// [object ArangoQueryCursor]
/// @endcode
/// This has executed the query. The query results are available in a cursor now. The
/// cursor can return all its results at once using the @LIT{elements} method:
/// @code
/// arangosh> c.elements();
/// [2, 4]
/// @endcode
///
/// To execute a query using bind parameters, you need to create a statement first and
/// then bind the parameters to it before execution:
/// @code
/// arangosh> stmt = db._createStatement( { "query": "FOR i IN [ @one, @two ] RETURN i * 2" } );
/// [object ArangoStatement]
/// arangosh> stmt.bind("one", 1);
/// arangosh> stmt.bind("two", 2);
/// arangosh> c = stmt.execute();
/// [object ArangoQueryCursor]
/// @endcode
/// The cursor results can then be dumped or traversed:
/// @code
/// arangosh> while (c.hasNext()) { print(c.next()); }
/// 2
/// 4
/// @endcode
/// Please note that each cursor can be used exactly once as they are forward-only.
/// Once all cursor results have been dumped or iterated, the cursor is empty. To iterate
/// through the results again, the query needs to be re-executed.
///
/// Please also note that when using bind parameters, you must not re-declare an existing
/// bind parameter because this will be considered an error:
/// @code
/// arangosh> stmt = db._createStatement( { "query": "FOR i IN [ @one, @two ] RETURN i * 2" } );
/// [object ArangoStatement]
/// arangosh> stmt.bind("one", 1);
/// arangosh> stmt.bind("one", 1);
/// JavaScript exception in file 'client/client.js' at 771,9: redeclaration of bind parameter
/// @endcode
///
/// @section AqlQueryResults Query results
///
/// @subsection AqlQueryResultsSet Result sets

View File

@ -422,11 +422,10 @@ bool RestImportHandler::createByList () {
// got a json document or list
// build the json object from the list
json = createJsonObject(keys, values);
json = createJsonObject(keys, values, line);
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, values);
if (!json) {
LOGGER_WARNING << "no valid JSON data in line: " << line;
++numError;
continue;
}
@ -496,17 +495,23 @@ TRI_json_t* RestImportHandler::parseJsonLine (const string& line) {
return json;
}
TRI_json_t* RestImportHandler::createJsonObject (TRI_json_t* keys, TRI_json_t* values) {
TRI_json_t* RestImportHandler::createJsonObject (TRI_json_t* keys, TRI_json_t* values, const string& line) {
if (values->_type != TRI_JSON_LIST) {
LOGGER_WARNING << "no valid JSON list data in line: " << line;
return 0;
}
if (keys->_value._objects._length != values->_value._objects._length) {
LOGGER_WARNING << "wrong number of JSON values in line: " << line;
return 0;
}
TRI_json_t* result = TRI_CreateArrayJson(TRI_UNKNOWN_MEM_ZONE);
if (result == 0) {
LOGGER_ERROR << "out of memory";
return 0;
}
size_t n = keys->_value._objects._length;

View File

@ -145,7 +145,7 @@ namespace triagens {
/// @brief builds a TRI_json_t object from a key and value list
////////////////////////////////////////////////////////////////////////////////
TRI_json_t* createJsonObject (TRI_json_t* keys, TRI_json_t* values);
TRI_json_t* createJsonObject (TRI_json_t* keys, TRI_json_t* values, const string& line);
////////////////////////////////////////////////////////////////////////////////
/// @brief checks the keys, returns true if all values in the list are strings.

View File

@ -1119,6 +1119,8 @@ int main (int argc, char* argv[]) {
z = "";
}
cout << endl;
printf("%s %s _ %s\n", g, r, z);
printf("%s __ _ _ __ __ _ _ __ __ _ ___ %s ___| |__ %s\n", g, r, z);
printf("%s / _` | '__/ _` | '_ \\ / _` |/ _ \\%s/ __| '_ \\ %s\n", g, r, z);

View File

@ -46,12 +46,12 @@ var API = "_api/simple/";
///
/// @REST{PUT /_api/simple/all}
///
/// Returns all documents of a collections. The call expects an JSON object
/// Returns all documents of a collections. The call expects a JSON object
/// as body with the following attributes:
///
/// - @LIT{collection}: The identifier or name of the collection to query.
///
/// - @LIT{skip}: The documents to skip in the query. (optional)
/// - @LIT{skip}: The number of documents to skip in the query (optional).
///
/// - @LIT{limit}: The maximal amount of documents to return. The @LIT{skip}
/// is applied before the @LIT{limit} restriction. (optional)
@ -60,7 +60,7 @@ var API = "_api/simple/";
///
/// @EXAMPLES
///
/// Limit the amount of documents using
/// Limit the amount of documents using @LIT{limit}
///
/// @verbinclude api-simple-all-skip-limit
////////////////////////////////////////////////////////////////////////////////

View File

@ -470,7 +470,7 @@ function ArangoQueryCursor (database, data) {
'ArangoQueryCursor constructor: ' + "\n" +
' > cu1 = qi1.execute(); ' + "\n" +
'Functions: ' + "\n" +
' hasMore(); returns true if there ' + "\n" +
' hasNext(); returns true if there ' + "\n" +
' are more results ' + "\n" +
' next(); returns the next document ' + "\n" +
' elements(); returns all documents ' + "\n" +

View File

@ -471,7 +471,7 @@ static string JS_client_client =
" 'ArangoQueryCursor constructor: ' + \"\\n\" +\n"
" ' > cu1 = qi1.execute(); ' + \"\\n\" +\n"
" 'Functions: ' + \"\\n\" +\n"
" ' hasMore(); returns true if there ' + \"\\n\" +\n"
" ' hasNext(); returns true if there ' + \"\\n\" +\n"
" ' are more results ' + \"\\n\" +\n"
" ' next(); returns the next document ' + \"\\n\" +\n"
" ' elements(); returns all documents ' + \"\\n\" +\n"

View File

@ -0,0 +1,40 @@
////////////////////////////////////////////////////////////////////////////////
/// @brief setup stuff for import tests
///
/// @file
///
/// DISCLAIMER
///
/// Copyright 2010-2012 triagens GmbH, Cologne, Germany
///
/// Licensed 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.
///
/// Copyright holder is triAGENS GmbH, Cologne, Germany
///
/// @author Jan Steemann
/// @author Copyright 2012, triAGENS GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
var internal = require("internal");
internal.db._drop("UnitTestsImportJson1");
internal.db._drop("UnitTestsImportJson2");
internal.db._drop("UnitTestsImportCsv1");
internal.db._drop("UnitTestsImportCsv2");
return true;
// Local Variables:
// mode: outline-minor
// outline-regexp: "^\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @}\\)"
// End:

148
js/server/tests/import.js Normal file
View File

@ -0,0 +1,148 @@
////////////////////////////////////////////////////////////////////////////////
/// @brief tests for query language, arithmetic operators
///
/// @file
///
/// DISCLAIMER
///
/// Copyright 2010-2012 triagens GmbH, Cologne, Germany
///
/// Licensed 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.
///
/// Copyright holder is triAGENS GmbH, Cologne, Germany
///
/// @author Jan Steemann
/// @author Copyright 2012, triAGENS GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
var internal = require("internal");
var jsunity = require("jsunity");
////////////////////////////////////////////////////////////////////////////////
/// @brief test suite
////////////////////////////////////////////////////////////////////////////////
function importTestSuite () {
////////////////////////////////////////////////////////////////////////////////
/// @brief execute a given query
////////////////////////////////////////////////////////////////////////////////
function executeQuery (query) {
var statement = internal.db._createStatement({"query": query});
var cursor = statement.execute();
return cursor;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief execute a given query and return the results as an array
////////////////////////////////////////////////////////////////////////////////
function getQueryResults (query) {
var result = executeQuery(query);
var results = [ ];
while (result.hasNext()) {
var keys = [ ];
var row = result.next();
for (var k in row) {
if (row.hasOwnProperty(k) && k != '_id' && k != '_rev') {
keys.push(k);
}
}
keys.sort();
var resultRow = { };
for (var k in keys) {
if (keys.hasOwnProperty(k)) {
resultRow[keys[k]] = row[keys[k]];
}
}
results.push(resultRow);
}
return results;
}
return {
////////////////////////////////////////////////////////////////////////////////
/// @brief set up
////////////////////////////////////////////////////////////////////////////////
setUp : function () {
},
////////////////////////////////////////////////////////////////////////////////
/// @brief tear down
////////////////////////////////////////////////////////////////////////////////
tearDown : function () {
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test json import
////////////////////////////////////////////////////////////////////////////////
testJsonImport1 : function () {
var expected = [ { "id": 1, "one": 1, "three": 3, "two": 2 }, { "a": 1234, "b": "the quick fox", "id": 2, "jumped": "over the fox", "null": null }, { "id": 3, "not": "important", "spacing": "is" }, { " c ": "h\"'ihi", "a": true, "b": false, "d": "", "id": 4 }, { "id": 5 } ];
var actual = getQueryResults("FOR i IN UnitTestsImportJson1 SORT i.id RETURN i");
assertEqual(expected, actual);
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test json import
////////////////////////////////////////////////////////////////////////////////
testJsonImport2 : function () {
var expected = [ { "id": 1, "value": -445.4 }, { "id": 2, "value": 34000 }, { "id": 3, "value": null } ];
var actual = getQueryResults("FOR i IN UnitTestsImportJson2 SORT i.id RETURN i");
assertEqual(expected, actual);
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test csv import
////////////////////////////////////////////////////////////////////////////////
testCsvImport1 : function () {
var expected = [ { "a": "1", "b": 1, "c": "1.3", "d": null, "e": -5, "id": 1 }, { "a": null, "b": "", "c": 3.1, "d": -2.5, "e": "ddd \" ' ffd", "id": 2 } ];
var actual = getQueryResults("FOR i IN UnitTestsImportCsv1 SORT i.id RETURN i");
assertEqual(expected, actual);
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test csv import
////////////////////////////////////////////////////////////////////////////////
testCsvImport2 : function () {
var expected = [ ]; // should be empty!
var actual = getQueryResults("FOR i IN UnitTestsImportCsv2 SORT i.id RETURN i");
assertEqual(expected, actual);
}
}
}
////////////////////////////////////////////////////////////////////////////////
/// @brief executes the test suite
////////////////////////////////////////////////////////////////////////////////
jsunity.run(importTestSuite);
return jsunity.done();
// Local Variables:
// mode: outline-minor
// outline-regexp: "^\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @}\\)"
// End: