Examples of ConfigHelper


Examples of helper.ConfigHelper

    public static void dockStylist(XMultiServiceFactory xMSF)
    {
        // prepare Window-Settings
        try
        {
            ConfigHelper aConfig = new ConfigHelper(xMSF,
                    "org.openoffice.Office.Views", false);

            // Is node "5539" (slot-id for navigator) available? If not, insert it
            XNameReplace x5539 = aConfig.getOrInsertGroup("Windows", "5539");

            aConfig.updateGroupProperty(
                    "Windows", "5539", "WindowState", "952,180,244,349;1;0,0,0,0;");

            aConfig.insertOrUpdateExtensibleGroupProperty(
                    "Windows", "5539", "UserData", "Data", "V2,V,0,AL:(5,16,0/0/244/349,244;610)");

            // Is node "SplitWindow2" available? If not, instert it.
            aConfig.getOrInsertGroup("Windows", "SplitWindow2");

            aConfig.insertOrUpdateExtensibleGroupProperty(
                    "Windows", "SplitWindow2", "UserData", "UserItem", "V1,2,1,0,5539");

            aConfig.flush();
            aConfig = null;

        }
        catch (com.sun.star.uno.Exception e)
        {
View Full Code Here

Examples of org.apache.ambari.server.state.ConfigHelper

  @Test
  public void testUpdateConfigGroup() throws Exception {
    AmbariManagementController managementController = createMock(AmbariManagementController.class);
    RequestStatusResponse response = createNiceMock(RequestStatusResponse.class);
    ConfigHelper configHelper = createNiceMock(ConfigHelper.class);
    Clusters clusters = createNiceMock(Clusters.class);
    Cluster cluster = createNiceMock(Cluster.class);
    Host h1 = createNiceMock(Host.class);
    Host h2 = createNiceMock(Host.class);
    final ConfigGroup configGroup = createNiceMock(ConfigGroup.class);
    ConfigGroupResponse configGroupResponse = createNiceMock
      (ConfigGroupResponse.class);

    expect(managementController.getClusters()).andReturn(clusters).anyTimes();
    expect(managementController.getAuthName()).andReturn("admin").anyTimes();
    expect(clusters.getCluster("Cluster100")).andReturn(cluster).anyTimes();
    expect(clusters.getHost("h1")).andReturn(h1);
    expect(clusters.getHost("h2")).andReturn(h2);

    expect(configGroup.getName()).andReturn("test-1").anyTimes();
    expect(configGroup.getId()).andReturn(25L).anyTimes();
    expect(configGroup.getTag()).andReturn("tag-1").anyTimes();

    expect(configGroup.convertToResponse()).andReturn(configGroupResponse).anyTimes();
    expect(configGroupResponse.getClusterName()).andReturn("Cluster100").anyTimes();
    expect(configGroupResponse.getId()).andReturn(25L).anyTimes();

    expect(cluster.getConfigGroups()).andStubAnswer(new IAnswer<Map<Long, ConfigGroup>>() {
      @Override
      public Map<Long, ConfigGroup> answer() throws Throwable {
        Map<Long, ConfigGroup> configGroupMap = new HashMap<Long, ConfigGroup>();
        configGroupMap.put(configGroup.getId(), configGroup);
        return configGroupMap;
      }
    });
    expect(managementController.getConfigHelper()).andReturn(configHelper).once();
    configHelper.invalidateStaleConfigsCache();
    expectLastCall().once();

    replay(managementController, clusters, cluster,
      configGroup, response, configGroupResponse, configHelper);
View Full Code Here

Examples of org.apache.ambari.server.state.ConfigHelper

        Long clusterId = hostRoleCommandDAO.findByPK(
            executionCommand.getTaskId()).getStage().getClusterId();

        try {
          Cluster cluster = clusters.getClusterById(clusterId);
          ConfigHelper configHelper = injector.getInstance(ConfigHelper.class);

          Map<String, Map<String, String>> configProperties = configHelper
            .getEffectiveConfigProperties(cluster,
              executionCommand.getConfigurationTags());

          // Apply the configurations saved with the Execution Cmd on top of
          // derived configs - This will take care of all the hacks
          for (Map.Entry<String, Map<String, String>> entry : configProperties.entrySet()) {
            String type = entry.getKey();
            Map<String, String> allLevelMergedConfig = entry.getValue();

            if (executionCommand.getConfigurations().containsKey(type)) {
              Map<String, String> mergedConfig =
                configHelper.getMergedConfig(allLevelMergedConfig,
                  executionCommand.getConfigurations().get(type));
              executionCommand.getConfigurations().get(type).clear();
              executionCommand.getConfigurations().get(type).putAll(mergedConfig);

            } else {
View Full Code Here

Examples of org.apache.tuscany.das.rdb.ConfigHelper

        // Change a field to mark the instance 'dirty'
        book.setInt("QUANTITY", 2);

        // Flush the change
        // Create config programmatically
        ConfigHelper helper = new ConfigHelper();
        helper.addPrimaryKey("BOOK.BOOK_ID");

        ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(helper.getConfig());
        apply.setConnection(getConnection());

        apply.execute(root);

        // Verify
View Full Code Here

Examples of org.apache.tuscany.das.rdb.ConfigHelper

        String statement = "SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID WHERE CUSTOMER.ID = 1";

        // Read some customers and related orders
        // Create relationship config programmatically
        ConfigHelper helper = new ConfigHelper();
        helper.addRelationship("CUSTOMER.ID", "ANORDER.CUSTOMER_ID");
       
        Command select = Command.FACTORY.createCommand(statement, helper.getConfig());
        select.setConnection(getConnection());

        DataObject root = select.executeQuery();
        DataObject customer = root.getDataObject("CUSTOMER[1]");

View Full Code Here

Examples of org.apache.tuscany.das.rdb.ConfigHelper

    public void test_4() throws Exception {

        String statement = "SELECT * FROM BOOK WHERE BOOK.BOOK_ID = :ID";

        // Create Table config programmatically
        ConfigHelper helper = new ConfigHelper();
        helper.addTable("BOOK", "Book");
        helper.addPrimaryKey("Book.BOOK_ID");
       
        Command select = Command.FACTORY.createCommand(statement, helper.getConfig());
        select.setConnection(getConnection());
        select.setParameterValue("ID", new Integer(1));

        DataObject root = select.executeQuery();
       
        DataObject newBook = root.createDataObject("Book");
        newBook.setString("NAME", "Ant Colonies of the Old World");
        newBook.setInt("BOOK_ID", 1001);
        root.getList("Book").add(newBook);
              
        ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(helper.getConfig());
        apply.setConnection(getConnection());
        apply.execute(root);
       
        //Verify
        select.setParameterValue("ID", new Integer(1001));
View Full Code Here

Examples of org.apache.tuscany.das.rdb.ConfigHelper

    public void test_4() throws Exception {

        String statement = "SELECT * FROM BOOK WHERE BOOK.BOOK_ID = :ID";

        // Create Table config programmatically
        ConfigHelper helper = new ConfigHelper();
        helper.addTable("BOOK", "Book");
        helper.addPrimaryKey("BOOK.BOOK_ID");
       
        Command select = Command.FACTORY.createCommand(statement, helper.getConfig());
        select.setConnection(getConnection());
        select.setParameterValue("ID", new Integer(1));

        DataObject root = select.executeQuery();
       
        DataObject newBook = root.createDataObject("Book");
        newBook.setString("NAME", "Ant Colonies of the Old World");
        newBook.setInt("BOOK_ID", 1001);
        root.getList("Book").add(newBook);
              
        ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(helper.getConfig());
        apply.setConnection(getConnection());
        apply.execute(root);
       
        //Verify
        select.setParameterValue("ID", new Integer(1001));
View Full Code Here

Examples of org.apache.tuscany.das.rdb.ConfigHelper

     * the method for handling parameters was changed.
     */
    public void testReadModifyApply() throws Exception {

        // Provide updatecommand programmatically via config
        ConfigHelper helper = new ConfigHelper();
        Table customerTable = helper.addTable("CUSTOMER", "CUSTOMER");
        helper.addUpdateStatement(customerTable, "update CUSTOMER set LASTNAME = ? where ID = ?", "LASTNAME ID");

        DAS das = DAS.FACTORY.createDAS(helper.getConfig(), getConnection());

        //Read customer 1
        Command select = das.createCommand("Select * from CUSTOMER where ID = 1");
        DataObject root = select.executeQuery();

View Full Code Here

Examples of org.apache.tuscany.das.rdb.ConfigHelper

     * Ensure that an implied relationship is not created when a defined one already exists
     *
     * @throws Exception
     */
    public void testRelationshipAlreadyDefined() throws Exception {
        ConfigHelper helper = new ConfigHelper();
        Relationship r = helper.addRelationship("CUSTOMER.ID", "ANORDER.CUSTOMER_ID");
        r.setName("definedRelationship");

        DAS das = DAS.FACTORY.createDAS(helper.getConfig(), getConnection());
        Command select = das.createCommand("select * from CUSTOMER left join ANORDER "
                + "ON CUSTOMER.ID = ANORDER.CUSTOMER_ID");

        DataObject root = select.executeQuery();
        DataObject cust = root.getDataObject("CUSTOMER[1]");
View Full Code Here

Examples of org.apache.tuscany.das.rdb.ConfigHelper

     * Read and modify a customer. Provide needed Create/Update/Delete statements programatically
     */
    public void testReadModifyApply() throws Exception {

        // Provide updatecommand programmatically via config
        ConfigHelper helper = new ConfigHelper();
        Table customerTable = helper.addTable("CUSTOMER", "CUSTOMER");
        helper.addUpdateStatement(customerTable, "update CUSTOMER set LASTNAME = ?, ADDRESS = ? "
                + "where ID = ?", "LASTNAME ADDRESS ID");

        DAS das = DAS.FACTORY.createDAS(helper.getConfig(), getConnection());
        // Read customer 1
        Command select = das.createCommand("Select * from CUSTOMER where ID = 1");
        DataObject root = select.executeQuery();

        DataObject customer = (DataObject) root.get("CUSTOMER[1]");
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.