Package com.foreach.across.core.installers

Examples of com.foreach.across.core.installers.InstallerActionResolver


        InstallerAction.SKIP,
        InstallerAction.FORCE,
        InstallerAction.REGISTER } ) {
      settings.setDefaultAction( defaultAction );

      InstallerActionResolver priorityResolver = mock( InstallerActionResolver.class );
      settings.setPriorityActionResolver( priorityResolver );

      // Set actions for groups
      settings.setActionForInstallerGroups( InstallerAction.EXECUTE, "executeOne", "executeTwo" );
      settings.setActionForInstallerGroups( InstallerAction.SKIP, "skipOne", "skipTwo" );
      settings.setActionForInstallerGroups( InstallerAction.FORCE, "force" );
      settings.setActionForInstallerGroups( InstallerAction.REGISTER, Arrays.asList( "registerOne",
                                                                                     "registerTwo" ) );
      settings.setActionForInstallerGroups( InstallerAction.DISABLED, "disabled" );

      // Set action for specific installer
      settings.setActionForInstallers( InstallerAction.FORCE, "java.lang.String" );

      // Fetch actions for known installers
      Object groupRule = new Object();
      String installerRule = "installerRule";

      // In these cases the priority resolver should decide
      when( priorityResolver.resolve( "skipOne", groupRule ) ).thenReturn( InstallerAction.REGISTER );
      when( priorityResolver.resolve( "registerOne", groupRule ) ).thenReturn( InstallerAction.SKIP );
      when( priorityResolver.resolve( "disabled", installerRule ) ).thenReturn( InstallerAction.EXECUTE );

      // Priority resolver action
      assertEquals( InstallerAction.REGISTER, settings.shouldRun( "skipOne", groupRule ) );
      assertEquals( InstallerAction.SKIP, settings.shouldRun( "registerOne", groupRule ) );
      assertEquals( InstallerAction.EXECUTE, settings.shouldRun( "disabled", installerRule ) );
View Full Code Here


  @Test
  public void defaultDisabledTrumpsAllOtherSettings() {
    settings.setDefaultAction( InstallerAction.DISABLED );

    InstallerActionResolver priorityResolver = mock( InstallerActionResolver.class );
    settings.setPriorityActionResolver( priorityResolver );

    // Set actions for groups
    settings.setActionForInstallerGroups( InstallerAction.EXECUTE, "executeOne", "executeTwo" );
    settings.setActionForInstallerGroups( InstallerAction.SKIP, "skipOne", "skipTwo" );
    settings.setActionForInstallerGroups( InstallerAction.FORCE, "force" );
    settings.setActionForInstallerGroups( InstallerAction.REGISTER, Arrays.asList( "registerOne",
                                                                                   "registerTwo" ) );
    settings.setActionForInstallerGroups( InstallerAction.DISABLED, "disabled" );

    // Set action for specific installer
    settings.setActionForInstallers( InstallerAction.FORCE, "java.lang.String" );

    // Fetch actions for known installers
    Object groupRule = new Object();
    String installerRule = "installerRule";

    // In these cases the priority resolver should decide
    when( priorityResolver.resolve( "skipOne", groupRule ) ).thenReturn( InstallerAction.REGISTER );
    when( priorityResolver.resolve( "registerOne", groupRule ) ).thenReturn( InstallerAction.SKIP );
    when( priorityResolver.resolve( "disabled", installerRule ) ).thenReturn( InstallerAction.EXECUTE );

    // No matter it should always return DISABLED
    assertEquals( InstallerAction.DISABLED, settings.shouldRun( "skipOne", groupRule ) );
    assertEquals( InstallerAction.DISABLED, settings.shouldRun( "registerOne", groupRule ) );
    assertEquals( InstallerAction.DISABLED, settings.shouldRun( "disabled", installerRule ) );
View Full Code Here

TOP

Related Classes of com.foreach.across.core.installers.InstallerActionResolver

Copyright © 2018 www.massapicom. 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.