use of org.pentaho.platform.uifoundation.component.xml.FilterPanel in project pentaho-platform by pentaho.
the class FilterDefinitionIT method testFilterCreation.
public void testFilterCreation() {
try {
// $NON-NLS-1$
Class.forName("net.sf.cglib.transform.ClassFilter");
} catch (ClassNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
ILogger l = new SimpleLogger(this);
IPentahoSession session = getSession();
setGlobalParams();
this.sessionStartup(session);
Document doc = null;
try {
// $NON-NLS-1$
doc = XmlDom4JHelper.getDocFromFile(new File(SOLUTION_PATH + "/test/filterPanel/test.filterpanel.xml"), null);
} catch (Exception ee) {
ee.printStackTrace();
// $NON-NLS-1$
assertTrue("Failed to get the document from a file.", false);
}
FilterPanel fp = null;
try {
fp = new FilterPanel(session, doc, l);
} catch (FilterPanelException e) {
e.printStackTrace();
// $NON-NLS-1$
assertTrue("Failed to create stream from document.", false);
}
Map parameterProviders = getParameterProviders();
boolean success = false;
List filters = fp.getFilters();
FilterDefinition fd = null;
fd = (FilterDefinition) filters.get(0);
// $NON-NLS-1$
success = fd.populate(parameterProviders, new String[] { "huh" });
// $NON-NLS-1$
assertTrue("Populate on filter session-attribute failed", success);
fd = (FilterDefinition) filters.get(1);
// $NON-NLS-1$
success = fd.populate(parameterProviders, new String[] { "huh" });
// $NON-NLS-1$
assertTrue("Populate on filter global-attribute failed", success);
fd = (FilterDefinition) filters.get(2);
// $NON-NLS-1$
success = fd.populate(parameterProviders, new String[] { "huh" });
// $NON-NLS-1$
assertTrue("Populate on filter static-lov failed", success);
fd = (FilterDefinition) filters.get(3);
// $NON-NLS-1$
success = fd.populate(parameterProviders, new String[] { "huh" });
// $NON-NLS-1$
assertTrue("Populate on filter action sequence failed", success);
}
Aggregations