Examples of PolicyException


Examples of org.apache.cxf.ws.policy.PolicyException

                    ai.setNotAsserted(reason);
                }
            }
        }
        if (!assertion.isOptional()) {
            throw new PolicyException(new Message(reason, LOG));
        }
    }
View Full Code Here

Examples of org.apache.cxf.ws.policy.PolicyException

      
        try {
            greeter.sayHi();
            fail("Did not receive expected PolicyException.");
        } catch (WebServiceException wex) {
            PolicyException ex = (PolicyException)wex.getCause();
            assertEquals("INCOMPATIBLE_HTTPCLIENTPOLICY_ASSERTIONS", ex.getCode());
        }

        // greetMeOneWay - no message or operation policies

        greeter.greetMeOneWay("CXF");

        // greetMe - operation policy specifies receive timeout and should cause every
        // other invocation to fail

        assertEquals("CXF", greeter.greetMe("cxf"));

        try {
            greeter.greetMe("cxf");
            fail("Didn't get the exception");
        } catch (Exception ex) {
            //ex.printStackTrace();
            assertTrue(ex.getCause().getClass().getName(), ex.getCause() instanceof SocketTimeoutException);
        }
    
        // pingMe - policy attached to binding operation fault should have no effect

        try {
            greeter.pingMe();
            fail("Expected PingMeFault not thrown.");
        } catch (PingMeFault ex) {
            assertEquals(2, (int)ex.getFaultInfo().getMajor());
            assertEquals(1, (int)ex.getFaultInfo().getMinor());
        }

    }
View Full Code Here

Examples of org.apache.cxf.ws.policy.PolicyException

        if (null != compatible && null != confPolicy) {
            if (PolicyUtils.compatible(compatible, confPolicy)) {
                compatible = intersect(compatible, confPolicy);
            } else {
                LogUtils.log(LOG, Level.SEVERE, "INCOMPATIBLE_HTTPCLIENTPOLICY_ASSERTIONS");
                throw new PolicyException(new org.apache.cxf.common.i18n.Message(
                    "INCOMPATIBLE_HTTPCLIENTPOLICY_ASSERTIONS", LOG));
            }
        }
        return compatible;
    }
View Full Code Here

Examples of org.apache.cxf.ws.policy.PolicyException

        if (null != compatible && null != confPolicy) {
            if (PolicyUtils.compatible(compatible, confPolicy)) {
                compatible = intersect(compatible, confPolicy);
            } else {
                LogUtils.log(LOG, Level.SEVERE, "INCOMPATIBLE_HTTPSERVERPOLICY_ASSERTIONS");
                throw new PolicyException(new org.apache.cxf.common.i18n.Message(
                    "INCOMPATIBLE_HTTPSERVERPOLICY_ASSERTIONS", LOG));
            }
        }
        return compatible;
    }
View Full Code Here

Examples of org.apache.stratos.adc.mgt.exception.PolicyException

        if (cartridgeType.equals(CartridgeConstants.MYSQL_CARTRIDGE_NAME)) {
         
          autoScalingPolicy = PolicyHolder.getInstance().getDefaultPolicy();
         
          if (autoScalingPolicy == null) {
            throw new PolicyException("Could not load default auto-scaling policy.");
          }
          if (log.isDebugEnabled()) {
          log.debug("Selected Policy: " + new Gson().toJson(autoScalingPolicy));
        }
         
            dataCartridge = new DataCartridge();
            mysqlPassword = generatePassword();
            dataCartridge.setPassword(mysqlPassword);
            dataCartridge.setDataCartridgeType(cartridgeType);
            dataCartridge.setUserName(CartridgeConstants.MYSQL_DEFAULT_USER);
            clusterDomain = getDynamicClusterDomain(cartridgeType, cartName, cartridgeInfo);

            registerService(cartridgeType,
                    clusterDomain,
                    clusterSubDomain,
                    createPayload(cartridgeInfo, cartName, autoScalingPolicy, repoURL, mysqlPassword, "localhost", payloadZipFileName, tenantId, tenantDomain),
                    "*",
                    cartName + "." + cartridgeInfo.getHostName(),
                    setRegisterServiceProperties(autoScalingPolicy, tenantId,cartName));
            deletePayloadFile(payloadZipFileName);
        } else {
         
      if (!new Boolean(System.getProperty(CartridgeConstants.FEATURE_INTERNAL_REPO_ENABLED))) {
        if (log.isDebugEnabled()) {
          log.debug("Internal repo feature is not enabled.");
        }

        if (repoURL == null || repoURL.trim().length() == 0) {
          throw new RepositoryRequiredException("External repository required for subscription");
        }
      }

      if (repoURL != null && repoURL.trim().length() > 0) {
        if (log.isDebugEnabled()) {
          log.debug("Repo URL entered: " + repoURL);
        }
        // Validate Remote Repository.
        validateRepository(repoURL, repoUsername, repoPassword, privateRepo,
            new Boolean(System.getProperty(CartridgeConstants.FEATURE_EXTERNAL_REPO_VAIDATION_ENABLED)));
      }

            try {
                repository = manageRepository(repoURL, repoUsername, repoPassword, cartName, cartridgeInfo, username,
                        tenantDomain);
            } catch (Exception e) {
                log.error(e.getMessage());
                throw new ADCException(e);
            }
         
            // TODO: Check logic here
            if (!cartridgeInfo.getMultiTenant()) {
             
            if (policy != null && policy.trim().length() > 0) {
              autoScalingPolicy = PolicyHolder.getInstance().getPolicy(policy);
            } else {
              autoScalingPolicy = PolicyHolder.getInstance().getDefaultPolicy();
            }
            if (autoScalingPolicy == null) {
              throw new PolicyException("Could not load auto-scaling policy.");
            }
            if (log.isDebugEnabled()) {
              log.debug("Selected Policy: " + new Gson().toJson(autoScalingPolicy));
            }

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.