Commit fffada52 authored by chiaming2000's avatar chiaming2000
Browse files

1. Java simulator: set StatusCode to INVALID_REQUEST (instead of

INTERNAL_ERROR) if value size exceeds 1M bytes.

2. Update test case to verify the drive/simulator set the expected error
code when the above occurred.
parent a8fbd809
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -174,7 +174,7 @@ public class KVOp {
                       checkMaxVersionLength (bs);

                        if (isSupportedValueSize(kmreq) == false) {
                            throw new KvException(StatusCode.INVALID_REQUEST,
                            throw new InvalidRequestException (
                                    "value size exceeded max supported size. Supported size: "
                                            + maxValueSize + ", received size="
                                            + kmreq.getValue().length
+4 −6
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ import com.seagate.kinetic.client.internal.DefaultKineticClient;
import com.seagate.kinetic.proto.Kinetic;
import com.seagate.kinetic.proto.Kinetic.Message.Security.ACL;
import com.seagate.kinetic.proto.Kinetic.Message.Security.ACL.Permission;
import com.seagate.kinetic.proto.Kinetic.Message.Status.StatusCode;

/**
 * Kinetic Client API Boundary Test.
@@ -297,12 +298,9 @@ public class KineticBoundaryTest extends IntegrationTestCase {
            // ... We would rather have this test than remove it, and it is
            // undesirable for it to fail when run
            // ... against one target. So, we tolerate both cases for now.
            if (!e.getMessage().equals("IO error")
                    && !e.getMessage()
                    .equals("Kinetic Command Exception: INTERNAL_ERROR: value size exceeded max supported size. Supported size: 1048576, received size=1048577 (in bytes)")) {
                fail("The error observed matches neither the expected implementation of the drive nor simulator. "
                        + e.toString());
            }
            StatusCode code = e.getResponseMessage().getMessage().getCommand().getStatus().getCode();
            
            assertEquals (StatusCode.INVALID_REQUEST, code);
        }
    }