Examples of createConnection()


Examples of org.springframework.social.connect.support.OAuth2ConnectionFactory.createConnection()

    @Test
    public void socialLogin() {
        OAuth2ConnectionFactory connectionFactory = mock(OAuth2ConnectionFactory.class);
        Connection<Facebook> connection = mock(Connection.class);
        when(connectionFactoryLocator.getConnectionFactory(any(String.class))).thenReturn(connectionFactory);
        when(connectionFactory.createConnection(any(AccessGrant.class))).thenReturn(connection);
        when(userService.socialLogin(connection)).thenReturn(
                new AuthenticatedUserToken(TEST_USER.getUuid().toString(), AUTH_TOKEN.getToken()));
        OAuth2Request request = new OAuth2Request();
        request.setAccessToken("123");
        ClientResponse response = super.resource().path("user/login/facebook").entity(request, APPLICATION_JSON).accept(APPLICATION_JSON).post(ClientResponse.class);
View Full Code Here

Examples of org.springframework.social.connect.web.test.StubOAuth1ConnectionFactory.createConnection()

  public void constructor() {
    ConnectionFactoryRegistry connectionFactoryLocator = new ConnectionFactoryRegistry();
    ConnectionFactory<TestApi1> connectionFactory1 = new StubOAuth1ConnectionFactory("clientId", "clientSecret");
    connectionFactoryLocator.addConnectionFactory(connectionFactory1);
    StubUsersConnectionRepository usersConnectionRepository = new StubUsersConnectionRepository();
    usersConnectionRepository.createConnectionRepository("habuma").addConnection(connectionFactory1.createConnection(
      new ConnectionData("oauth1Provider", "provider1User1", null, null, null, null, null, null, null)));
    ProviderSignInController providerSignInController = new ProviderSignInController(connectionFactoryLocator, usersConnectionRepository, null);
    providerSignInController.setApplicationUrl("my.url");
  }
  // OAuth 1
View Full Code Here

Examples of org.springframework.social.connect.web.test.StubOAuth2ConnectionFactory.createConnection()

  public void signIn_OAuth2Provider() throws Exception {
    ConnectionFactoryRegistry connectionFactoryLocator = new ConnectionFactoryRegistry();
    ConnectionFactory<TestApi2> connectionFactory2 = new StubOAuth2ConnectionFactory("clientId", "clientSecret");
    connectionFactoryLocator.addConnectionFactory(connectionFactory2);
    StubUsersConnectionRepository usersConnectionRepository = new StubUsersConnectionRepository();
    usersConnectionRepository.createConnectionRepository("habuma").addConnection(connectionFactory2.createConnection(
      new ConnectionData("oauth2Provider", "provider2User1", null, null, null, null, null, null, null)));
    ProviderSignInController providerSignInController = new ProviderSignInController(connectionFactoryLocator, usersConnectionRepository, null);
    providerSignInController.afterPropertiesSet();
    MockMvc mockMvc = standaloneSetup(providerSignInController).build();
    mockMvc.perform(post("/signin/oauth2Provider"))
View Full Code Here

Examples of org.springframework.social.facebook.connect.FacebookConnectionFactory.createConnection()

  private static final String SIGNED_REQUEST = "T4PCp840PHnhgQwMgCSZODpDGqhLC4mFGaNG8oHW7WU.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImlzc3VlZF9hdCI6MTMzNTg5NDc5NiwidXNlciI6eyJjb3VudHJ5IjoidXMiLCJsb2NhbGUiOiJlbl9VUyJ9LCJ1c2VyX2lkIjoiNzM4MTQwNTc5In0";

  @Test
  public void disconnect() throws Exception {
    FacebookConnectionFactory connectionFactory = new FacebookConnectionFactory("clientId", CLIENT_SECRET);
    Connection<Facebook> connection = connectionFactory.createConnection(new ConnectionData("facebook", "738140579", "", "", "", "", "", "", null));
    StubUsersConnectionRepository usersConnectionRepository = new StubUsersConnectionRepository();
    ConnectionRepository connectionRepository = usersConnectionRepository.createConnectionRepository("habuma");
    connectionRepository.addConnection(connection);
    assertEquals(1, connectionRepository.findAllConnections().size());
    DisconnectController controller = new DisconnectController(usersConnectionRepository, CLIENT_SECRET);
View Full Code Here

Examples of org.springframework.ws.transport.WebServiceMessageSender.createConnection()

        URI messageId = new URI("uid:1234");
        expect(strategyMock.newMessageId((SoapMessage) context.getResponse())).andReturn(messageId);

        URI uri = new URI("http://example.com/business/client1");
        expect(senderMock.supports(uri)).andReturn(true);
        expect(senderMock.createConnection(uri)).andReturn(connectionMock);
        connectionMock.send(response);
        connectionMock.close();

        replay(strategyMock, senderMock, connectionMock);
View Full Code Here

Examples of org.teiid.jdbc.FakeServer.createConnection()

    static final String VDB = "PartsSupplier";
   
  @BeforeClass public static void setUp() throws Exception {
      FakeServer server = new FakeServer();
      server.deployVDB(VDB, UnitTestUtil.getTestDataPath() + "/PartsSupplier.vdb");
      connection = server.createConnection("jdbc:teiid:" + VDB); //$NON-NLS-1$ //$NON-NLS-2$   
    }
   
    @AfterClass public static void tearDown() throws SQLException {
      connection.close();
    }
View Full Code Here

Examples of org.voltdb.client.Client.createConnection()

        assert(catalog_site != null);
        Host catalog_host = catalog_site.getHost();
        assert(catalog_host != null);
        Integer port = CollectionUtil.random(CatalogUtil.getExecutionSitePorts(catalog_site));
        assert(port != null);
        client.createConnection(null, catalog_host.getIpaddr(), port, "user", "password");
        LOG.info(String.format("Connected to H-Store cluster at %s:%d", catalog_host.getIpaddr(), port));
       
        ClientResponse cresponse = VoltProcedureInvoker.invoke(args.catalog,
                                                               client,
                                                               procName,
View Full Code Here

Examples of org.voltdb.client.ClientImpl.createConnection()

        ClientImpl clientTmp = (ClientImpl) ClientFactory.createClient(this.config);
        // ENG-6231: Only fail if we can't connect to any of the provided servers.
        boolean connectedAnything = false;
        for (String server : this.servers) {
            try {
                clientTmp.createConnection(server);
                connectedAnything = true;
            }
            catch (UnknownHostException e) {
            }
            catch (IOException e) {
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.