Package com.sforce.ws

Examples of com.sforce.ws.ConnectionException


        public SecurityContext retrieveUserData()
            throws ConnectionException {
           
            if (badSession) {
                badSession = false;
                throw new ConnectionException();
            }
           
            SecurityContext sc = new ForceSecurityContext();
           
            sc.setSessionId(SESSION_ID);
View Full Code Here


    @MockClass(realClass = PartnerConnection.class, instantiation = Instantiation.PerMockSetup)
    public static class MockInsufficientProfileAccessPartnerConnection extends MockQueryPartnerConnection {
        @Mock
        @Override
        public SObject[] retrieve(String fieldList, String sObjectType, String[] ids) throws ConnectionException {
            throw new ConnectionException("You don't have access to retrieve profile info.");
        }
View Full Code Here

            ForceConnectorConfig loadedConfig;
            try {
                loadedConfig = ForceConnectorConfig.loadFromName(connectionName);
            } catch (IOException e) {
                throw new ConnectionException("Unable to load ForceConnectorConfig for name " + connectionName, e);
            }
           
            if (loadedConfig != null) {
                // Save the client id for possible later use (see initConnection)
                externalClientId = loadedConfig.getClientId();
                return checkConfigCache(loadedConfig, connectionName);
            }
        }
       
        // Finally, try to get config from ThreadLocal
        if ((config = ForceThreadLocalStore.getConnectorConfig()) != null) return config;
       
        // Out of options.  There's not enough here to construct config.
        StringBuffer errorMsg = new StringBuffer();
        errorMsg.append("No state was found to construct a connection.")
                .append(" Please provide a ForceConnectorConfig.");
       
        if (connectionName != null) {
            errorMsg.append(" Or create a classpath properties file, environment variable or java property for the name '")
                    .append(connectionName).append("'");
        }

        throw new ConnectionException(errorMsg.toString());
    }
View Full Code Here

        return configToCheck;
    }

    private void validateConnectorConfig(ForceConnectorConfig configToValidate) throws ConnectionException {
        if (configToValidate.getSessionId() == null && configToValidate.getAuthEndpoint() == null) {
            throw new ConnectionException("ForceConnectorConfig must have an AuthEndpoint");
        }
       
        if (configToValidate.getSessionId() == null && configToValidate.getUsername() == null) {
            throw new ConnectionException("ForceConnectorConfig must have a Username");
        }
    }
View Full Code Here

TOP

Related Classes of com.sforce.ws.ConnectionException

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.