Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

@Getter
@Setter
public class AssetResponse {
MTConnectAssets assets;
public class DeviceRequest {

Check warning on line 8 in mtconnect-api/src/main/java/io/github/protocol/mtconnect/api/DeviceRequest.java

View check run for this annotation

Codecov / codecov/patch

mtconnect-api/src/main/java/io/github/protocol/mtconnect/api/DeviceRequest.java#L8

Added line #L8 was not covered by tests
private String id;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import io.github.openfacade.http.HttpServerFactory;
import io.github.openfacade.http.SyncRequestHandler;
import io.github.protocol.mtconnect.api.AssetRequest;
import io.github.protocol.mtconnect.api.AssetResponse;
import io.github.protocol.mtconnect.api.MTConnectAssets;
import io.github.protocol.mtconnect.common.XmlUtil;
import io.netty.handler.codec.http.HttpResponseStatus;

Expand Down Expand Up @@ -35,11 +35,11 @@
class MtAssetsHandler implements SyncRequestHandler {
@Override
public HttpResponse handle(HttpRequest request) {
AssetResponse assetResponse = mtProcessor.asset(new AssetRequest());
MTConnectAssets mtConnectAssets = mtProcessor.asset(new AssetRequest());

Check warning on line 38 in mtconnect-server/src/main/java/io/github/protocol/mtconnect/server/MtConnectServer.java

View check run for this annotation

Codecov / codecov/patch

mtconnect-server/src/main/java/io/github/protocol/mtconnect/server/MtConnectServer.java#L38

Added line #L38 was not covered by tests
// convert the response to http response
String body;
try {
body = XmlUtil.toXml(assetResponse.getAssets());
body = XmlUtil.toXml(mtConnectAssets);

Check warning on line 42 in mtconnect-server/src/main/java/io/github/protocol/mtconnect/server/MtConnectServer.java

View check run for this annotation

Codecov / codecov/patch

mtconnect-server/src/main/java/io/github/protocol/mtconnect/server/MtConnectServer.java#L42

Added line #L42 was not covered by tests
} catch (Exception e) {
throw new RuntimeException(e);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package io.github.protocol.mtconnect.server;

import io.github.protocol.mtconnect.api.AssetRequest;
import io.github.protocol.mtconnect.api.AssetResponse;
import io.github.protocol.mtconnect.api.DeviceRequest;
import io.github.protocol.mtconnect.api.MTConnectAssets;
import io.github.protocol.mtconnect.api.MTConnectDevices;

public interface MtProcessor {
AssetResponse asset(AssetRequest assetRequest);
MTConnectAssets asset(AssetRequest assetRequest);
MTConnectDevices device(DeviceRequest deviceRequest);
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package io.github.protocol.mtconnect.server.impl;

import io.github.protocol.mtconnect.api.AssetRequest;
import io.github.protocol.mtconnect.api.AssetResponse;
import io.github.protocol.mtconnect.api.DeviceRequest;
import io.github.protocol.mtconnect.api.MTConnectAssets;
import io.github.protocol.mtconnect.api.MTConnectDevices;
import io.github.protocol.mtconnect.server.MtProcessor;

public class IoTDAMtProcessor implements MtProcessor {
Expand All @@ -15,7 +17,12 @@
}

@Override
public AssetResponse asset(AssetRequest assetRequest) {
public MTConnectAssets asset(AssetRequest assetRequest) {
return null;

Check warning on line 21 in mtconnect-server/src/main/java/io/github/protocol/mtconnect/server/impl/IoTDAMtProcessor.java

View check run for this annotation

Codecov / codecov/patch

mtconnect-server/src/main/java/io/github/protocol/mtconnect/server/impl/IoTDAMtProcessor.java#L21

Added line #L21 was not covered by tests
}

@Override
public MTConnectDevices device(DeviceRequest deviceRequest) {
return null;
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package io.github.protocol.mtconnect.server.impl;

import io.github.protocol.mtconnect.api.AssetRequest;
import io.github.protocol.mtconnect.api.AssetResponse;
import io.github.protocol.mtconnect.api.DeviceRequest;
import io.github.protocol.mtconnect.api.MTConnectAssets;
import io.github.protocol.mtconnect.api.MTConnectDevices;
import io.github.protocol.mtconnect.server.MtProcessor;

import java.util.HashMap;
Expand All @@ -16,10 +17,12 @@
Map<String, MTConnectAssets> mtConnectAssetsMap = new HashMap<>();

@Override
public AssetResponse asset(AssetRequest assetRequest) {
MTConnectAssets assets = mtConnectAssetsMap.get(assetRequest.getId());
AssetResponse assetResponse = new AssetResponse();
assetResponse.setAssets(assets);
return assetResponse;
public MTConnectAssets asset(AssetRequest assetRequest) {
return mtConnectAssetsMap.get(assetRequest.getId());

Check warning on line 21 in mtconnect-server/src/main/java/io/github/protocol/mtconnect/server/impl/MemoryMtProcessor.java

View check run for this annotation

Codecov / codecov/patch

mtconnect-server/src/main/java/io/github/protocol/mtconnect/server/impl/MemoryMtProcessor.java#L21

Added line #L21 was not covered by tests
}

@Override
public MTConnectDevices device(DeviceRequest deviceRequest) {
return null;

Check warning on line 26 in mtconnect-server/src/main/java/io/github/protocol/mtconnect/server/impl/MemoryMtProcessor.java

View check run for this annotation

Codecov / codecov/patch

mtconnect-server/src/main/java/io/github/protocol/mtconnect/server/impl/MemoryMtProcessor.java#L26

Added line #L26 was not covered by tests
}
}