Project

General

Profile

« Previous | Next » 

Revision 9147

Added by Jing Tao over 9 years ago

Add the junit test method for listViews.

View differences:

test/edu/ucsb/nceas/metacat/dataone/MNodeServiceTest.java
29 29

  
30 30

  
31 31
import edu.ucsb.nceas.metacat.dataone.MNodeService;
32
import edu.ucsb.nceas.metacat.properties.SkinPropertyService;
33
import edu.ucsb.nceas.metacat.service.ServiceService;
34
import edu.ucsb.nceas.utilities.IOUtil;
32 35
import gov.loc.repository.bagit.Bag;
33 36
import gov.loc.repository.bagit.BagFactory;
34 37
import gov.loc.repository.bagit.BagFile;
......
41 44
import java.io.IOException;
42 45
import java.io.InputStream;
43 46
import java.io.UnsupportedEncodingException;
47
import java.net.URL;
44 48
import java.text.SimpleDateFormat;
45 49
import java.util.ArrayList;
46 50
import java.util.Calendar;
......
49 53
import java.util.Iterator;
50 54
import java.util.List;
51 55
import java.util.Map;
56
import java.util.Vector;
52 57

  
53 58
import junit.framework.Test;
54 59
import junit.framework.TestSuite;
......
78 83
import org.dataone.service.types.v1.Identifier;
79 84
import org.dataone.service.types.v2.Log;
80 85
import org.dataone.service.types.v2.Node;
86
import org.dataone.service.types.v2.OptionList;
81 87
import org.dataone.service.types.v1.NodeReference;
82 88
import org.dataone.service.types.v1.ObjectFormatIdentifier;
83 89
import org.dataone.service.types.v1.ObjectList;
......
163 169
    suite.addTest(new MNodeServiceTest("testReadDeletedObject"));
164 170
    suite.addTest(new MNodeServiceTest("testCreateAndUpdateXMLWithUnmatchingEncoding"));
165 171
    suite.addTest(new MNodeServiceTest("testGetSID"));
172
    suite.addTest(new MNodeServiceTest("testListViews"));
173
    
166 174
    return suite;
167 175
    
168 176
  }
......
1885 1893
        
1886 1894
        
1887 1895
    }
1896
    
1897
    /**
1898
     * Test the listView methods.
1899
     * @throws Excpetion
1900
     */
1901
    public void testListViews() throws Exception {
1902
        Session session = null;
1903
        OptionList list = MNodeService.getInstance(request).listViews(session);
1904
        assertTrue(list.sizeOptionList() >0);
1905
        List<String> names = list.getOptionList();
1906
        for(String name : names) {
1907
            System.out.println("It has the view named "+name);
1908
        }
1909
    }
1910
    
1888 1911
}
test/edu/ucsb/nceas/metacat/dataone/CNodeServiceTest.java
65 65
import org.dataone.service.types.v2.NodeList;
66 66
import org.dataone.service.types.v2.ObjectFormat;
67 67
import org.dataone.service.types.v2.ObjectFormatList;
68
import org.dataone.service.types.v2.OptionList;
68 69
import org.dataone.service.types.v2.SystemMetadata;
69 70
import org.dataone.service.util.Constants;
70 71

  
71 72
import edu.ucsb.nceas.metacat.dataone.CNodeService;
73
import edu.ucsb.nceas.metacat.dataone.MNodeService;
72 74

  
73 75
/**
74 76
 * A JUnit test for testing the dataone CNCore implementation
......
110 112
		suite.addTest(new CNodeServiceTest("testSetOwner"));
111 113
		suite.addTest(new CNodeServiceTest("readDeletedObject"));
112 114
		suite.addTest(new CNodeServiceTest("testGetSID"));
115
		suite.addTest(new CNodeServiceTest("testListViews"));
113 116
	
114 117
		return suite;
115 118
	}
......
1133 1136
          e.printStackTrace();
1134 1137
          fail(e.getMessage());
1135 1138
      }
1136
      
1137
      
1138
      
1139
      
1140 1139
  }
1141 1140
 
1141
  /**
1142
   * Test the listView methods.
1143
   * @throws Excpetion
1144
   */
1145
  public void testListViews() throws Exception {
1146
      OptionList list = CNodeService.getInstance(request).listViews();
1147
      assertTrue(list.sizeOptionList() >0);
1148
      List<String> names = list.getOptionList();
1149
      for(String name : names) {
1150
          System.out.println("It has the view named "+name);
1151
      }
1152
  }
1142 1153
}

Also available in: Unified diff