// BridgeDb,
// An abstraction layer for identifier mapping services, both local and online.
//
// Copyright 2006-2009  BridgeDb developers
// Copyright 2012-2013  Christian Y. A. Brenninkmeijer
// Copyright 2012-2013  OpenPhacts
//
// 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.
//
package org.bridgedb.rdf;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
import static org.hamcrest.Matchers.hasItem;
import static org.junit.Assert.assertEquals;

import java.io.File;
import java.util.SortedSet;

import org.bridgedb.bio.DataSourceTxt;
import org.bridgedb.utils.Reporter;
import org.junit.Ignore;
import org.junit.Test;

/**
 *
 * @author Christian
 */
public class BridgeDBRdfHandlerTest {
    
   /**
     * Test of init method, of class BridgeDBRdfHandler.
     */
	@Ignore("Sensitive to test order")
    @Test
    public void testInit() throws Exception {
        Reporter.println("init");
        DataSourceTxt.init();
        BridgeDBRdfHandler.init();
        UriPattern.registerUriPatterns();
         
        SortedSet<UriPattern> result = UriPattern.byCodeAndType("M", UriPatternType.mainUrlPattern);
        UriPattern expected = UriPattern.byPattern("http://www.informatics.jax.org/marker/$id");
        assertThat(result, hasItem(expected));
        assertEquals(1, result.size());
        
        result = UriPattern.byCodeAndType("M", UriPatternType.identifiersOrgPatternSimple);
        expected = UriPattern.byPattern("http://identifiers.org/mgd/$id");
        assertThat(result, hasItem(expected));
        assertEquals(1, result.size());
        
        result = UriPattern.byCodeAndType("M", UriPatternType.codeMapperPattern);
        expected = UriPattern.byPattern("http://purl.uniprot.org/mgi/$id");
        assertThat(result, hasItem(expected));
        assertThat(result.size(), greaterThanOrEqualTo(1));
        
        File file = File.createTempFile("GeneratedDataSource", ".ttl");
        Reporter.println("writing to " + file.getAbsolutePath());
        BridgeDBRdfHandler.writeRdfToFile(file);
        
        Reporter.println("Reading back in " + file.getAbsolutePath());
        BridgeDBRdfHandler.parseRdfFile(file);
    }

}

@@ -1,10 +1,13 @@
 /
-/
+*%0A *
  BridgeD
@@ -9,18 +9,18 @@
 idgeDb,%0A
-//
+ *
  An abst
@@ -89,21 +89,18 @@
 online.%0A
-//%0A//
+ *
  Copyrig
@@ -105,14 +105,20 @@
 ight
+ (c)
  2006
--
+ - 
 2009
@@ -128,17 +128,17 @@
 ridgeDb 
-d
+D
 eveloper
@@ -139,18 +139,18 @@
 elopers%0A
-//
+ *
  Copyrig
@@ -143,32 +143,36 @@
 ers%0A * Copyright
+ (c)
  2012-2013  Chri
@@ -166,17 +166,16 @@
 12-2013 
- 
 Christia
@@ -197,14 +197,14 @@
 kmei
-jer%0A//
+ier%0A *
  Cop
@@ -213,20 +213,25 @@
 ight
+ (c)
  2012
--
+ - 
 2013 
- 
 Open
@@ -237,21 +237,21 @@
 nPhacts%0A
-//%0A//
+ *%0A *
  License
@@ -307,18 +307,18 @@
 ense%22);%0A
-//
+ *
  you may
@@ -375,18 +375,18 @@
 icense.%0A
-//
+ *
  You may
@@ -417,22 +417,16 @@
 cense at
-%0A//%0A//
  http://
@@ -465,13 +465,13 @@
 2.0%0A
-//%0A//
+ *%0A *
  Unl
@@ -534,19 +534,16 @@
 software
-%0A//
  distrib
@@ -601,18 +601,18 @@
  BASIS,%0A
-//
+ *
  WITHOUT
@@ -677,18 +677,18 @@
 mplied.%0A
-//
+ *
  See the
@@ -747,19 +747,16 @@
 ions and
-%0A//
  limitat
@@ -783,11 +783,13 @@
 se.%0A
-/
+ *
 /%0A
+%0A
 pack
@@ -991,22 +991,38 @@
 g.junit.
+jupiter.api.
 Assert
+ions
 .assertE
@@ -1171,22 +1171,29 @@
 g.junit.
-Ignore
+jupiter.api.*
 ;%0Aimport
@@ -1203,20 +1203,36 @@
 g.junit.
-Test
+jupiter.api.Disabled
 ;%0A%0A/**%0A 
@@ -1379,14 +1379,16 @@
 /%0A%09@
-Ignore
+Disabled
 (%22Se

Update BridgeDBRdfHandlerTest.java