Skip to content

Commit

Permalink
Issue 115: Cleanup ServiceType Scaffolding
Browse files Browse the repository at this point in the history
There is no longer a settings array.
The username/password do not exist anymore.
The URL and token are now directly on the model.
  • Loading branch information
kaladay committed Sep 18, 2020
1 parent 5dbc87e commit aeacdb7
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,4 @@ public ApiResponse deleteRemoteProjectManager(@WeaverValidatedModel RemoteProjec
public ApiResponse getTypes() {
return new ApiResponse(SUCCESS, ServiceType.map());
}

@GetMapping("/scaffolding/{type}")
@PreAuthorize("hasRole('USER')")
public ApiResponse getTypeScaffolding(@PathVariable String type) {
ServiceType serviceType = ServiceType.valueOf(type);
return new ApiResponse(SUCCESS, serviceType.getScaffold());
}
}
21 changes: 0 additions & 21 deletions src/main/java/edu/tamu/app/model/ServiceType.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public enum ServiceType {
Map<String, Object> m = new HashMap<String, Object>();
m.put("value", type.toString());
m.put("gloss", type.gloss);
m.put("scaffold", type.getScaffold());
list.add(m);
}
}
Expand All @@ -36,26 +35,6 @@ public void setGloss(String gloss) {
this.gloss = gloss;
}

public List<Setting> getScaffold() {
List<Setting> scaffold = new ArrayList<Setting>();
switch (this) {
case GITHUB:
scaffold.add(new Setting("text", "url", "URL", true));
scaffold.add(new Setting("password", "token", "Token", false));
break;
case VERSION_ONE:
scaffold.add(new Setting("text", "url", "URL", true));
scaffold.add(new Setting("text", "username", "Username", false));
scaffold.add(new Setting("password", "password", "Password", false));
scaffold.add(new Setting("password", "token", "Token", false));
break;
default:
break;

}
return scaffold;
}

public static List<Map<String, Object>> map() {
return list;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,4 @@ public void testGetTypes() {
assertEquals("Not successful at getting service types", SUCCESS, response.getMeta().getStatus());
}

@Test
public void testGetScaffolding() {
ApiResponse response = remoteProjectManagerController.getTypeScaffolding(ServiceType.VERSION_ONE.toString());
assertEquals("Not successful at getting scaffolding", SUCCESS, response.getMeta().getStatus());
}

}

0 comments on commit aeacdb7

Please sign in to comment.