Skip to content

Commit

Permalink
Merge branch 'main' into renovate/s4u-setup-maven-action-digest
Browse files Browse the repository at this point in the history
  • Loading branch information
ttosta-google authored Aug 31, 2023
2 parents 1c0dd7f + 578de56 commit d2ecd0a
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 21 deletions.
5 changes: 2 additions & 3 deletions .github/blunderbuss.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@
# limitations under the License.

assign_issues:
- enocom

- ttosta-google

assign_prs:
- enocom
- hessjcg
- ttosta-google
14 changes: 7 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
matrix:
java: [8, 11, 17]
steps:
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
Expand All @@ -48,7 +48,7 @@ jobs:
steps:
- name: Support longpaths
run: git config --system core.longpaths true
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
Expand All @@ -66,7 +66,7 @@ jobs:
matrix:
java: [8, 11, 17]
steps:
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
Expand All @@ -79,7 +79,7 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
Expand All @@ -94,7 +94,7 @@ jobs:
clirr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
Expand Down Expand Up @@ -195,7 +195,7 @@ jobs:
steps:
- name: Remove PR label
if: "${{ github.event.action == 'labeled' && github.event.label.name == 'tests: run' }}"
uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
Expand All @@ -211,7 +211,7 @@ jobs:
}
- name: Checkout code
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/labels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
issues: write
pull-requests: write
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- uses: micnncim/action-label-syncer@3abd5ab72fda571e69fffd97bd4e0033dd5f495c # v1.3.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.cloud.alloydb;

// [START alloydb_hikaricp_connect_connector]
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;

public class AlloyDbJdbcConnectorDataSourceFactory {

public static final String ALLOYDB_USER = System.getenv("ALLOYDB_USER");
public static final String ALLOYDB_PASS = System.getenv("ALLOYDB_PASS");
public static final String ALLOYDB_INSTANCE_NAME = System.getenv("ALLOYDB_INSTANCE_NAME");

static HikariDataSource createDataSource() {
HikariConfig config = new HikariConfig();

config.setJdbcUrl("jdbc:postgresql:///postgres");
config.setUsername(ALLOYDB_USER); // e.g., "postgres"
config.setPassword(ALLOYDB_PASS); // e.g., "secret-password"
config.addDataSourceProperty("socketFactory", "com.google.cloud.alloydb.SocketFactory");
// e.g., "projects/my-project/locations/us-central1/clusters/my-cluster/instances/my-instance"
config.addDataSourceProperty("alloydbInstanceName", ALLOYDB_INSTANCE_NAME);

return new HikariDataSource(config);
}
}
// [END alloydb_hikaricp_connect_connector]
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import com.google.common.collect.BoundType;
import com.google.common.collect.Range;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
Expand All @@ -38,15 +37,7 @@ public class ITSocketFactoryTest {

@Before
public void setUp() {
HikariConfig config = new HikariConfig();

config.setJdbcUrl("jdbc:postgresql:///postgres");
config.setUsername(System.getenv("ALLOYDB_USER"));
config.setPassword(System.getenv("ALLOYDB_PASS"));
config.addDataSourceProperty("socketFactory", "com.google.cloud.alloydb.SocketFactory");
config.addDataSourceProperty("alloydbInstanceName", System.getenv("ALLOYDB_INSTANCE_NAME"));

this.dataSource = new HikariDataSource(config);
this.dataSource = AlloyDbJdbcConnectorDataSourceFactory.createDataSource();
}

@After
Expand Down

0 comments on commit d2ecd0a

Please sign in to comment.