Changeset 2184


Ignore:
Timestamp:
08/30/12 15:42:11 (12 years ago)
Author:
olhsha
Message:

a bit of refactoring

Location:
ComponentRegistry/branches/ComponentRegistry-1.13.0-olha/ComponentRegistry/src/test
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • ComponentRegistry/branches/ComponentRegistry-1.13.0-olha/ComponentRegistry/src/test/java/clarin/cmdi/componentregistry/CMDComponentTypeWrapperTest.java

    r2174 r2184  
    214214   
    215215      // adds dummy filenames to the content of largeProfile.XML 
    216       private  CMDComponentSpec makeTestSpecFromLargeProfile() throws IOException, JAXBException {
    217          
    218           String largeprofilestring = RegistryTestHelper.getLargeProfileContent(); // reading from the file
     216      private  CMDComponentSpec makeTestFromFile(String filename) throws IOException, JAXBException {
     217         
     218          String largeprofilestring = RegistryTestHelper.getProfileContentFromFile(filename);
    219219          CMDComponentSpec compspec=RegistryTestHelper.getComponentFromString(largeprofilestring); // calling unmarchaller
    220220         
     
    251251     
    252252      // creating the profile with filenames filled by "Dummy" and writing it into the file
    253       public void writeDummiedXML() throws IOException, JAXBException{
    254          
    255           CMDComponentSpec compspec=makeTestSpecFromLargeProfile();
    256           writeSpecToFile(compspec, "src/test/resources/xml/largeProfileDummyFilenames.xml");
    257          
     253      public void writeDummiedXML(String filenamein, String filenameout) throws IOException, JAXBException{
     254         
     255          CMDComponentSpec compspec=makeTestFromFile(filenamein);
     256          writeSpecToFile(compspec, filenameout);
    258257      }
    259258       
     
    265264      @Test
    266265     
    267       public void setFileNamesToNullTestFile() throws IOException, JAXBException {
    268          
    269          writeDummiedXML();
     266      public void setFileNamesToNullTestFile1() throws IOException, JAXBException {
     267         
     268         writeDummiedXML("/xml/largeProfile.xml", "src/test/resources/xml/largeProfileDummyFilenames.xml");
     269         
    270270         
    271271         String dummiedcontent = RegistryTestHelper.getProfileContentFromFile("/xml/largeProfileDummyFilenames.xml");
     
    282282         
    283283      }
    284      
    285      
    286      
    287     }
    288    
    289    
    290    
    291    
    292 
     284      ////////////////////////////////////
     285     
     286      @Test
     287     
     288      public void setFileNamesToNullTestFile2() throws IOException, JAXBException {
     289         
     290         writeDummiedXML("/xml/A.xml", "src/test/resources/xml/ADummyFilenames.xml");
     291         
     292         
     293         String  dummiedcontent= RegistryTestHelper.getProfileContentFromFile("/xml/ADummyFilenames.xml");
     294         assertTrue(dummiedcontent != null);
     295         CMDComponentSpec newcompspec  = RegistryTestHelper.getComponentFromString(dummiedcontent); // calling unmarchaller
     296         assertTrue(newcompspec != null);
     297         
     298         CMDComponentTypeWrapper wrapper = new CMDComponentTypeWrapper(newcompspec);
     299         
     300         wrapper.setFileNamesToNull();
     301         
     302         checkNullnessOfFilenamesInListOfComponents(newcompspec.getCMDComponent());
     303         writeSpecToFile(newcompspec, "src/test/resources/xml/AUndummied.xml");
     304         
     305         
     306      }
     307     
     308    }
     309   
     310   
     311   
     312   
     313
  • ComponentRegistry/branches/ComponentRegistry-1.13.0-olha/ComponentRegistry/src/test/resources/xml/Component1.xml

    r2174 r2184  
    11<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    22<componentDescription xmlns:ns2="http://www.w3.org/1999/xlink">
    3     <id>clarin.eu:cr1:c_1346252981279</id>
     3    <id>clarin.eu:cr1:c_1346315576463</id>
    44    <description>description1dum</description>
    55    <name>name1dum</name>
    6     <registrationDate>2012-08-29T15:12:50+00:00</registrationDate>
     6    <registrationDate>2012-08-30T08:36:02+00:00</registrationDate>
    77    <creatorName>God</creatorName>
    88    <userId>uid1dum</userId>
  • ComponentRegistry/branches/ComponentRegistry-1.13.0-olha/ComponentRegistry/src/test/resources/xml/Component2.xml

    r2174 r2184  
    11<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    22<componentDescription xmlns:ns2="http://www.w3.org/1999/xlink">
    3     <id>clarin.eu:cr1:c_1346252981280</id>
     3    <id>clarin.eu:cr1:c_1346315576464</id>
    44    <description>description2dum</description>
    55    <name>name2dum</name>
    6     <registrationDate>2012-08-29T15:12:50+00:00</registrationDate>
     6    <registrationDate>2012-08-30T08:36:02+00:00</registrationDate>
    77    <creatorName>Allah</creatorName>
    88    <userId>uid2dum</userId>
  • ComponentRegistry/branches/ComponentRegistry-1.13.0-olha/ComponentRegistry/src/test/resources/xml/rssTest.xml

    r2174 r2184  
    1 ,<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
     1<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    22<rss>
    33    <channel>
     
    77            <link>href1dum</link>
    88            <author>God</author>
    9             <pubDate>2012-08-29T15:05:08+00:00</pubDate>
     9            <pubDate>2012-08-29T15:12:50+00:00</pubDate>
    1010        </item>
    1111        <item>
     
    1414            <link>href2dum</link>
    1515            <author>Allah</author>
    16             <pubDate>2012-08-29T15:05:08+00:00</pubDate>
     16            <pubDate>2012-08-29T15:12:50+00:00</pubDate>
    1717        </item>
    1818    </channel>
Note: See TracChangeset for help on using the changeset viewer.