summaryrefslogtreecommitdiffstats
path: root/src/main/java/derms/client/ResponderClient.java
blob: 6834c7684873435f2b616bec01091510b94230f1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package derms.client;

import derms.frontend.DERMSInterface;
import derms.util.TestLogger;

import java.net.MalformedURLException;
import java.util.Objects;

public class ResponderClient {
    private final DERMSInterface server;

    public ResponderClient(String FEhost) throws MalformedURLException {
        server = Client.connectToServer(FEhost);
    }

    public String addResource(String resourceID, String resourceName, int duration) {
        String res = server.addResource(resourceID, resourceName, duration);
        if (res.contains("Fail")) {
            TestLogger.log("[FAILED: " + res + "]");
        } else {
            TestLogger.log("[SUCCESS: " + res + "]");
        }
        return res;
    }

    public String removeResource(String resourceID, int duration) {
        return server.removeResource(resourceID, duration);
    }

    public String listResourceAvailability(String resourceName) {
        return server.listResourceAvailability(resourceName);
    }
}