package example.rdb2rdf;

import java.io.File;

import org.junit.BeforeClass;
import org.junit.Test;

import com.obidea.semantika.app.ApplicationFactory;
import com.obidea.semantika.app.ApplicationManager;
import com.obidea.semantika.exception.ConfigurationException;
import com.obidea.semantika.materializer.IMaterializerEngine;

public class ExportTest
{
   private static final String CONFIGURATION_PATH = "example/rdb2rdf/configuration.xml"; //$NON-NLS-1$

   private static ApplicationManager mAppManager;

   @BeforeClass
   public static void setUp() throws ConfigurationException
   {
      mAppManager = new ApplicationFactory().configure(CONFIGURATION_PATH).createApplicationManager();
   }

   @Test
   public void testExportNTriples() throws Exception
   {
      // Get the materializer engine from the manager and set the output format to NTriples.
      IMaterializerEngine materializer = mAppManager.createMaterializerEngine().useNTriples();
      
      // Specify the output location.
      File fout = File.createTempFile("output", ".n3", new File("/tmp"));
      
      // Flag the start and end of the export process.
      materializer.start();
      materializer.materialize(fout);
      materializer.stop();
   }

   @Test
   public void testExportTurtle() throws Exception
   {
      // Get the materializer engine from the manager and set the output format to Turtle.
      IMaterializerEngine materializer = mAppManager.createMaterializerEngine().useTurtle();
      
      // Specify the output location.
      File fout = File.createTempFile("output", ".ttl", new File("/tmp"));

      // Flag the start and end of the export process.
      materializer.start();
      materializer.materialize(fout);
      materializer.stop();
   }

   @Test
   public void testExportXml() throws Exception
   {
      // Get the materializer engine from the manager and set the output format to RDF/XML.
      IMaterializerEngine materializer = mAppManager.createMaterializerEngine().useRdfXml();
      
      // Specify the output location.
      File fout = File.createTempFile("output", ".xml", new File("/tmp"));

      // Flag the start and end of the export process.
      materializer.start();
      materializer.materialize(fout);
      materializer.stop();
   }

   @Test
   public void testExportJson() throws Exception
   {
      // Get the materializer engine from the manager and set the format to RDF/JSON.
      IMaterializerEngine materializer = mAppManager.createMaterializerEngine().useRdfJson();
      
      // Specify the output location.
      File fout = File.createTempFile("output", ".jsonld", new File("/tmp"));

      // Flag the start and end of the export process.
      materializer.start();
      materializer.materialize(fout);
      materializer.stop();
   }
}

@@ -1017,63 +1017,44 @@
 t = 
-File.createTempFile(%22output%22, %22.n3%22, new File(%22/tmp%22));
+new File(%22output.n3%22); //$NON-NLS-1$
 %0A   
@@ -1519,39 +1519,28 @@
 File fout = 
-File.createTemp
+new 
 File(%22output
@@ -1543,37 +1543,29 @@
 tput
-%22, %22
 .ttl%22
-, new File(%22/tmp%22));
+); //$NON-NLS-1$
 %0A%0A  
@@ -2022,39 +2022,28 @@
 File fout = 
-File.createTemp
+new 
 File(%22output
@@ -2046,37 +2046,29 @@
 tput
-%22, %22
 .xml%22
-, new File(%22/tmp%22));
+); //$NON-NLS-1$
 %0A%0A  
@@ -2529,23 +2529,12 @@
 t = 
-File.createTemp
+new 
 File
@@ -2545,40 +2545,30 @@
 tput
-%22, %22
 .json
-ld%22, new File(%22/tmp%22));
+%22); //$NON-NLS-1$
 %0A%0A  

Change the output location.