Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

Commit 25a13d6

Browse files
committed
chore: apply google code format
1 parent 16c1550 commit 25a13d6

File tree

270 files changed

+2597
-2547
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

270 files changed

+2597
-2547
lines changed

.github/workflows/ci.yml

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,34 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v2
1414
- uses: gradle/wrapper-validation-action@v1
15+
16+
verify-google-java-format:
17+
name: Google Java Format Verification
18+
runs-on: ubuntu-latest
19+
needs: validation
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v2
23+
- name: Setup Java
24+
uses: actions/setup-java@v2
25+
with:
26+
distribution: 'zulu'
27+
java-version: 15
28+
- name: Cache Gradle
29+
uses: actions/cache@v2
30+
env:
31+
java-version: 15
32+
with:
33+
path: |
34+
~/.gradle/caches
35+
~/.gradle/wrapper
36+
key: ${{ runner.os }}-${{ env.java-version }}-gradle-${{ hashFiles('**/*.gradle*') }}
37+
restore-keys: ${{ runner.os }}-${{ env.java-version }}-gradle-
38+
- name: Make gradlew executable
39+
run: chmod +x ./gradlew
40+
- name: Gradle Check
41+
run: ./gradlew --info verifyGoogleJavaFormat
42+
1543
test:
1644
name: Test run
1745
needs: validation
@@ -38,7 +66,8 @@ jobs:
3866
- name: Make gradlew executable
3967
run: chmod +x ./gradlew
4068
- name: Gradle Check
41-
run: ./gradlew --info check
69+
run: ./gradlew --info check -x verifyGoogleJavaFormat
70+
4271
build:
4372
name: Publish snapshot
4473
needs: test
@@ -69,7 +98,8 @@ jobs:
6998
env:
7099
OSS_USER_TOKEN_KEY: ${{ secrets.OSS_USER_TOKEN_KEY }}
71100
OSS_USER_TOKEN_PASS: ${{ secrets.OSS_USER_TOKEN_PASS }}
72-
run: ./gradlew clean build publish -x test
101+
run: ./gradlew clean build publish -x test verifyGoogleJavaFormat
102+
73103
sonar:
74104
name: Sonar analysis
75105
needs: validation
@@ -100,4 +130,4 @@ jobs:
100130
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
101131
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
102132
if: env.SONAR_TOKEN != null
103-
run: ./gradlew build jacocoTestReport sonarqube --info
133+
run: ./gradlew build jacocoTestReport sonarqube --info -x verifyGoogleJavaFormat

.github/workflows/release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ jobs:
88
steps:
99
- uses: actions/checkout@v2
1010
- uses: gradle/wrapper-validation-action@v1
11+
1112
test:
1213
name: Test run
1314
needs: validation
@@ -34,7 +35,8 @@ jobs:
3435
- name: Make gradlew executable
3536
run: chmod +x ./gradlew
3637
- name: Gradle Check
37-
run: ./gradlew --info check
38+
run: ./gradlew --info check -x verifyGoogleJavaFormat
39+
3840
build:
3941
name: Publish release
4042
needs: test

altair-spring-boot-autoconfigure/src/main/java/graphql/kickstart/altair/boot/AltairAutoConfiguration.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
import org.springframework.context.annotation.Configuration;
99
import org.springframework.web.servlet.DispatcherServlet;
1010

11-
/**
12-
* @author Moncef AOUDIA
13-
*/
11+
/** @author Moncef AOUDIA */
1412
@Configuration
1513
@ConditionalOnWebApplication
1614
@EnableConfigurationProperties(AltairProperties.class)
@@ -22,5 +20,4 @@ public class AltairAutoConfiguration {
2220
AltairController altairController() {
2321
return new AltairController();
2422
}
25-
2623
}

altair-spring-boot-autoconfigure/src/main/java/graphql/kickstart/altair/boot/AltairController.java

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,16 @@
2424
import org.springframework.web.bind.annotation.PathVariable;
2525
import org.springframework.web.bind.annotation.RequestParam;
2626

