Examples of ConfigFactory


Examples of org.apache.tuscany.das.rdb.config.ConfigFactory

    /**
     * Set a result descriptor on Command dynamically
     * and later replace it with another invalid one, and check failure
     */
    public void testReplaceResultDescriptors() throws Exception {
      ConfigFactory factory = ConfigFactory.INSTANCE;
      DAS das = DAS.FACTORY.createDAS(getConnection());
        // Read a customer
        Command select = das.createCommand("SELECT ID, LASTNAME, ADDRESS FROM CUSTOMER WHERE CUSTOMER.ID = 1");
       
        List resultDescriptorList = new ArrayList();
        //as long as columnIndex is correct, order in ArrayList does not matter
        ResultDescriptor desc3 = factory.createResultDescriptor();
        desc3.setColumnIndex(3);
        desc3.setColumnName("ADDRESS");
        desc3.setColumnType("commonj.sdo.String");
        desc3.setTableName("CUSTOMER");

        ResultDescriptor desc1 = factory.createResultDescriptor();
        desc1.setColumnIndex(1);
        desc1.setColumnName("ID");
        desc1.setColumnType("commonj.sdo.Int");
        desc1.setTableName("CUSTOMER");
       
        ResultDescriptor desc2 = factory.createResultDescriptor();
        desc2.setColumnIndex(2);
        desc2.setColumnName("LASTNAME");
        desc2.setColumnType("commonj.sdo.String");
        desc2.setTableName("CUSTOMER");
               
        resultDescriptorList.add(desc3);
        resultDescriptorList.add(desc1);
        resultDescriptorList.add(desc2);
       
        select.setResultDescriptors(resultDescriptorList);
        DataObject root = select.executeQuery();
        assertEquals(1, root.getList("CUSTOMER").size());
       
        //Now use invalid one
        resultDescriptorList.clear();
       
        desc3.setColumnIndex(3);
        desc3.setColumnName("ADDRESS");
        desc3.setColumnType("commonj.sdo.Int");//incompatible type
        desc3.setTableName("CUSTOMER");

        desc1.setColumnIndex(1);
        desc1.setColumnName("ID");
        desc1.setColumnType("commonj.sdo.Int");
        desc1.setTableName("CUSTOMER");
       
        desc2 = factory.createResultDescriptor();
        desc2.setColumnIndex(2);
        desc2.setColumnName("LASTNAME");
        desc2.setColumnType("commonj.sdo.String");
        desc2.setTableName("CUSTOMER");
       
View Full Code Here

Examples of org.apache.tuscany.das.rdb.config.ConfigFactory

    /**
     * Set result descriptor on Command dynamically
     * , overriding the one set from static config.
     */
    public void testOverrideResultDescriptorsFromConfig() throws Exception {
      ConfigFactory factory = ConfigFactory.INSTANCE;
      DAS das = DAS.FACTORY.createDAS(getConfig("customerMappingWithResultDescriptor.xml"), getConnection());
        Command select = das.getCommand("testSelectCustomer");
        DataObject root = select.executeQuery();
        List custList = root.getList("CUSTOMER");
        assertEquals("Williams", ((DataObject)custList.get(0)).getString("LASTNAME"));
       
        List resultDescriptorList = new ArrayList();

        ResultDescriptor desc3 = factory.createResultDescriptor();
        desc3.setColumnIndex(3);
        desc3.setColumnName("ADDRESS");
        desc3.setColumnType("commonj.sdo.Int");//incompatible type
        desc3.setTableName("CUSTOMER");

        ResultDescriptor desc1 = factory.createResultDescriptor();
        desc1.setColumnIndex(1);
        desc1.setColumnName("ID");
        desc1.setColumnType("commonj.sdo.Int");
        desc1.setTableName("CUSTOMER");
       
        ResultDescriptor desc2 = factory.createResultDescriptor();
        desc2.setColumnIndex(2);
        desc2.setColumnName("LASTNAME");
        desc2.setColumnType("commonj.sdo.String");
        desc2.setTableName("CUSTOMER");
               
View Full Code Here

Examples of org.apache.tuscany.das.rdb.config.ConfigFactory

     * Set -ve columnIndex in result descriptor on Command dynamically
     * Set will not be sorted and Type mismatch wi (Int and String for ID)
     * will throw exception
     */
    public void testNegativeIndexResultDescriptors() throws Exception {
      ConfigFactory factory = ConfigFactory.INSTANCE;
      DAS das = DAS.FACTORY.createDAS(getConnection());
        // Read a customer
        Command select = das.createCommand("SELECT ID, LASTNAME, ADDRESS FROM CUSTOMER WHERE CUSTOMER.ID = 1");
       
        List resultDescriptorList = new ArrayList();
       
        ResultDescriptor desc3 = factory.createResultDescriptor();
        desc3.setColumnIndex(-3);//invalid
        desc3.setColumnName("ADDRESS");
        desc3.setColumnType("commonj.sdo.String");
        desc3.setTableName("CUSTOMER");

        ResultDescriptor desc1 = factory.createResultDescriptor();
        desc1.setColumnIndex(1);
        desc1.setColumnName("ID");
        desc1.setColumnType("commonj.sdo.Int");
        desc1.setTableName("CUSTOMER");
       
        ResultDescriptor desc2 = factory.createResultDescriptor();
        desc2.setColumnIndex(2);
        desc2.setColumnName("LASTNAME");
        desc2.setColumnType("commonj.sdo.String");
        desc2.setTableName("CUSTOMER");
               
View Full Code Here

Examples of org.apache.tuscany.das.rdb.config.ConfigFactory

   
    /**
     * Set matching columnIndices in result descriptor on Command dynamically
     */
    public void testMatchingIndexResultDescriptor() throws Exception {
      ConfigFactory factory = ConfigFactory.INSTANCE;
      DAS das = DAS.FACTORY.createDAS(getConnection());
        // Read a customer
        Command select = das.createCommand("SELECT ID, LASTNAME, ADDRESS FROM CUSTOMER WHERE CUSTOMER.ID = 1");
       
        List resultDescriptorList = new ArrayList();
       
        ResultDescriptor desc3 = factory.createResultDescriptor();
        desc3.setColumnIndex(1);//two times index is 1
        desc3.setColumnName("ADDRESS");
        desc3.setColumnType("commonj.sdo.String");
        desc3.setTableName("CUSTOMER");

        ResultDescriptor desc1 = factory.createResultDescriptor();
        desc1.setColumnIndex(1);
        desc1.setColumnName("ID");
        desc1.setColumnType("commonj.sdo.Int");
        desc1.setTableName("CUSTOMER");
       
        ResultDescriptor desc2 = factory.createResultDescriptor();
        desc2.setColumnIndex(2);
        desc2.setColumnName("LASTNAME");
        desc2.setColumnType("commonj.sdo.String");
        desc2.setTableName("CUSTOMER");
               
View Full Code Here

Examples of org.apache.tuscany.das.rdb.config.ConfigFactory

          assertTrue(e.getMessage().indexOf("Two columns in Result Descriptor can not have same index")!= -1);
        }
    }   
   
    public void testAddRemoveResultDescriptor() throws Exception {
      ConfigFactory factory = ConfigFactory.INSTANCE;

      ResultDescriptor desc3 = factory.createResultDescriptor();
        desc3.setColumnIndex(3);//two times index is 1
        desc3.setColumnName("ADDRESS");
        desc3.setColumnType("commonj.sdo.String");
        desc3.setTableName("CUSTOMER");

      ResultDescriptor desc1 = factory.createResultDescriptor();
        desc1.setColumnIndex(1);
        desc1.setColumnName("ID");
        desc1.setColumnType("commonj.sdo.Int");
        desc1.setTableName("CUSTOMER");
       
        ResultDescriptor desc2 = factory.createResultDescriptor();
        desc2.setColumnIndex(2);
        desc2.setColumnName("LASTNAME");
        desc2.setColumnType("commonj.sdo.String");
        desc2.setTableName("CUSTOMER");
View Full Code Here

Examples of org.apache.uima.tools.cfe.config.ConfigFactory

     */
  public static ConfigFactory init()
  {
        try
        {
            ConfigFactory theConfigFactory = (ConfigFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.apache.org/uima/tools/cfe/config");
            if (theConfigFactory != null)
            {
                return theConfigFactory;
            }
        }
View Full Code Here

Examples of org.jfree.report.modules.preferences.base.ConfigFactory

    final String systemBaseDirectory =
            JFreeReportBoot.getInstance().getGlobalConfig().getConfigProperty
            (SYSTEM_BASEDIR_CONFIG_KEY, "~/.jfreereport/system");

    final ConfigFactory factory = ConfigFactory.getInstance();
    factory.defineUserStorage(new FileConfigStorage(getStoragePath(userBaseDirectory)));
    factory.defineSystemStorage(new FileConfigStorage(getStoragePath(systemBaseDirectory)));
  }
View Full Code Here

Examples of org.osforce.spring4me.web.widget.config.ConfigFactory

  }

  public String getUrl(String beanName, HttpServletRequest request) throws Exception {
    if(StringUtils.startsWith(beanName, PREFIX_PAGE)) {
      String viewName = getViewName(beanName, request);
      ConfigFactory configFactory = getConfigFactory();
      //
      String theme = (String) request.getAttribute("theme");
      Locale locale = RequestContextUtils.getLocale(request);
      PageConfig pageConfig = configFactory.getPageConfig(viewName, locale);
      request.setAttribute(PageConfig.KEY, pageConfig);
      //
      Boolean popup = request.getAttribute("popup")!=null;
      return getLayout(theme, popup);
    }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.modules.misc.configstore.base.ConfigFactory

   *
   * @throws ModuleInitializeException if an error ocurred.
   */
  public void performInit() throws ModuleInitializeException
  {
    final ConfigFactory factory = ConfigFactory.getInstance();
    factory.defineUserStorage
        (new Java14ConfigStorage(Preferences.userNodeForPackage(MasterReport.class)));
    factory.defineUserStorage
        (new Java14ConfigStorage(Preferences.systemNodeForPackage(MasterReport.class)));
  }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.modules.misc.configstore.base.ConfigFactory

    final String systemBaseDirectory =
        ClassicEngineBoot.getInstance().getGlobalConfig().getConfigProperty
            (FileConfigStoreModuleInitializer.SYSTEM_BASEDIR_CONFIG_KEY, "~/.jfreereport/system"); //$NON-NLS-1$

    final ConfigFactory factory = ConfigFactory.getInstance();
    factory.defineUserStorage(new FileConfigStorage(getStoragePath(userBaseDirectory)));
    factory.defineSystemStorage(new FileConfigStorage(getStoragePath(systemBaseDirectory)));
  }
View Full Code Here
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.