Search in sources :

Example 1 with PMDUIComponent

use of org.pentaho.platform.uifoundation.component.xml.PMDUIComponent in project pentaho-platform by pentaho.

the class MetadataIT method __testLookup.

public void __testLookup() {
    startTest();
    // $NON-NLS-1$
    IPentahoUrlFactory urlFactory = new SimpleUrlFactory("");
    PMDUIComponent component = new PMDUIComponent(urlFactory, new ArrayList());
    StandaloneSession session = // $NON-NLS-1$
    new StandaloneSession(Messages.getInstance().getString("BaseTest.DEBUG_JUNIT_SESSION"));
    component.validate(session, null);
    component.setAction(PMDUIComponent.ACTION_LOOKUP);
    // $NON-NLS-1$
    component.setDomainName("test");
    // $NON-NLS-1$
    component.setModelId("Orders");
    // $NON-NLS-1$
    component.setColumnId("BC_CUSTOMERS_CUSTOMERNAME");
    Document doc = component.getXmlContent();
    System.out.println(doc.asXML());
    try {
        // $NON-NLS-1$//$NON-NLS-2$
        OutputStream outputStream = getOutputStream("MetadataTest.testLoadView", ".xml");
        outputStream.write(doc.asXML().getBytes());
    } catch (IOException e) {
    // ignore
    }
    finishTest();
}
Also used : IPentahoUrlFactory(org.pentaho.platform.api.engine.IPentahoUrlFactory) StandaloneSession(org.pentaho.platform.engine.core.system.StandaloneSession) OutputStream(java.io.OutputStream) ArrayList(java.util.ArrayList) SimpleUrlFactory(org.pentaho.platform.util.web.SimpleUrlFactory) PMDUIComponent(org.pentaho.platform.uifoundation.component.xml.PMDUIComponent) IOException(java.io.IOException) Document(org.dom4j.Document)

Example 2 with PMDUIComponent

use of org.pentaho.platform.uifoundation.component.xml.PMDUIComponent in project pentaho-platform by pentaho.

the class MetadataIT method testViewList.

public void testViewList() {
    startTest();
    // $NON-NLS-1$
    IPentahoUrlFactory urlFactory = new SimpleUrlFactory("");
    PMDUIComponent component = new PMDUIComponent(urlFactory, new ArrayList());
    StandaloneSession session = // $NON-NLS-1$
    new StandaloneSession(Messages.getInstance().getString("BaseTest.DEBUG_JUNIT_SESSION"));
    component.validate(session, null);
    component.setAction(PMDUIComponent.ACTION_LIST_MODELS);
    Document doc = component.getXmlContent();
    System.out.println(doc.asXML());
    try {
        // $NON-NLS-1$//$NON-NLS-2$
        OutputStream outputStream = getOutputStream("MetadataTest.testViewList", ".xml");
        outputStream.write(doc.asXML().getBytes());
    } catch (IOException e) {
    // ignore
    }
    finishTest();
}
Also used : IPentahoUrlFactory(org.pentaho.platform.api.engine.IPentahoUrlFactory) StandaloneSession(org.pentaho.platform.engine.core.system.StandaloneSession) OutputStream(java.io.OutputStream) ArrayList(java.util.ArrayList) SimpleUrlFactory(org.pentaho.platform.util.web.SimpleUrlFactory) PMDUIComponent(org.pentaho.platform.uifoundation.component.xml.PMDUIComponent) IOException(java.io.IOException) Document(org.dom4j.Document)

Example 3 with PMDUIComponent

use of org.pentaho.platform.uifoundation.component.xml.PMDUIComponent in project pentaho-platform by pentaho.

the class MetadataIT method __testLoadView.

public void __testLoadView() {
    startTest();
    // $NON-NLS-1$
    IPentahoUrlFactory urlFactory = new SimpleUrlFactory("");
    PMDUIComponent component = new PMDUIComponent(urlFactory, new ArrayList());
    StandaloneSession session = // $NON-NLS-1$
    new StandaloneSession(Messages.getInstance().getString("BaseTest.DEBUG_JUNIT_SESSION"));
    component.validate(session, null);
    component.setAction(PMDUIComponent.ACTION_LOAD_MODEL);
    // $NON-NLS-1$
    component.setDomainName("test");
    // $NON-NLS-1$
    component.setModelId("Orders");
    Document doc = component.getXmlContent();
    System.out.println(doc.asXML());
    try {
        // $NON-NLS-1$//$NON-NLS-2$
        OutputStream outputStream = getOutputStream("MetadataTest.testLoadView", ".xml");
        outputStream.write(doc.asXML().getBytes());
    } catch (IOException e) {
    // ignore
    }
    finishTest();
}
Also used : IPentahoUrlFactory(org.pentaho.platform.api.engine.IPentahoUrlFactory) StandaloneSession(org.pentaho.platform.engine.core.system.StandaloneSession) OutputStream(java.io.OutputStream) ArrayList(java.util.ArrayList) SimpleUrlFactory(org.pentaho.platform.util.web.SimpleUrlFactory) PMDUIComponent(org.pentaho.platform.uifoundation.component.xml.PMDUIComponent) IOException(java.io.IOException) Document(org.dom4j.Document)

Example 4 with PMDUIComponent

use of org.pentaho.platform.uifoundation.component.xml.PMDUIComponent in project data-access by pentaho.

the class DSWDatasourceServiceImpl method listDatasourceNames.

public List<String> listDatasourceNames() throws IOException {
    synchronized (CsvDatasourceServiceImpl.lock) {
        // $NON-NLS-1$
        IPentahoUrlFactory urlFactory = new SimpleUrlFactory("");
        PMDUIComponent component = new PMDUIComponent(urlFactory, new ArrayList());
        component.validate(PentahoSessionHolder.getSession(), null);
        component.setAction(PMDUIComponent.ACTION_LIST_MODELS);
        Document document = component.getXmlContent();
        // $NON-NLS-1$
        List<DefaultElement> modelElements = document.selectNodes("//model_name");
        ArrayList<String> datasourceNames = new ArrayList<String>();
        for (DefaultElement element : modelElements) {
            datasourceNames.add(element.getText());
        }
        return datasourceNames;
    }
}
Also used : IPentahoUrlFactory(org.pentaho.platform.api.engine.IPentahoUrlFactory) DefaultElement(org.dom4j.tree.DefaultElement) ArrayList(java.util.ArrayList) SimpleUrlFactory(org.pentaho.platform.util.web.SimpleUrlFactory) PMDUIComponent(org.pentaho.platform.uifoundation.component.xml.PMDUIComponent) Document(org.dom4j.Document)

Aggregations

ArrayList (java.util.ArrayList)4 Document (org.dom4j.Document)4 IPentahoUrlFactory (org.pentaho.platform.api.engine.IPentahoUrlFactory)4 PMDUIComponent (org.pentaho.platform.uifoundation.component.xml.PMDUIComponent)4 SimpleUrlFactory (org.pentaho.platform.util.web.SimpleUrlFactory)4 IOException (java.io.IOException)3 OutputStream (java.io.OutputStream)3 StandaloneSession (org.pentaho.platform.engine.core.system.StandaloneSession)3 DefaultElement (org.dom4j.tree.DefaultElement)1