Skip to content

Commit

Permalink
refactor(styles): apply spotless on groovy files and java files in sr…
Browse files Browse the repository at this point in the history
…c/it/ (6301)

Add groovy formatter settings to parent pom
---
Increase scope for groovy formatter and format/fix existing groovy files
---
Apply spotless after rebase to format added groovy file
  • Loading branch information
baloo42 authored Aug 27, 2024
1 parent 2f31392 commit b7ecb18
Show file tree
Hide file tree
Showing 16 changed files with 1,494 additions and 1,481 deletions.
19 changes: 9 additions & 10 deletions java-generator/it/src/it/cert-manager/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ import static org.junit.jupiter.api.Assertions.assertEquals

// TODO: This should be modified to test against the current extension sources
assertEquals(
new File(basedir, "/expected/Auth.expected")
.getText("UTF-8")
.replace("\r\n", "\n")
.trim(),
new File(basedir, "/target/generated-sources/java/io/cert_manager/v1/issuerspec/vault/Auth.java")
.getText("UTF-8")
.replace("\r\n", "\n")
.trim()
)

new File(basedir, "/expected/Auth.expected")
.getText("UTF-8")
.replace("\r\n", "\n")
.trim(),
new File(basedir, "/target/generated-sources/java/io/cert_manager/v1/issuerspec/vault/Auth.java")
.getText("UTF-8")
.replace("\r\n", "\n")
.trim()
)
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/
package io.fabric8.test;

import com.example.v1.ExistingJavaTypeSpec; // Generated
import io.fabric8.kubernetes.api.model.Affinity; // Existing
import com.example.v1.ExistingJavaTypeSpec;
import io.fabric8.kubernetes.api.model.Affinity;

public class ExistingJavaTypes {
public void example() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,67 +23,67 @@ import spock.util.concurrent.AsyncConditions

class DefaultMockServerAnyMethodTest extends Specification {

@Shared
static def vertx = Vertx.vertx()
@Shared
static def vertx = Vertx.vertx()

DefaultMockServer server
DefaultMockServer server

WebClient client
WebClient client

def setup() {
server = new DefaultMockServer()
server.start()
client = WebClient.create(vertx)
}
def setup() {
server = new DefaultMockServer()
server.start()
client = WebClient.create(vertx)
}

def cleanup() {
server.shutdown()
client.close()
}
def cleanup() {
server.shutdown()
client.close()
}

def cleanupSpec() {
vertx.close()
}
def cleanupSpec() {
vertx.close()
}

def "when setting an expectation for ANY should respond to POST"() {
given: "An expectation with any"
server.expect().any().withPath("/api/v1/resource").andReturn(200, "OK").always()
and: "A POST request"
def req1 = client.post(server.port, server.getHostName(), "/api/v1/resource")
.send()
and: "An instance of AsyncConditions"
def async = new AsyncConditions(1)
def "when setting an expectation for ANY should respond to POST"() {
given: "An expectation with any"
server.expect().any().withPath("/api/v1/resource").andReturn(200, "OK").always()
and: "A POST request"
def req1 = client.post(server.port, server.getHostName(), "/api/v1/resource")
.send()
and: "An instance of AsyncConditions"
def async = new AsyncConditions(1)

when: "The request is sent and completed"
req1.onComplete { isr ->
async.evaluate {
assert req1.result().statusCode() == 200
assert req1.result().body().toString() == "OK"
}
}
when: "The request is sent and completed"
req1.onComplete { isr ->
async.evaluate {
assert req1.result().statusCode() == 200
assert req1.result().body().toString() == "OK"
}
}

then: "Expect the result to be completed in the specified time"
async.await(10)
}
then: "Expect the result to be completed in the specified time"
async.await(10)
}

def "when setting an expectation for ANY should respond to PUT"() {
given: "An expectation with any"
server.expect().any().withPath("/api/v1/resource").andReturn(200, "OK").always()
and: "A PUT request"
def req1 = client.put(server.port, server.getHostName(), "/api/v1/resource")
.send()
and: "An instance of AsyncConditions"
def async = new AsyncConditions(1)
def "when setting an expectation for ANY should respond to PUT"() {
given: "An expectation with any"
server.expect().any().withPath("/api/v1/resource").andReturn(200, "OK").always()
and: "A PUT request"
def req1 = client.put(server.port, server.getHostName(), "/api/v1/resource")
.send()
and: "An instance of AsyncConditions"
def async = new AsyncConditions(1)

when: "The request is sent and completed"
req1.onComplete { isr ->
async.evaluate {
assert req1.result().statusCode() == 200
assert req1.result().body().toString() == "OK"
}
}
when: "The request is sent and completed"
req1.onComplete { isr ->
async.evaluate {
assert req1.result().statusCode() == 200
assert req1.result().body().toString() == "OK"
}
}

then: "Expect the result to be completed in the specified time"
async.await(10)
}
then: "Expect the result to be completed in the specified time"
async.await(10)
}
}
Loading

0 comments on commit b7ecb18

Please sign in to comment.