Ignore:
Timestamp:
09/27/10 20:26:49 (15 years ago)
Author:
lgiessmann
Message:

new-datamodel: adapted the unit-test exporter-test:test-fragments-xtm1.0-versions to the new data model; fixed a bug when creating FragmentC objects-> topics referenced by variants of the main topic are also added as topic stubs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified branches/new-datamodel/src/unit_tests/exporter_xtm1.0_test.lisp

    r306 r316  
    391391                    return (identified-construct item)))
    392392           (t100-start-revision (d::start-revision (first (d::versions t100)))))
    393 
    394393      (d:get-fragments t100-start-revision)
    395394      (let ((t100-fragment (loop for item in (elephant:get-instances-by-class 'FragmentC)
    396395                              when (eq (topic item) t100)
    397396                              return item)))
    398 
    399397        (with-open-file (stream *out-xtm1.0-file* :direction :output)
    400398          (write-string (export-xtm-fragment t100-fragment :xtm-format '1.0) stream))))
     
    444442    (handler-case (delete-file *out-xtm1.0-file*)(error () )) ;deletes file - if exist
    445443    (export-xtm *out-xtm1.0-file* :revision fixtures::revision1 :xtm-format '1.0)
    446     (let ((document (dom:document-element (cxml:parse-file *out-xtm1.0-file* (cxml-dom:make-dom-builder))))
     444    (let ((document
     445           (dom:document-element
     446            (cxml:parse-file *out-xtm1.0-file* (cxml-dom:make-dom-builder))))
    447447          (t100-occurrences-resourceData (list "The ISO 19115 standard ..." "2003-01-01"))) ;local value->no type
    448448      (check-document-structure document 47 7 :ns-uri *xtm1.0-ns*)
     
    11221122           (loop for item in (elephant:get-instances-by-class 'd:PersistentIdC)
    11231123              when (string= (uri item) new-t100-psi)
    1124               return (identified-construct item))))
     1124              return (identified-construct item :revision fixtures::revision3))))
    11251125      (d:get-fragments fixtures::revision3)
    11261126      (let ((fragment (loop for item in (elephant:get-instances-by-class 'd:FragmentC)
     
    11291129        (with-open-file (stream *out-xtm1.0-file* :direction :output)
    11301130          (write-string (export-xtm-fragment fragment :xtm-format '1.0) stream))))
    1131 
    11321131    (let ((document
    11331132           (dom:document-element
    11341133            (cxml:parse-file *out-xtm1.0-file* (cxml-dom:make-dom-builder)))))
    1135       (check-document-structure document 6 0 :ns-uri *xtm1.0-ns*)
     1134      (check-document-structure document 9 1 :ns-uri *xtm1.0-ns*)
    11361135      (loop for topic across (xpath-child-elems-by-qname document *xtm1.0-ns* "topic")
    11371136         do (loop for subjectIndicatorRef across (xpath-child-elems-by-qname
     
    11461145                      ((string= href core-display-psi)
    11471146                       (check-topic-id topic))
     1147                      ((string= href constants:*type-instance-psi*)
     1148                       (check-topic-id topic))
     1149                      ((string= href constants:*type-psi*)
     1150                       (check-topic-id topic))
     1151                      ((string= href constants:*instance-psi*)
     1152                       (check-topic-id topic))
    11481153                      ((string= href t50a-psi)
    11491154                       (check-topic-id topic))
     
    11551160                       (check-topic-id topic)
    11561161                       (check-single-instanceOf document topic t3-psi :xtm-format '1.0)
    1157                        (loop for occurrence across (xpath-child-elems-by-qname topic *xtm1.0-ns* "occurrence")
     1162                       (loop for occurrence across (xpath-child-elems-by-qname
     1163                                                    topic *xtm1.0-ns* "occurrence")
    11581164                          do (let ((resourceRef
    11591165                                    (let ((resourceRef-nodes
    1160                                            (xpath-child-elems-by-qname occurrence *xtm1.0-ns* "resourceRef")))
     1166                                           (xpath-child-elems-by-qname
     1167                                            occurrence *xtm1.0-ns* "resourceRef")))
    11611168                                      (is (= (length resourceRef-nodes) 1))
    1162                                       (dom:get-attribute-ns (elt resourceRef-nodes 0) *xtm1.0-xlink* "href")))
     1169                                      (dom:get-attribute-ns (elt resourceRef-nodes 0)
     1170                                                            *xtm1.0-xlink* "href")))
    11631171                                   (instanceOf
    11641172                                    (let ((instanceOf-nodes
    1165                                            (xpath-child-elems-by-qname occurrence *xtm1.0-ns* "instanceOf")))
     1173                                           (xpath-child-elems-by-qname
     1174                                            occurrence *xtm1.0-ns* "instanceOf")))
    11661175                                      (is (= (length instanceOf-nodes) 1))
    11671176                                      (let ((topicRef-nodes
    11681177                                             (xpath-child-elems-by-qname
    1169                                               (elt instanceOf-nodes 0) *xtm1.0-ns* "topicRef")))
     1178                                              (elt instanceOf-nodes 0) *xtm1.0-ns*
     1179                                              "topicRef")))
    11701180                                        (is (= (length topicRef-nodes) 1))
    11711181                                        (get-subjectIndicatorRef-by-ref
     
    11741184                                          (elt topicRef-nodes 0) *xtm1.0-xlink* "href"))))))
    11751185                               (cond
    1176                                  ((string= resourceRef (first new-t100-occurrence-resourceRef-merge-2))
     1186                                 ((string= resourceRef
     1187                                           (first new-t100-occurrence-resourceRef-merge-2))
    11771188                                  (is (string= instanceOf t55-psi)))
    1178                                  ((string= resourceRef (second new-t100-occurrence-resourceRef-merge-2))
     1189                                 ((string= resourceRef
     1190                                           (second new-t100-occurrence-resourceRef-merge-2))
    11791191                                  (is (string= instanceOf t55-psi)))
    11801192                                 (t
Note: See TracChangeset for help on using the changeset viewer.