Skip to content

Commit

Permalink
Fix documentation error. (#5414)
Browse files Browse the repository at this point in the history
suppress naming convention warnings for Rest Docs.
  • Loading branch information
corneil authored Jul 24, 2023
1 parent 1e64fe3 commit 5147092
Show file tree
Hide file tree
Showing 22 changed files with 41 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
* @author Gunnar Hillert
* @author Ilayaperumal Gopinathan
*/
@SuppressWarnings("NewClassNamingConvention")
public class AboutDocumentation extends BaseDocumentation {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
* @author Christian Tzolov
* @author Ilayaperumal Gopinathan
*/
@SuppressWarnings("NewClassNamingConvention")
public class ApiDocumentation extends BaseDocumentation {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
* @author Christian Tzolov
* @author Ilayaperumal Gopinathan
*/
@SuppressWarnings("NewClassNamingConvention")
public class AppRegistryDocumentation extends BaseDocumentation {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
*
* @author Gunnar Hillert
*/
@SuppressWarnings("NewClassNamingConvention")
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class AuditRecordsDocumentation extends BaseDocumentation {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
import org.springframework.cloud.task.batch.listener.TaskBatchDao;
import org.springframework.cloud.task.repository.TaskExecution;
import org.springframework.cloud.task.repository.dao.TaskExecutionDao;
import org.springframework.http.MediaType;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringRunner;
Expand All @@ -70,6 +69,7 @@
* @author Glenn Renfro
* @author Corneil du Plessis
*/
@SuppressWarnings("NewClassNamingConvention")
@RunWith(SpringRunner.class)
@SpringBootTest(classes = {EmbeddedDataSourceConfiguration.class})
@DirtiesContext
Expand Down Expand Up @@ -363,7 +363,7 @@ public void jobRestart() throws Exception {
);
}

private void initialize() throws Exception {
private void initialize() {
this.daoContainer = context.getBean(TaskExecutionDaoContainer.class);
this.taskBatchDaoContainer = context.getBean(TaskBatchDaoContainer.class);
this.jobRepositoryContainer = context.getBean(JobRepositoryContainer.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
* @author Glenn Renfro
* @author Corneil du Plessis
*/
@SuppressWarnings({"NewClassNamingConvention", "SameParameterValue"})
@RunWith(SpringRunner.class)
@SpringBootTest(classes = { EmbeddedDataSourceConfiguration.class })
@DirtiesContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
* @author Glenn Renfro
* @author Corneil du Plessis
*/
@SuppressWarnings({"NewClassNamingConvention", "SameParameterValue"})
@RunWith(SpringRunner.class)
@SpringBootTest(classes = {EmbeddedDataSourceConfiguration.class})
@DirtiesContext
Expand Down Expand Up @@ -165,7 +166,7 @@ public void stepProgress() throws Exception {
}


private void initialize() throws Exception {
private void initialize() {
this.aggregateExecutionSupport = context.getBean(AggregateExecutionSupport.class);
this.jobRepositoryContainer = context.getBean(JobRepositoryContainer.class);
this.daoContainer = context.getBean(TaskExecutionDaoContainer.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
* @author Eric Bottard
* @author Ilayaperumal Gopinathan
*/
@SuppressWarnings("NewClassNamingConvention")
@DirtiesContext
public class RuntimeAppsDocumentation extends BaseDocumentation {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
/**
* @author Gunnar Hillert
*/
@SuppressWarnings("NewClassNamingConvention")
@Ignore
public class RuntimeStreamStatusForStreamAppsWithoutCollectorDocumentation extends BaseDocumentation {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
* @author Corneil du Plessis
*/
@SuppressWarnings("NewClassNamingConvention")
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class SchemaDocumentation extends BaseDocumentation {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
* @author Gunnar Hillert
* @author Ilayaperumal Gopinathan
*/
@SuppressWarnings("NewClassNamingConvention")
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class StreamDefinitionsDocumentation extends BaseDocumentation {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

Expand Down Expand Up @@ -49,6 +50,7 @@
* @author Ilayaperumal Gopinathan
* @author Christian Tzolov
*/
@SuppressWarnings("NewClassNamingConvention")
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class StreamDeploymentsDocumentation extends BaseDocumentation {

Expand Down Expand Up @@ -170,7 +172,7 @@ public void streamUpdate() throws Exception {
Map<String, String> updateProperties = new HashMap<>();
updateProperties.put("app.time.timestamp.format", "YYYYMMDD");
updateStreamRequest.setUpdateProperties(updateProperties);
final String releaseName = "myLogRelease";

final PackageIdentifier packageIdentifier = new PackageIdentifier();
packageIdentifier.setPackageName("timelog1");
packageIdentifier.setPackageVersion("1.0.0");
Expand All @@ -190,7 +192,7 @@ public void streamUpdate() throws Exception {

@Test
public void rollback() throws Exception {
RollbackRequest rollbackRequest = new RollbackRequest();
final RollbackRequest rollbackRequest = new RollbackRequest();
rollbackRequest.setReleaseName("timelog1");
this.mockMvc.perform(
post("/streams/deployments/rollback/{name}/{version}", "timelog1", 1)
Expand All @@ -204,8 +206,8 @@ public void rollback() throws Exception {

@Test
public void history() throws Exception {
when(this.springDataflowServer.getSkipperClient().history(anyString()))
.thenReturn(Arrays.asList(new Release()));
when(springDataflowServer.getSkipperClient().history(anyString()))
.thenReturn(Collections.singletonList(new Release()));

this.mockMvc.perform(
get("/streams/deployments/history/{name}", "timelog1")
Expand Down Expand Up @@ -239,8 +241,7 @@ public void platformList() throws Exception {
public static String convertObjectToJson(Object object) throws IOException {
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
String json = mapper.writeValueAsString(object);
return json;
return mapper.writeValueAsString(object);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
*
* @author Ilayaperumal Gopinathan
*/
@SuppressWarnings("NewClassNamingConvention")
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class StreamLogsDocumentation extends BaseDocumentation {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
*
* @author Glenn Renfro
*/
@SuppressWarnings("NewClassNamingConvention")
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class StreamValidationDocumentation extends BaseDocumentation {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
* @author Eric Bottard
* @author Ilayaperumal Gopinathan
*/

@SuppressWarnings("NewClassNamingConvention")
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TaskDefinitionsDocumentation extends BaseDocumentation {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
* @author Gunnar Hillert
* @author Corneil du Plessis
*/
@SuppressWarnings("NewClassNamingConvention")
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TaskExecutionsDocumentation extends BaseDocumentation {

Expand All @@ -58,8 +59,8 @@ public void setup() throws Exception {
registerApp(ApplicationType.task, "timestamp", "1.2.0.RELEASE");
createTaskDefinition("taskA");
createTaskDefinition("taskB");
executeTask("taskA", "timestamp");
executeTask("taskB", "timestamp");
executeTask("taskA");
executeTask("taskB");
}


Expand Down Expand Up @@ -89,7 +90,7 @@ public void launchTaskBoot3() throws Exception {
parameterWithName("arguments")
.description("Command line arguments to pass to the task. (optional)")),
responseFields(
fieldWithPath("taskId").description("The id of the task execution"),
fieldWithPath("executionId").description("The id of the task execution"),
fieldWithPath("schemaTarget").description("The schema target of the task state data"),
subsectionWithPath("_links.self").description("Link to the task execution resource"),
subsectionWithPath("_links.tasks/logs").type(fieldWithPath("_links.tasks/logs").ignored().optional()).description("Link to the task execution logs").optional()
Expand Down Expand Up @@ -167,7 +168,6 @@ public void getTaskDisplayDetail() throws Exception {
fieldWithPath("schemaTarget").description("The schema target of the task state data"),
fieldWithPath("resourceUrl").description("The resource URL that defines the task that was executed"),
subsectionWithPath("appProperties").description("The application properties of the task execution"),
subsectionWithPath("deploymentProperties").description("The deployment properties of the task exectuion"),
subsectionWithPath("deploymentProperties").description("The deployment properties of the task execution"),
subsectionWithPath("platformName").description("The platform selected for the task execution"),
subsectionWithPath("_links.self").description("Link to the task execution resource"),
Expand Down Expand Up @@ -223,7 +223,6 @@ public void getTaskDisplayDetailByExternalId() throws Exception {
fieldWithPath("schemaTarget").description("The schema target of the task state data"),
fieldWithPath("resourceUrl").description("The resource URL that defines the task that was executed"),
subsectionWithPath("appProperties").description("The application properties of the task execution"),
subsectionWithPath("deploymentProperties").description("The deployment properties of the task exectuion"),
subsectionWithPath("deploymentProperties").description("The deployment properties of the task execution"),
subsectionWithPath("platformName").description("The platform selected for the task execution"),
subsectionWithPath("_links.self").description("Link to the task execution resource"),
Expand Down Expand Up @@ -372,7 +371,7 @@ private void destroyTaskDefinition(String taskName) throws Exception {
.andExpect(status().isOk()));
}

private void executeTask(String taskName, String registeredName) throws Exception {
private void executeTask(String taskName) throws Exception {
documentation.dontDocument(() ->
this.mockMvc.perform(
post("/tasks/executions")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
* @author Glenn Renfro
* @author Corneil du Plessis
*/
@SuppressWarnings("NewClassNamingConvention")
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TaskLogsDocumentation extends BaseDocumentation {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
*
* @author Ilayaperumal Gopinathan
*/
@SuppressWarnings("NewClassNamingConvention")
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TaskPlatformDocumentation extends BaseDocumentation {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
*
* @author Glenn Renfro
*/
@SuppressWarnings({"NewClassNamingConvention", "SameParameterValue"})
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TaskSchedulerDocumentation extends BaseDocumentation {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
*
* @author Glenn Renfro
*/
@SuppressWarnings("NewClassNamingConvention")
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TaskValidationDocumentation extends BaseDocumentation {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
*
* @author Ilayaperumal Gopinathan
*/
@SuppressWarnings("NewClassNamingConvention")
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TasksInfoDocumentation extends BaseDocumentation {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@
import org.springframework.util.Assert;

/**
* A {@link ResourceAssembler}/{@link ResourcesAssembler} that focuses purely on the domain type,
* returning back {@link Resource} and {@link Resources} for that type instead of
* {@link org.springframework.hateoas.ResourceSupport}.
* A {@link RepresentationModelAssembler}/{@link ResourcesAssembler} that focuses purely on the domain type,
* returning back {@link org.springframework.hateoas.RepresentationModel} and {@link EntityModel} for that type instead of
* {@link org.springframework.hateoas.RepresentationModel}.
*
* @author Greg Turnquist
*/
public class SimpleResourceAssembler<T> implements RepresentationModelAssembler<T, EntityModel<T>>, ResourcesAssembler<T, EntityModel<T>> {

/**
* Converts the given entity into a {@link Resource}.
* Converts the given entity into a {@link org.springframework.hateoas.RepresentationModel}.
*
* @param entity the entity
* @return a resource for the entity.
Expand All @@ -53,12 +53,12 @@ public EntityModel<T> toModel(T entity) {
*
* @see #toModel(Object)
* @param entities must not be {@literal null}.
* @return {@link Resources} containing {@link Resource} of {@code T}.
* @return {@link CollectionModel} containing {@link EntityModel} of {@code T}.
*/
public CollectionModel<EntityModel<T>> toCollectionModel(Iterable<? extends T> entities) {

Assert.notNull(entities, "Entities must not be null!");
List<EntityModel<T>> result = new ArrayList<EntityModel<T>>();
List<EntityModel<T>> result = new ArrayList<>();

for (T entity : entities) {
result.add(toModel(entity));
Expand All @@ -72,7 +72,7 @@ public CollectionModel<EntityModel<T>> toCollectionModel(Iterable<? extends T> e
}

/**
* Define links to add to every individual {@link Resource}.
* Define links to add to every individual {@link EntityModel}.
*
* @param resource
*/
Expand All @@ -81,7 +81,7 @@ protected void addLinks(EntityModel<T> resource) {
}

/**
* Define links to add to the {@link Resources} collection.
* Define links to add to the {@link CollectionModel} collection.
*
* @param resources
*/
Expand Down

0 comments on commit 5147092

Please sign in to comment.