Package com.ipc.oce.junit

Source Code of com.ipc.oce.junit.BasicTest

/**
*
*/
package com.ipc.oce.junit;

import java.io.File;
import java.util.Properties;

import org.jinterop.dcom.common.JIException;
import org.junit.AfterClass;
import org.junit.BeforeClass;

import com.ipc.oce.ApplicationDriver;
import com.ipc.oce.OCApp;
import com.ipc.oce.PropertiesReader;
import com.ipc.oce.objects.OCDocumentManager;
import com.ipc.oce.objects.OCDocumentObject;
import com.ipc.oce.objects.OCDocumentSelection;

/**
* @author Konovalov
*
*/
public abstract class BasicTest {
  protected static Properties configuration = null;
  protected static OCApp app = null;
  protected int sessionNum = -1;
 
  @BeforeClass
  public static void setUpBeforeClass() throws Exception {
    PropertiesReader pr = new PropertiesReader(
        new File(
            "C:\\Developer\\Projects\\hel_default\\OCExportWeb\\WebContent\\WEB-INF\\oce.properties"));

    configuration = pr.getPropertiesForInstance("buh");

    // [step 2] load application driver (or use you can use default)
    ApplicationDriver driver = ApplicationDriver
        .loadDriver((String) configuration
            .get(PropertiesReader.OCE_CFG_DRIVER));
    driver.setAutoRegistration(true);
    // step 3 create OCApp instance and set driver
    app = OCApp.getNewInstance();
    app.setApplicationDriver(driver);
    app.connect(configuration);
    System.out.println("InfoBaseConnectionNumber: " + app.getInfoBaseConnectionNumber());
  }

  /**
   * @throws java.lang.Exception
   */
  @AfterClass
  public static void tearDownAfterClass() throws Exception {
    app.exit();
  }
 
  public OCDocumentObject getRandomDocument(String docName) throws JIException {
    OCDocumentManager manager = app.getDocumentManager(docName);
    OCDocumentSelection selection = manager.select();
    selection.next();
    return selection.getObject();
  }
}
TOP

Related Classes of com.ipc.oce.junit.BasicTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.