Project

General

Profile

« Previous | Next » 

Revision 1783

Added by Matt Jones about 21 years ago

Wrote the login() function, the first of the series of API calls for
the metacat client to be implemented. Also wrote a test class to
test the API functionality.

View differences:

build.xml
79 79
      <property name="context" value="tao" />
80 80
      <property name="user" value="tao"/>
81 81
      <property name="password" value=""/>
82
      <property name="mcuser" value="uid=jones,o=NCEAS,dc=ecoinformatics,dc=org"/>
83
      <property name="mcpassword" value=""/>
82 84
      <!-- Tomcat version, if you use tomcat 3, please fill it "tomcat3". If you using tomcat4, please fill it "tomcat4"-->
83 85
      <property name="tomcatversion" value="tomcat4"/>
84 86

  
......
171 173
      <filter token="html-path" value="${html-path}"/>
172 174
      <filter token="user" value="${user}"/>
173 175
      <filter token="password" value="${password}"/>
176
      <filter token="mcuser" value="${mcuser}"/>
177
      <filter token="mcpassword" value="${mcpassword}"/>
174 178
      <filter token="image-path" value="${image-path}"/>
175 179
      <filter token="style-path" value="${style-path}"/>
176 180
      <filter token="web-base-url" value="${web-base-url}"/>
......
189 193
      <filter token="debugprefix" value="${debugprefix}"/>
190 194

  
191 195
      <property name="srcdir" value="./src" />
196
      <property name="testdir" value="./test" />
197
      <property name="testtorun" value="MetacatClientTest" />
192 198
      <property name="junittestsdir" value="./test/edu/ucsb/nceas/metacattest" />
193 199
      <property name="junitnettestsdir" value="./test/edu/ucsb/nceas/metacatnettest" />
194 200
      <property name="build.dir" value="./build"/>
......
434 440
     
435 441
   </target>
436 442
   
437
   
443
   <target name="testprep" depends="install">
444
      <mkdir dir="${build.tests}"/>
445
      <copy todir="${build.tests}" filtering="yes">
446
        <fileset dir="${testdir}">
447
          <include name="edu/**"/>
448
        </fileset>
449
      </copy>
450
   </target>
438 451

  
439
   <target name="test" depends="install">
452
   <target name="test" depends="testprep">
440 453
      <!-- copy and compile the tests into a jar file -->
441
      <mkdir dir="${build.metacattest}"/>
442
      <javac srcdir="${junittestsdir}"
443
             destdir="${build.metacattest}"
454
      <javac srcdir="${build.tests}"
455
             destdir="${build.tests}"
444 456
             classpath="${cpath}:${build.dir}/${name}.jar"
445 457
             debug="on"
446 458
       includes="**/*.java" />
447 459

  
448 460
      <jar jarfile="${build.dir}/${name}-junittests.jar"
449
        basedir="${build.metacattest}"
461
        basedir="${build.tests}"
450 462
                includes="**/*.class" />
451 463

  
452 464
      <!-- use the ant "junit" task to run JUnit tests. -->
453
      <junit printsummary="yes" haltonfailure="no" fork="no"
465
      <junit printsummary="yes" haltonfailure="no" fork="yes"
454 466
             haltonerror="no">
467
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>
455 468
        <classpath>
456
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-junittests.jar" />
469
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/${name}-junittests.jar" />
457 470
        </classpath>
458 471

  
459 472
        <formatter type="plain" />
460 473

  
461 474
        <batchtest fork="yes" todir="${build.dir}">
462
          <fileset dir="${build.metacattest}">
475
          <fileset dir="${build.tests}">
463 476
            <include name="**/*.class" />
464 477
          </fileset>
465 478
        </batchtest>
466 479
     </junit>
467 480
   </target>
468 481

  
469
    <target name="runonetest" depends="install">
482
    <target name="runonetest" depends="testprep">
470 483
      <!-- copy and compile the tests into a jar file -->
471 484
      <!--<property name="testtorun" value="SubTreeTest"/> -->
472 485
      <echo>testtorun: ${testtorun}</echo>
473
      <mkdir dir="${build.metacattest}"/>
474
      <javac srcdir="${junittestsdir}"
475
             destdir="${build.metacattest}"
486
      <javac srcdir="${build.tests}"
487
             destdir="${build.tests}"
476 488
             classpath="${cpath}:${build.dir}/${name}.jar"
477 489
       includes="**/*.java" />
478 490

  
479 491
      <jar jarfile="${build.dir}/${name}-junittests.jar"
480
        basedir="${build.metacattest}"
492
        basedir="${build.tests}"
481 493
                includes="**/*.class" />
482 494

  
483 495
      <!-- use the ant "junit" task to run JUnit tests. -->
484
      <junit printsummary="yes" haltonfailure="no" fork="no"
496
      <junit printsummary="yes" haltonfailure="no" fork="yes"
485 497
             haltonerror="no">
498
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>
486 499
        <classpath>
487
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-junittests.jar" />
500
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/${name}-junittests.jar" />
488 501
        </classpath>
489 502

  
490 503
        <formatter type="plain" />
491 504

  
492 505
        <batchtest fork="yes" todir="${build.dir}">
493
          <fileset dir="${build.metacattest}">
494

  
506
          <fileset dir="${build.tests}">
495 507
            <include name="**/${testtorun}.class" />
496 508
          </fileset>
497 509
        </batchtest>

Also available in: Unified diff