Skip to content

Commit 82edabd

Browse files
committed
Enable formatting of Test files
1 parent 652c486 commit 82edabd

279 files changed

Lines changed: 3178 additions & 2865 deletions

File tree

Some content is hidden

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

dd-java-agent/agent-bootstrap/src/test/groovy/datadog/trace/bootstrap/DatadogClassLoaderTest.groovy

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -37,25 +37,25 @@ class DatadogClassLoaderTest extends DDSpecification {
3737

3838
when:
3939
final Thread thread1 = new Thread() {
40-
@Override
41-
void run() {
42-
synchronized (ddLoader.getClassLoadingLock(className1)) {
43-
threadHoldLockPhase.arrive()
44-
acquireLockFromMainThreadPhase.arriveAndAwaitAdvance()
40+
@Override
41+
void run() {
42+
synchronized (ddLoader.getClassLoadingLock(className1)) {
43+
threadHoldLockPhase.arrive()
44+
acquireLockFromMainThreadPhase.arriveAndAwaitAdvance()
45+
}
4546
}
4647
}
47-
}
4848
thread1.start()
4949

5050
final Thread thread2 = new Thread() {
51-
@Override
52-
void run() {
53-
threadHoldLockPhase.arriveAndAwaitAdvance()
54-
synchronized (ddLoader.getClassLoadingLock(className2)) {
55-
acquireLockFromMainThreadPhase.arrive()
51+
@Override
52+
void run() {
53+
threadHoldLockPhase.arriveAndAwaitAdvance()
54+
synchronized (ddLoader.getClassLoadingLock(className2)) {
55+
acquireLockFromMainThreadPhase.arrive()
56+
}
5657
}
5758
}
58-
}
5959
thread2.start()
6060
thread1.join()
6161
thread2.join()
@@ -147,11 +147,11 @@ class DatadogClassLoaderTest extends DDSpecification {
147147

148148
for (int i = 0; i < 100; i++) {
149149
futures.add(executorService.submit(new Callable<Void>() {
150-
Void call() {
151-
child.loadClass("a.A")
152-
return null
153-
}
154-
}))
150+
Void call() {
151+
child.loadClass("a.A")
152+
return null
153+
}
154+
}))
155155
}
156156

157157
for (Future<Void> callable : futures) {
@@ -164,7 +164,6 @@ class DatadogClassLoaderTest extends DDSpecification {
164164

165165
then:
166166
noExceptionThrown()
167-
168167
}
169168

170169
def "test delegate classloader successfully loads classes concurrently"() {
@@ -183,11 +182,11 @@ class DatadogClassLoaderTest extends DDSpecification {
183182
when:
184183
for (int i = 0; i < 100; i++) {
185184
futures.add(executorService.submit(new Callable<Void>() {
186-
Void call() {
187-
child.loadClass("x.X")
188-
return null
189-
}
190-
}))
185+
Void call() {
186+
child.loadClass("x.X")
187+
return null
188+
}
189+
}))
191190
}
192191

193192
for (Future<Void> callable : futures) {
@@ -200,7 +199,6 @@ class DatadogClassLoaderTest extends DDSpecification {
200199

201200
then:
202201
noExceptionThrown()
203-
204202
}
205203

206204
def "test load nested classes and call getEnclosingClass"() {

dd-java-agent/agent-bootstrap/src/test/groovy/datadog/trace/bootstrap/FieldBackedContextStoresTest.groovy

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@ class FieldBackedContextStoresTest extends DDSpecification {
99

1010
def "test FieldBackedContextStore id allocation"() {
1111
setup:
12-
int testAllocations = 128
13-
FieldBackedContextStore[] allocatedStores = new FieldBackedContextStore[testAllocations]
14-
AtomicInteger keyIds = new AtomicInteger()
12+
int testAllocations = 128
13+
FieldBackedContextStore[] allocatedStores = new FieldBackedContextStore[testAllocations]
14+
AtomicInteger keyIds = new AtomicInteger()
1515

16-
ThreadUtils.runConcurrently(10, testAllocations, {
17-
int keyId = keyIds.getAndIncrement()
18-
int storeId = FieldBackedContextStores.getContextStoreId("key${keyId}", "value${keyId}")
19-
assert allocatedStores[storeId] == null
20-
allocatedStores[storeId] = FieldBackedContextStores.getContextStore(storeId)
21-
})
16+
ThreadUtils.runConcurrently(10, testAllocations, {
17+
int keyId = keyIds.getAndIncrement()
18+
int storeId = FieldBackedContextStores.getContextStoreId("key${keyId}", "value${keyId}")
19+
assert allocatedStores[storeId] == null
20+
allocatedStores[storeId] = FieldBackedContextStores.getContextStore(storeId)
21+
})
2222

2323
expect:
24-
keyIds.get() == testAllocations
25-
allocatedStores.size() == testAllocations
26-
(allocatedStores as List).withIndex().collect({ store, storeId -> assert store.storeId == storeId })
24+
keyIds.get() == testAllocations
25+
allocatedStores.size() == testAllocations
26+
(allocatedStores as List).withIndex().collect({ store, storeId -> assert store.storeId == storeId })
2727
}
2828
}

dd-java-agent/agent-bootstrap/src/test/groovy/datadog/trace/bootstrap/instrumentation/DBQueryInfoTest.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import datadog.trace.bootstrap.instrumentation.jdbc.DBQueryInfo
44
import datadog.trace.test.util.DDSpecification
55

66
class DBQueryInfoTest extends DDSpecification {
7-
7+
88
def "extract operation name" () {
99
when:
1010
DBQueryInfo info = new DBQueryInfo(sql)

dd-java-agent/agent-bootstrap/src/test/groovy/datadog/trace/bootstrap/instrumentation/decorator/BaseDecoratorTest.groovy

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -157,42 +157,42 @@ class BaseDecoratorTest extends DDSpecification {
157157
}
158158
} :
159159
analyticsEnabledDefault ?
160-
new BaseDecorator() {
161-
@Override
162-
protected String[] instrumentationNames() {
163-
return ["test1", "test2"]
164-
}
165-
166-
@Override
167-
protected CharSequence spanType() {
168-
return "test-type"
169-
}
170-
171-
@Override
172-
protected CharSequence component() {
173-
return "test-component"
174-
}
175-
176-
protected boolean traceAnalyticsDefault() {
177-
return true
178-
}
179-
} :
180-
new BaseDecorator() {
181-
@Override
182-
protected String[] instrumentationNames() {
183-
return ["test1", "test2"]
184-
}
185-
186-
@Override
187-
protected CharSequence spanType() {
188-
return "test-type"
189-
}
190-
191-
@Override
192-
protected CharSequence component() {
193-
return "test-component"
194-
}
160+
new BaseDecorator() {
161+
@Override
162+
protected String[] instrumentationNames() {
163+
return ["test1", "test2"]
164+
}
165+
166+
@Override
167+
protected CharSequence spanType() {
168+
return "test-type"
169+
}
170+
171+
@Override
172+
protected CharSequence component() {
173+
return "test-component"
174+
}
175+
176+
protected boolean traceAnalyticsDefault() {
177+
return true
178+
}
179+
} :
180+
new BaseDecorator() {
181+
@Override
182+
protected String[] instrumentationNames() {
183+
return ["test1", "test2"]
184+
}
185+
186+
@Override
187+
protected CharSequence spanType() {
188+
return "test-type"
189+
}
190+
191+
@Override
192+
protected CharSequence component() {
193+
return "test-component"
195194
}
195+
}
196196
}
197197

198198
class SomeInnerClass implements Runnable {

dd-java-agent/agent-bootstrap/src/test/groovy/datadog/trace/bootstrap/instrumentation/decorator/ClientDecoratorTest.groovy

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -47,29 +47,29 @@ class ClientDecoratorTest extends BaseDecoratorTest {
4747

4848
def newDecorator(String serviceName) {
4949
return new ClientDecorator() {
50-
@Override
51-
protected String[] instrumentationNames() {
52-
return ["test1", "test2"]
53-
}
50+
@Override
51+
protected String[] instrumentationNames() {
52+
return ["test1", "test2"]
53+
}
5454

55-
@Override
56-
protected String service() {
57-
return serviceName
58-
}
55+
@Override
56+
protected String service() {
57+
return serviceName
58+
}
5959

60-
@Override
61-
protected CharSequence spanType() {
62-
return "test-type"
63-
}
60+
@Override
61+
protected CharSequence spanType() {
62+
return "test-type"
63+
}
6464

65-
@Override
66-
protected CharSequence component() {
67-
return "test-component"
68-
}
65+
@Override
66+
protected CharSequence component() {
67+
return "test-component"
68+
}
6969

70-
protected boolean traceAnalyticsDefault() {
71-
return true
70+
protected boolean traceAnalyticsDefault() {
71+
return true
72+
}
7273
}
73-
}
7474
}
7575
}

dd-java-agent/agent-bootstrap/src/test/groovy/datadog/trace/bootstrap/instrumentation/decorator/DBTypeProcessingDatabaseClientDecoratorTest.groovy

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -36,49 +36,49 @@ class DBTypeProcessingDatabaseClientDecoratorTest extends ClientDecoratorTest {
3636
@Override
3737
def newDecorator(String serviceName = "test-service") {
3838
return new DBTypeProcessingDatabaseClientDecorator<Map>() {
39-
@Override
40-
protected String[] instrumentationNames() {
41-
return ["test1", "test2"]
39+
@Override
40+
protected String[] instrumentationNames() {
41+
return ["test1", "test2"]
42+
}
43+
44+
@Override
45+
protected String service() {
46+
return serviceName
47+
}
48+
49+
@Override
50+
protected CharSequence component() {
51+
return "test-component"
52+
}
53+
54+
@Override
55+
protected CharSequence spanType() {
56+
return "test-type"
57+
}
58+
59+
@Override
60+
protected String dbType() {
61+
return "test-db"
62+
}
63+
64+
@Override
65+
protected String dbUser(Map map) {
66+
return map.user
67+
}
68+
69+
@Override
70+
protected String dbInstance(Map map) {
71+
return map.instance
72+
}
73+
74+
@Override
75+
protected String dbHostname(Map map) {
76+
return map.hostname
77+
}
78+
79+
protected boolean traceAnalyticsDefault() {
80+
return true
81+
}
4282
}
43-
44-
@Override
45-
protected String service() {
46-
return serviceName
47-
}
48-
49-
@Override
50-
protected CharSequence component() {
51-
return "test-component"
52-
}
53-
54-
@Override
55-
protected CharSequence spanType() {
56-
return "test-type"
57-
}
58-
59-
@Override
60-
protected String dbType() {
61-
return "test-db"
62-
}
63-
64-
@Override
65-
protected String dbUser(Map map) {
66-
return map.user
67-
}
68-
69-
@Override
70-
protected String dbInstance(Map map) {
71-
return map.instance
72-
}
73-
74-
@Override
75-
protected String dbHostname(Map map) {
76-
return map.hostname
77-
}
78-
79-
protected boolean traceAnalyticsDefault() {
80-
return true
81-
}
82-
}
8383
}
8484
}

0 commit comments

Comments
 (0)