-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Method names for DELETE are not self-explanatory
- Loading branch information
Aleksandar Stojsavljevic
committed
Jun 1, 2018
1 parent
4b76860
commit 4c1bbaa
Showing
10 changed files
with
225 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/test/java/com/phoenixnap/oss/ramlplugin/raml2code/github/Issue261RulesTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.phoenixnap.oss.ramlplugin.raml2code.github; | ||
|
||
import org.junit.Test; | ||
|
||
import com.phoenixnap.oss.ramlplugin.raml2code.rules.GitHubAbstractRuleTestBase; | ||
import com.phoenixnap.oss.ramlplugin.raml2code.rules.Spring4ControllerDecoratorRule; | ||
|
||
/** | ||
* @author aleksandars | ||
* @since 2.0.2 | ||
*/ | ||
public class Issue261RulesTest extends GitHubAbstractRuleTestBase { | ||
|
||
@Test | ||
public void verify_naming_logic_for_delete() throws Exception { | ||
loadRaml("issue-261.raml"); | ||
rule = new Spring4ControllerDecoratorRule(); | ||
rule.apply(getControllerMetadata(), jCodeModel); | ||
verifyGeneratedCode("Issue261Spring4ControllerDecorator"); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#%RAML 1.0 | ||
title: Method names for DELETE are not self-explanatory | ||
|
||
/deleting: | ||
/test-object/{testId}: | ||
uriParameters: | ||
testId: integer | ||
delete: | ||
/subresource: | ||
delete: | ||
queryParameters: | ||
name: string | ||
|
||
/some-other-object/: | ||
delete: | ||
queryParameters: | ||
id: integer | ||
number: integer | ||
|
||
/anotherobject: | ||
/{objectId}: | ||
uriParameters: | ||
objectId: integer | ||
delete: | ||
headers: | ||
headerParam: string | ||
|
||
/singleobject: | ||
delete: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
136 changes: 136 additions & 0 deletions
136
src/test/resources/validations/github/Issue261Spring4ControllerDecorator.java.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
-----------------------------------com.gen.test.DeletingController.java----------------------------------- | ||
|
||
package com.gen.test; | ||
|
||
import org.springframework.http.ResponseEntity; | ||
|
||
|
||
/** | ||
* No description | ||
* (Generated with springmvc-raml-parser [email protected]@) | ||
* | ||
*/ | ||
public interface DeletingController { | ||
|
||
|
||
/** | ||
* No description | ||
* | ||
*/ | ||
public ResponseEntity<?> deleteTestObjectByTestId(Long testId); | ||
|
||
/** | ||
* No description | ||
* | ||
*/ | ||
public ResponseEntity<?> deleteSubresource(Long testId, String name); | ||
|
||
/** | ||
* No description | ||
* | ||
*/ | ||
public ResponseEntity<?> deleteSomeOtherObject(Long id, Long number); | ||
|
||
/** | ||
* No description | ||
* | ||
*/ | ||
public ResponseEntity<?> deleteAnotherobject(Long objectId, String headerParam); | ||
|
||
/** | ||
* No description | ||
* | ||
*/ | ||
public ResponseEntity<?> deleteSingleobject(); | ||
|
||
} | ||
-----------------------------------com.gen.test.DeletingControllerDecorator.java----------------------------------- | ||
|
||
package com.gen.test; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.validation.annotation.Validated; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestHeader; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
|
||
/** | ||
* No description | ||
* (Generated with springmvc-raml-parser [email protected]@) | ||
* | ||
*/ | ||
@RestController | ||
@RequestMapping("/api/deleting") | ||
@Validated | ||
public class DeletingControllerDecorator | ||
implements DeletingController | ||
{ | ||
|
||
@Autowired | ||
private DeletingController deletingControllerDelegate; | ||
|
||
/** | ||
* No description | ||
* | ||
*/ | ||
@RequestMapping(value = "/test-object/{testId}", method = RequestMethod.DELETE) | ||
public ResponseEntity<?> deleteTestObjectByTestId( | ||
@PathVariable | ||
Long testId) { | ||
return this.deletingControllerDelegate.deleteTestObjectByTestId(testId); | ||
} | ||
|
||
/** | ||
* No description | ||
* | ||
*/ | ||
@RequestMapping(value = "/test-object/{testId}/subresource", method = RequestMethod.DELETE) | ||
public ResponseEntity<?> deleteSubresource( | ||
@PathVariable | ||
Long testId, | ||
@RequestParam | ||
String name) { | ||
return this.deletingControllerDelegate.deleteSubresource(testId, name); | ||
} | ||
|
||
/** | ||
* No description | ||
* | ||
*/ | ||
@RequestMapping(value = "/some-other-object/", method = RequestMethod.DELETE) | ||
public ResponseEntity<?> deleteSomeOtherObject( | ||
@RequestParam | ||
Long id, | ||
@RequestParam | ||
Long number) { | ||
return this.deletingControllerDelegate.deleteSomeOtherObject(id, number); | ||
} | ||
|
||
/** | ||
* No description | ||
* | ||
*/ | ||
@RequestMapping(value = "/anotherobject/{objectId}", method = RequestMethod.DELETE) | ||
public ResponseEntity<?> deleteAnotherobject( | ||
@PathVariable | ||
Long objectId, | ||
@RequestHeader | ||
String headerParam) { | ||
return this.deletingControllerDelegate.deleteAnotherobject(objectId, headerParam); | ||
} | ||
|
||
/** | ||
* No description | ||
* | ||
*/ | ||
@RequestMapping(value = "/singleobject", method = RequestMethod.DELETE) | ||
public ResponseEntity<?> deleteSingleobject() { | ||
return this.deletingControllerDelegate.deleteSingleobject(); | ||
} | ||
|
||
} |