Skip to content

Commit

Permalink
Bump h2 version to 2.x, consistent with springboot
Browse files Browse the repository at this point in the history
  • Loading branch information
shoothzj committed Feb 28, 2023
1 parent d262471 commit caab56f
Show file tree
Hide file tree
Showing 54 changed files with 570 additions and 374 deletions.
4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ XXXXX

Follow this checklist to help us incorporate your contribution quickly and easily:

- [ ] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request.
- [ ] Read the [Contributing Guide](https://github.com/apolloconfig/apollo/blob/master/CONTRIBUTING.md) before making this pull request.
- [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
- [ ] Write necessary unit tests to verify the code.
- [ ] Run `mvn clean test` to make sure this pull request doesn't break anything.
- [ ] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
- [ ] Update the [`CHANGES` log](https://github.com/apolloconfig/apollo/blob/master/CHANGES.md).
77 changes: 77 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Publish Docker Image

on:
workflow_dispatch:
inputs:
version:
description: 'version'
required: true

jobs:
check:
runs-on: ubuntu-latest
outputs:
apollo-config-tags: ${{ steps.check-tags.outputs.apollo-config-tags }}
apollo-admin-tags: ${{ steps.check-tags.outputs.apollo-admin-tags }}
apollo-portal-tags: ${{ steps.check-tags.outputs.apollo-portal-tags }}
steps:
- id: check-tags
name: Check tags
run: |
if [[ ${{ github.event.inputs.version }} == *-SNAPSHOT ]]; then
echo "apollo-config-tags=apolloconfig/apollo-configservice:${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
echo "apollo-admin-tags=apolloconfig/apollo-adminservice:${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
echo "apollo-portal-tags=apolloconfig/apollo-portal:${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
else
echo "apollo-config-tags=apolloconfig/apollo-configservice:${{ github.event.inputs.version }},apolloconfig/apollo-configservice:latest" >> $GITHUB_OUTPUT
echo "apollo-admin-tags=apolloconfig/apollo-adminservice:${{ github.event.inputs.version }},apolloconfig/apollo-adminservice:latest" >> $GITHUB_OUTPUT
echo "apollo-portal-tags=apolloconfig/apollo-portal:${{ github.event.inputs.version }},apolloconfig/apollo-portal:latest" >> $GITHUB_OUTPUT
fi
publish:
needs: check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 8
- name: Build package
run: ./scripts/build.sh
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USER_NAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push apollo-configservice
uses: docker/build-push-action@v3
with:
context: ./apollo-configservice/target
platforms: linux/amd64,linux/arm64
file: ./apollo-configservice/src/main/docker/Dockerfile
push: true
build-args: VERSION=${{ github.event.inputs.version }}
tags: ${{ needs.check.outputs.apollo-config-tags }}
- name: Build and push apollo-adminservice
uses: docker/build-push-action@v3
with:
context: ./apollo-adminservice/target
platforms: linux/amd64,linux/arm64
file: ./apollo-adminservice/src/main/docker/Dockerfile
push: true
build-args: VERSION=${{ github.event.inputs.version }}
tags: ${{ needs.check.outputs.apollo-admin-tags }}
- name: Build and push apollo-portal
uses: docker/build-push-action@v3
with:
context: ./apollo-portal/target
platforms: linux/amd64,linux/arm64
file: ./apollo-portal/src/main/docker/Dockerfile
push: true
build-args: VERSION=${{ github.event.inputs.version }}
tags: ${{ needs.check.outputs.apollo-portal-tags }}
3 changes: 1 addition & 2 deletions .licenserc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ header:
copyright-owner: Apollo Authors

paths-ignore:
- '.github/ISSUE_TEMPLATE'
- '.github/PULL_REQUEST_TEMPLATE'
- '.github/**'
- '**/.gitignore'
- '**/.helmignore'
- '.gitmodules'
Expand Down
43 changes: 4 additions & 39 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,11 @@ Changes by Version
==================
Release Notes.

Apollo 2.1.0
Apollo 2.2.0

------------------
* [fix:occur a 400 error request when openapi key's parameter contain "a[0]"](https://github.com/apolloconfig/apollo/pull/4424)
* [Upgrade mysql-connector-java version to fix possible transaction rollback failure issue](https://github.com/apolloconfig/apollo/pull/4425)
* [Remove database migration tool Flyway](https://github.com/apolloconfig/apollo/pull/4361)
* [Optimize Spring-Security Firewall Deny Request Response 400](https://github.com/apolloconfig/apollo/pull/4428)
* [Optimize the UI experience of open platform authorization management](https://github.com/apolloconfig/apollo/pull/4436)
* [Allow users to associate multiple public namespaces at a time](https://github.com/apolloconfig/apollo/pull/4437)
* [Move apollo-demo, scripts/docker-quick-start and scripts/apollo-on-kubernetes out of main repository](https://github.com/apolloconfig/apollo/pull/4440)
* [Add search key when comparing Configuration items](https://github.com/apolloconfig/apollo/pull/4459)
* [A user-friendly user management page for apollo portal](https://github.com/apolloconfig/apollo/pull/4464)
* [Optimize performance of '/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces' interface queries](https://github.com/apolloconfig/apollo/pull/4473)
* [Add a new API to load items with pagination](https://github.com/apolloconfig/apollo/pull/4468)
* [fix(#4474):'openjdk:8-jre-alpine' potentially causing wrong number of cpu cores](https://github.com/apolloconfig/apollo/pull/4475)
* [Switching spring-session serialization mode to json for compatibility with spring-security version updates](https://github.com/apolloconfig/apollo/pull/4484)
* [fix(#4483):Fixed overwrite JSON type configuration being empty](https://github.com/apolloconfig/apollo/pull/4486)
* [Allow users to delete AppNamespace](https://github.com/apolloconfig/apollo/pull/4499)
* [fix the deleted at timestamp issue](https://github.com/apolloconfig/apollo/pull/4493)
* [add configuration processor for portal developers](https://github.com/apolloconfig/apollo/pull/4521)
* [Add a potential json value check feature](https://github.com/apolloconfig/apollo/pull/4519)
* [Add index for table ReleaseHistory](https://github.com/apolloconfig/apollo/pull/4550)
* [Add basic type check for Item value](https://github.com/apolloconfig/apollo/pull/4542)
* [add an option to custom oidc userDisplayName](https://github.com/apolloconfig/apollo/pull/4507)
* [fix openapi item with url illegalKey 400 error](https://github.com/apolloconfig/apollo/pull/4549)
* [fix the exception occurred when publish/rollback namespaces with grayrelease](https://github.com/apolloconfig/apollo/pull/4564)
* [fix create namespace with single dot 500 error](https://github.com/apolloconfig/apollo/pull/4568)
* [Add nodejs client sdk and fix doc](https://github.com/apolloconfig/apollo/pull/4590)
* [Move apollo-core, apollo-client, apollo-mockserver, apollo-openapi and apollo-client-config-data to apollo-java repo](https://github.com/apolloconfig/apollo/pull/4594)
* [fix get the openapi interface that contains namespace information for deleted items](https://github.com/apolloconfig/apollo/pull/4596)
* [A user-friendly config management page for apollo portal](https://github.com/apolloconfig/apollo/pull/4592)
* [feat: support use database as a registry](https://github.com/apolloconfig/apollo/pull/4595)
* [fix doc bug](https://github.com/apolloconfig/apollo/pull/4579)
* [fix Grayscale release Item Value length limit can not be synchronized with its main version](https://github.com/apolloconfig/apollo/pull/4622)
* [feat: use can change spring.profiles.active's value without rebuild project](https://github.com/apolloconfig/apollo/pull/4616)
* [refactor: remove app.properties and move some config file's location](https://github.com/apolloconfig/apollo/pull/4637)
* [Fix the problem of deleting blank items appear at the end](https://github.com/apolloconfig/apollo/pull/4662)
* [Portal-UI adds serverConfig configuration management of ApolloConfigDB](https://github.com/apolloconfig/apollo/pull/4680)
* [Enable login authentication for eureka](https://github.com/apolloconfig/apollo/pull/4663)

* [Fix the problem of inconsistent length of appId column](https://github.com/apolloconfig/apollo/pull/4725)
* [Bump springcloud springboot version to solve cve problems](https://github.com/apolloconfig/apollo/pull/4712)

------------------
All issues and pull requests are [here](https://github.com/apolloconfig/apollo/milestone/11?closed=1)
All issues and pull requests are [here](https://github.com/apolloconfig/apollo/milestone/13?closed=1)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ English | [中文](https://www.apolloconfig.com/#/zh/README)

[![Build Status](https://github.com/apolloconfig/apollo/workflows/build/badge.svg)](https://github.com/apolloconfig/apollo/actions)
[![GitHub Release](https://img.shields.io/github/release/apolloconfig/apollo.svg)](https://github.com/apolloconfig/apollo/releases)
[![Maven Central Repo](https://img.shields.io/maven-central/v/com.ctrip.framework.apollo/apollo.svg)](https://mvnrepository.com/artifact/com.ctrip.framework.apollo/apollo-client)
[![Maven Central Repo](https://img.shields.io/maven-central/v/com.ctrip.framework.apollo/apollo-client.svg)](https://mvnrepository.com/artifact/com.ctrip.framework.apollo/apollo-client)
[![codecov.io](https://codecov.io/github/apolloconfig/apollo/coverage.svg?branch=master)](https://codecov.io/github/apolloconfig/apollo?branch=master)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,20 @@ private void postConstruct() {
protected String url(String path) {
return "http://localhost:" + port + path;
}

protected String namespaceBaseUrl() {
return url("/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName:.+}");
}

protected String appBaseUrl() {
return url("/apps/{appId}");
}

protected String clusterBaseUrl() {
return url("/apps/{appId}/clusters/{clusterName}");
}

protected String itemBaseUrl(){
return url("/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/items");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class AppControllerTest extends AbstractControllerTest {
AppRepository appRepository;

private String getBaseAppUrl() {
return "http://localhost:" + port + "/apps/";
return url("/apps/");
}

@Test
Expand Down Expand Up @@ -123,7 +123,7 @@ public void testDelete() {
App app = BeanUtils.transform(App.class, dto);
app = appRepository.save(app);

restTemplate.delete("http://localhost:{port}/apps/{appId}?operator={operator}", port, app.getAppId(), "test");
restTemplate.delete(url("/apps/{appId}?operator={operator}"), app.getAppId(), "test");

App deletedApp = appRepository.findById(app.getId()).orElse(null);
Assert.assertNull(deletedApp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ public void testCreate(){
dto.setComment(comment);
dto.setDataChangeCreatedBy("apollo");

AppNamespaceDTO resultDto = restTemplate.postForEntity(
String.format("http://localhost:%d/apps/%s/appnamespaces", port, appId),dto, AppNamespaceDTO.class).getBody();
AppNamespaceDTO resultDto = restTemplate.postForEntity(url("/apps/{appId}/appnamespaces"), dto, AppNamespaceDTO.class, appId).getBody();

Assert.assertNotNull(resultDto);
Assert.assertEquals(appId, resultDto.getAppId());
Assert.assertTrue(resultDto.getId() > 0);

Expand All @@ -54,9 +54,5 @@ public void testCreate(){
Assert.assertNotNull(savedAppNs.getDataChangeLastModifiedTime());
Assert.assertNotNull(savedAppNs.getDataChangeLastModifiedBy());
Assert.assertNotNull(savedAppNs.getDataChangeCreatedBy());




}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,29 +23,23 @@
import com.ctrip.framework.apollo.common.utils.InputValidator;
import com.ctrip.framework.apollo.core.ConfigConsts;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.HttpClientErrorException;

import static org.hamcrest.Matchers.containsString;
import static org.mockito.Mockito.*;

public class ClusterControllerTest extends AbstractControllerTest {

@InjectMocks
private ClusterController clusterController;

@Mock
private ClusterService clusterService;

@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
clusterController = new ClusterController(clusterService);
}


@Test(expected = BadRequestException.class)
public void testDeleteDefaultFail() {
Cluster cluster = new Cluster();
Expand All @@ -68,22 +62,18 @@ public void shouldFailWhenRequestBodyInvalid() {
cluster.setAppId("valid");
cluster.setName("notBlank");
ResponseEntity<ClusterDTO> response =
restTemplate.postForEntity(baseUrl() + "/apps/{appId}/clusters", cluster, ClusterDTO.class, cluster.getAppId());
restTemplate.postForEntity(url("/apps/{appId}/clusters"), cluster, ClusterDTO.class, cluster.getAppId());
ClusterDTO createdCluster = response.getBody();
Assert.assertNotNull(createdCluster);
Assert.assertEquals(cluster.getAppId(), createdCluster.getAppId());
Assert.assertEquals(cluster.getName(), createdCluster.getName());

cluster.setName("invalid app name");
try {
restTemplate.postForEntity(baseUrl() + "/apps/{appId}/clusters", cluster, ClusterDTO.class, cluster.getAppId());
restTemplate.postForEntity(url("/apps/{appId}/clusters"), cluster, ClusterDTO.class, cluster.getAppId());
Assert.fail("Should throw");
} catch (HttpClientErrorException e) {
Assert.assertThat(new String(e.getResponseBodyAsByteArray()), containsString(InputValidator.INVALID_CLUSTER_NAMESPACE_MESSAGE));
}
}

private String baseUrl() {
return "http://localhost:" + port;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
import com.ctrip.framework.apollo.common.exception.NotFoundException;
import com.ctrip.framework.apollo.common.exception.ServiceException;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.data.domain.PageRequest;
Expand All @@ -40,6 +40,7 @@
@RunWith(MockitoJUnitRunner.class)
public class ControllerExceptionTest {

@InjectMocks
private AppController appController;

@Mock
Expand All @@ -48,11 +49,6 @@ public class ControllerExceptionTest {
@Mock
private AdminService adminService;

@Before
public void setUp() {
appController = new AppController(appService, adminService);
}

@Test(expected = NotFoundException.class)
public void testFindNotExists() {
when(appService.findOne(any(String.class))).thenReturn(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.jdbc.Sql;
import org.springframework.test.context.jdbc.Sql.ExecutionPhase;
Expand Down Expand Up @@ -57,8 +56,6 @@ public class ControllerIntegrationExceptionTest extends AbstractControllerTest {

@Before
public void setUp() {
MockitoAnnotations.initMocks(this);

realAdminService = ReflectionTestUtils.getField(appController, "adminService");

ReflectionTestUtils.setField(appController, "adminService", adminService);
Expand All @@ -69,10 +66,6 @@ public void tearDown() throws Exception {
ReflectionTestUtils.setField(appController, "adminService", realAdminService);
}

private String getBaseAppUrl() {
return "http://localhost:" + port + "/apps/";
}

@Test
@Sql(scripts = "/controller/cleanup.sql", executionPhase = ExecutionPhase.AFTER_TEST_METHOD)
public void testCreateFailed() {
Expand All @@ -81,7 +74,7 @@ public void testCreateFailed() {
when(adminService.createNewApp(any(App.class))).thenThrow(new RuntimeException("save failed"));

try {
restTemplate.postForEntity(getBaseAppUrl(), dto, AppDTO.class);
restTemplate.postForEntity(url("/apps/"), dto, AppDTO.class);
} catch (HttpStatusCodeException e) {
@SuppressWarnings("unchecked")
Map<String, String> attr = GSON.fromJson(e.getResponseBodyAsString(), Map.class);
Expand Down
Loading

0 comments on commit caab56f

Please sign in to comment.