27-
/**
28-
* @author Moncef AOUDIA
29-
*/
27+
/** @author Moncef AOUDIA */
3028
@Controller
3129
public class AltairController {
3230

3331
private static final String CDN_UNPKG = "//unpkg.com/";
3432
private static final String ALTAIR = "altair-static";
3533

36-
@Autowired
37-
private AltairProperties altairProperties;
34+
@Autowired private AltairProperties altairProperties;
3835

39-
@Autowired
40-
private Environment environment;
36+
@Autowired private Environment environment;
4137

4238
private String template;
4339
private String props;
@@ -67,31 +63,36 @@ private void loadHeaders() throws JsonProcessingException {
6763
}
6864

6965
@GetMapping(value = "${altair.mapping:/altair}")
70-
public void altair(HttpServletRequest request, HttpServletResponse response,
71-
@PathVariable Map<String, String> params) throws IOException {
66+
public void altair(
67+
HttpServletRequest request,
68+
HttpServletResponse response,
69+
@PathVariable Map<String, String> params)
70+
throws IOException {
7271
response.setContentType("text/html; charset=UTF-8");
7372

74-
Map<String, String> replacements = getReplacements(
75-
constructGraphQlEndpoint(request, params),
76-
request.getContextPath() + altairProperties.getEndpoint().getSubscriptions()
77-
);
73+
Map<String, String> replacements =
74+
getReplacements(
75+
constructGraphQlEndpoint(request, params),
76+
request.getContextPath() + altairProperties.getEndpoint().getSubscriptions());
7877

7978
String populatedTemplate = StringSubstitutor.replace(template, replacements);
8079
response.getOutputStream().write(populatedTemplate.getBytes(Charset.defaultCharset()));
8180
}
8281

83-
private Map<String, String> getReplacements(String graphqlEndpoint,
84-
String subscriptionsEndpoint) {
82+
private Map<String, String> getReplacements(
83+
String graphqlEndpoint, String subscriptionsEndpoint) {
8584
Map<String, String> replacements = new HashMap<>();
8685
replacements.put("graphqlEndpoint", graphqlEndpoint);
8786
replacements.put("subscriptionsEndpoint", subscriptionsEndpoint);
8887
replacements.put("pageTitle", altairProperties.getPageTitle());
8988
replacements.put("pageFavicon", getResourceUrl("favicon.ico", "favicon.ico"));
90-
replacements.put("altairBaseUrl", getResourceUrl(
91-
StringUtils.join(altairProperties.getBasePath(), "/vendor/altair/"),
92-
joinJsUnpkgPath(ALTAIR, altairProperties.getCdn().getVersion(), "build/dist/")));
93-
replacements
94-
.put("altairLogoUrl", getResourceUrl("assets/img/logo_350.svg", "assets/img/logo_350.svg"));
89+
replacements.put(
90+
"altairBaseUrl",
91+
getResourceUrl(
92+
StringUtils.join(altairProperties.getBasePath(), "/vendor/altair/"),
93+
joinJsUnpkgPath(ALTAIR, altairProperties.getCdn().getVersion(), "build/dist/")));
94+
replacements.put(
95+
"altairLogoUrl", getResourceUrl("assets/img/logo_350.svg", "assets/img/logo_350.svg"));
9596
replacements.put("altairCssUrl", getResourceUrl("styles.css", "styles.css"));
9697
replacements.put("altairMainJsUrl", getResourceUrl("main.js", "main.js"));
9798
replacements.put("altairPolyfillsJsUrl", getResourceUrl("polyfills.js", "polyfills.js"));
@@ -112,17 +113,16 @@ private String joinJsUnpkgPath(String library, String cdnVersion, String cdnFile
112113
return CDN_UNPKG + library + "@" + cdnVersion + "/" + cdnFileName;
113114
}
114115

115-
private String constructGraphQlEndpoint(HttpServletRequest request,
116-
@RequestParam Map<String, String> params) {
116+
private String constructGraphQlEndpoint(
117+
HttpServletRequest request, @RequestParam Map<String, String> params) {
117118
String endpoint = altairProperties.getEndpoint().getGraphql();
118119
for (Map.Entry<String, String> param : params.entrySet()) {
119120
endpoint = endpoint.replaceAll("\\{" + param.getKey() + "}", param.getValue());
120121
}
121-
if (StringUtils.isNotBlank(request.getContextPath()) && !endpoint
122-
.startsWith(request.getContextPath())) {
122+
if (StringUtils.isNotBlank(request.getContextPath())
123+
&& !endpoint.startsWith(request.getContextPath())) {
123124
return request.getContextPath() + endpoint;
124125
}
125126
return endpoint;
126127
}
127-
128128
}

altair-spring-boot-autoconfigure/src/main/java/graphql/kickstart/altair/boot/AltairProperties.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,4 @@ static class Cdn {
2727
private boolean enabled = false;
2828
private String version = "2.4.11";
2929
}
30-
3130
}

altair-spring-boot-autoconfigure/src/test/java/graphql/kickstart/altair/boot/test/AbstractAutoConfigurationTest.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
package graphql.kickstart.altair.boot.test;
22

3-
import lombok.NonNull;
43
import org.junit.jupiter.api.AfterEach;
54
import org.springframework.boot.test.util.TestPropertyValues;
65
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
76
import org.springframework.context.annotation.AnnotationConfigRegistry;
87
import org.springframework.context.support.AbstractApplicationContext;
98

10-
/**
11-
* @author Moncef AOUDIA
12-
*/
9+
/** @author Moncef AOUDIA */
1310
public abstract class AbstractAutoConfigurationTest {
1411

1512
private final Class<? extends AbstractApplicationContext> contextClass;
@@ -21,8 +18,8 @@ protected AbstractAutoConfigurationTest(Class<?> autoConfiguration) {
2118
this(AnnotationConfigApplicationContext.class, autoConfiguration);
2219
}
2320

24-
protected AbstractAutoConfigurationTest(Class<? extends AbstractApplicationContext> contextClass,
25-
Class<?> autoConfiguration) {
21+
protected AbstractAutoConfigurationTest(
22+
Class<? extends AbstractApplicationContext> contextClass, Class<?> autoConfiguration) {
2623
assert AnnotationConfigRegistry.class.isAssignableFrom(contextClass);
2724
this.contextClass = contextClass;
2825
this.autoConfiguration = autoConfiguration;

altair-spring-boot-autoconfigure/src/test/java/graphql/kickstart/altair/boot/test/AltairControllerTest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
1515
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
1616

17-
/**
18-
* @author Andrew Potter
19-
*/
17+
/** @author Andrew Potter */
2018
class AltairControllerTest extends AbstractAutoConfigurationTest {
2119

2220
public AltairControllerTest() {

example-graphql-subscription/src/main/java/graphql/kickstart/spring/web/boot/SubscriptionSampleApplication.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@ public class SubscriptionSampleApplication {
99
public static void main(String[] args) {
1010
SpringApplication.run(SubscriptionSampleApplication.class, args);
1111
}
12-
1312
}

example-graphql-subscription/src/main/java/graphql/kickstart/spring/web/boot/publishers/StockTickerReactorPublisher.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,13 @@ public class StockTickerReactorPublisher {
3737
private final Flux<StockPriceUpdate> publisher;
3838

3939
public StockTickerReactorPublisher() {
40-
Flux<StockPriceUpdate> stockPriceUpdateFlux = Flux.create(emitter -> {
41-
ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1);
42-
executorService.scheduleAtFixedRate(newStockTick(emitter), 0, 2, TimeUnit.SECONDS);
43-
}, FluxSink.OverflowStrategy.BUFFER);
40+
Flux<StockPriceUpdate> stockPriceUpdateFlux =
41+
Flux.create(
42+
emitter -> {
43+
ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1);
44+
executorService.scheduleAtFixedRate(newStockTick(emitter), 0, 2, TimeUnit.SECONDS);
45+
},
46+
FluxSink.OverflowStrategy.BUFFER);
4447
ConnectableFlux<StockPriceUpdate> connectableFlux = stockPriceUpdateFlux.share().publish();
4548
connectableFlux.connect();
4649

@@ -72,8 +75,8 @@ private Runnable newStockTick(FluxSink<StockPriceUpdate> emitter) {
7275
};
7376
}
7477

75-
private void emitStocks(FluxSink<StockPriceUpdate> emitter,
76-
List<StockPriceUpdate> stockPriceUpdates) {
78+
private void emitStocks(
79+
FluxSink<StockPriceUpdate> emitter, List<StockPriceUpdate> stockPriceUpdates) {
7780
for (StockPriceUpdate stockPriceUpdate : stockPriceUpdates) {
7881
try {
7982
emitter.next(stockPriceUpdate);
@@ -89,8 +92,8 @@ public Flux<StockPriceUpdate> getPublisher() {
8992

9093
public Flux<StockPriceUpdate> getPublisher(List<String> stockCodes) {
9194
if (stockCodes != null) {
92-
return publisher
93-
.filter(stockPriceUpdate -> stockCodes.contains(stockPriceUpdate.getStockCode()));
95+
return publisher.filter(
96+
stockPriceUpdate -> stockCodes.contains(stockPriceUpdate.getStockCode()));
9497
}
9598
return publisher;
9699
}
@@ -119,5 +122,4 @@ private StockPriceUpdate rollUpdate() {
119122
CURRENT_STOCK_PRICES.put(stockCode, newPrice);
120123
return new StockPriceUpdate(stockCode, LocalDateTime.now(), newPrice, incrementDollars);
121124
}
122-
123125
}

example-graphql-subscription/src/main/java/graphql/kickstart/spring/web/boot/publishers/StockTickerRxPublisher.java

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ public class StockTickerRxPublisher {
3939
private final Flowable<StockPriceUpdate> publisher;
4040

4141
public StockTickerRxPublisher() {
42-
Observable<StockPriceUpdate> stockPriceUpdateObservable = Observable.create(emitter -> {
43-
44-
ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1);
45-
executorService.scheduleAtFixedRate(newStockTick(emitter), 0, 2, TimeUnit.SECONDS);
46-
47-
});
48-
49-
ConnectableObservable<StockPriceUpdate> connectableObservable = stockPriceUpdateObservable
50-
.share().publish();
42+
Observable<StockPriceUpdate> stockPriceUpdateObservable =
43+
Observable.create(
44+
emitter -> {
45+
ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1);
46+
executorService.scheduleAtFixedRate(newStockTick(emitter), 0, 2, TimeUnit.SECONDS);
47+
});
48+
49+
ConnectableObservable<StockPriceUpdate> connectableObservable =
50+
stockPriceUpdateObservable.share().publish();
5151
connectableObservable.connect();
5252

5353
publisher = connectableObservable.toFlowable(BackpressureStrategy.BUFFER);
@@ -76,8 +76,8 @@ private Runnable newStockTick(ObservableEmitter<StockPriceUpdate> emitter) {
7676
};
7777
}
7878

79-
private void emitStocks(ObservableEmitter<StockPriceUpdate> emitter,
80-
List<StockPriceUpdate> stockPriceUpdates) {
79+
private void emitStocks(
80+
ObservableEmitter<StockPriceUpdate> emitter, List<StockPriceUpdate> stockPriceUpdates) {
8181
for (StockPriceUpdate stockPriceUpdate : stockPriceUpdates) {
8282
try {
8383
emitter.onNext(stockPriceUpdate);
@@ -93,8 +93,8 @@ public Flowable<StockPriceUpdate> getPublisher() {
9393

9494
public Flowable<StockPriceUpdate> getPublisher(List<String> stockCodes) {
9595
if (stockCodes != null) {
96-
return publisher
97-
.filter(stockPriceUpdate -> stockCodes.contains(stockPriceUpdate.getStockCode()));
96+
return publisher.filter(
97+
stockPriceUpdate -> stockCodes.contains(stockPriceUpdate.getStockCode()));
9898
}
9999
return publisher;
100100
}
@@ -123,5 +123,4 @@ private StockPriceUpdate rollUpdate() {
123123
CURRENT_STOCK_PRICES.put(stockCode, newPrice);
124124
return new StockPriceUpdate(stockCode, LocalDateTime.now(), newPrice, incrementDollars);
125125
}
126-
127126
}

0 commit comments

Comments
 (0)