Search in sources :

Example 1 with VirtualActionInput

use of com.google.devtools.build.lib.actions.cache.VirtualActionInput in project bazel by bazelbuild.

the class DigestTest method testFromVirtualInput.

@Test
public void testFromVirtualInput() throws Exception {
    Pair<ByteString, Long> result = Digest.fromVirtualActionInput(new VirtualActionInput() {

        @Override
        public void writeTo(OutputStream out) throws IOException {
            out.write(UGLY.getBytes(UTF_8));
        }

        @Override
        public String getExecPathString() {
            throw new UnsupportedOperationException();
        }

        @Override
        public PathFragment getExecPath() {
            throw new UnsupportedOperationException();
        }
    });
    assertEquals(UGLY_DIGEST, result.first.toStringUtf8());
    assertEquals(UGLY.length(), result.second.longValue());
}
Also used : VirtualActionInput(com.google.devtools.build.lib.actions.cache.VirtualActionInput) ByteString(com.google.protobuf.ByteString) OutputStream(java.io.OutputStream) PathFragment(com.google.devtools.build.lib.vfs.PathFragment) IOException(java.io.IOException) ByteString(com.google.protobuf.ByteString) Test(org.junit.Test)

Aggregations

VirtualActionInput (com.google.devtools.build.lib.actions.cache.VirtualActionInput)1 PathFragment (com.google.devtools.build.lib.vfs.PathFragment)1 ByteString (com.google.protobuf.ByteString)1 IOException (java.io.IOException)1 OutputStream (java.io.OutputStream)1 Test (org.junit.Test)1