Skip to content

Commit

Permalink
[#42] Removed unnecessary comments and lines
Browse files Browse the repository at this point in the history
  • Loading branch information
sam-i-am012 authored and korydraughn committed Jul 26, 2024
1 parent f794fc0 commit 1297320
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 81 deletions.

This file was deleted.

This file was deleted.

24 changes: 7 additions & 17 deletions src/main/java/org/example/Operations/CollectionOperations.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import org.example.Properties.Collection.*;
import org.example.Wrapper;
import org.example.Mapper.Serialize.ModifyMetadataOperations;
import org.example.Mapper.Serialize.ModifyPermissionsOperations;
import org.example.Serialize.ModifyMetadataOperations;
import org.example.Serialize.ModifyPermissionsOperations;
import org.example.Util.*;

import java.io.IOException;
Expand All @@ -24,7 +24,6 @@ public class CollectionOperations {
private final Wrapper client;
private String baseUrl;


public CollectionOperations(Wrapper client) {
this.client = client;
this.baseUrl = client.getBaseUrl() + "/collections";
Expand Down Expand Up @@ -78,7 +77,6 @@ public Response remove(String token, String lpath) {
return this.remove(token, lpath, prop);
}


/**
* Returns information about a collection
* @param lpath The logical path for the collection
Expand Down Expand Up @@ -208,9 +206,7 @@ public Response modify_metadata(String token, String lpath, List<ModifyMetadataO
prop.getAdmin().ifPresent(val -> formData.put("admin", String.valueOf(val)));

HttpResponse<String> response = HttpRequestUtil.sendAndParsePOST(formData, baseUrl, token, client.getClient());

return new Response(response.statusCode(), response.body());

}

public Response modify_metadata(String token, String lpath, List<ModifyMetadataOperations> jsonParam) {
Expand All @@ -220,11 +216,10 @@ public Response modify_metadata(String token, String lpath, List<ModifyMetadataO

public Response rename(String token, String oldPath, String newPath) {
// contains parameters for the HTTP request
Map<Object, Object> formData = Map.of(
"op", "rename",
"old-lpath", oldPath,
"new-lpath", newPath
);
Map<Object, Object> formData = new HashMap<>();
formData.put("op", "rename");
formData.put("old-lpath", oldPath);
formData.put("new-lpath", newPath);

HttpResponse<String> response = HttpRequestUtil.sendAndParsePOST(formData, baseUrl, token, client.getClient());
return new Response(response.statusCode(), response.body());
Expand All @@ -242,13 +237,8 @@ public Response touch(String token, String lpath, CollectionsTouchParams prop)

return new Response(response.statusCode(), response.body());
}

public Response touch(String token, String lpath) {
CollectionsTouchParams prop = new CollectionsTouchParams();
return this.touch(token, lpath, prop);
}
}




}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import org.example.Properties.DataObject.*;
import org.example.Properties.DataObject.DataObjectModifyReplicaParams;
import org.example.Wrapper;
import org.example.Mapper.Serialize.ModifyMetadataOperations;
import org.example.Mapper.Serialize.ModifyPermissionsOperations;
import org.example.Serialize.ModifyMetadataOperations;
import org.example.Serialize.ModifyPermissionsOperations;
import org.example.Util.HttpRequestUtil;
import org.example.Util.Response;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.example.Properties.Resource.ResourceAddChildParams;
import org.example.Properties.Resource.ResourceCreateParams;
import org.example.Wrapper;
import org.example.Mapper.Serialize.ModifyMetadataOperations;
import org.example.Serialize.ModifyMetadataOperations;
import org.example.Util.HttpRequestUtil;
import org.example.Util.Response;

Expand Down
6 changes: 2 additions & 4 deletions src/main/java/org/example/Operations/UserGroupOperations.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.fasterxml.jackson.databind.ObjectMapper;
import org.example.Wrapper;
import org.example.Mapper.Serialize.ModifyMetadataOperations;
import org.example.Serialize.ModifyMetadataOperations;
import org.example.Util.HttpRequestUtil;
import org.example.Util.IrodsException;
import org.example.Util.Response;
Expand All @@ -17,7 +17,6 @@ public class UserGroupOperations {
private final Wrapper client;
private String baseUrl;


public UserGroupOperations(Wrapper client) {
this.client = client;
this.baseUrl = client.getBaseUrl() + "/users-groups";
Expand Down Expand Up @@ -168,6 +167,5 @@ public Response modify_metadata(String token, String name, List<ModifyMetadataOp
HttpResponse<String> response = HttpRequestUtil.sendAndParsePOST(formData, baseUrl, token, client.getClient());

return new Response(response.statusCode(), response.body());

}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.example.Mapper.Serialize;
package org.example.Serialize;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonProcessingException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.example.Mapper.Serialize;
package org.example.Serialize;


import com.fasterxml.jackson.annotation.JsonProperty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;

import org.example.Mapper.Serialize.ModifyMetadataOperations;
import org.example.Mapper.Serialize.ModifyPermissionsOperations;
import org.example.Serialize.ModifyMetadataOperations;
import org.example.Serialize.ModifyPermissionsOperations;
import org.example.Properties.DataObject.*;
import org.example.Properties.Resource.ResourceCreateParams;
import org.example.Util.Response;
Expand Down
6 changes: 0 additions & 6 deletions src/test/java/org/example/WrapperTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@
import org.junit.Before;
import org.junit.Test;
import org.example.Util.Response;

import static org.junit.Assert.*;


public class WrapperTest {
private static String baseUrl;
private static Wrapper rods;
private Response response;

@Before
public void setup() {
String address = "52.91.145.195";
Expand All @@ -25,15 +21,13 @@ public void setup() {
response = rods.information().info();
assertEquals(200, response.getHttpStatusCode());
}

@Test
public void authenticate_valid() {
response = rods.authenticate();
assertEquals(200, response.getHttpStatusCode());
assertEquals(response.getBody(), rods.getAuthToken());

}

@Test
public void authenticate_invalid_user() {
Wrapper test = new Wrapper(baseUrl, "test", "test");
Expand Down

0 comments on commit 1297320

Please sign in to comment.