MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/buildpacks / jarContent

Function jarContent

pkg/java/java_test.go:408–428  ·  view source on GitHub ↗
(t *testing.T, mfContent []byte)

Source from the content-addressed store, hash-verified

406}
407
408func jarContent(t *testing.T, mfContent []byte) []byte {
409 t.Helper()
410 var buff bytes.Buffer
411 w := zip.NewWriter(&buff)
412 defer w.Close()
413 f, err := w.Create(filepath.Join("META-INF", "MANIFEST.MF"))
414 if err != nil {
415 t.Fatalf("creating zip entry: %v", err)
416 }
417 for i := 0; i < len(mfContent); {
418 n, err := f.Write(mfContent)
419 if err != nil {
420 t.Fatalf("writing bytes: %v", err)
421 }
422 i += n
423 }
424 if err := w.Close(); err != nil {
425 t.Fatalf("closing zip writer: %v", err)
426 }
427 return buff.Bytes()
428}
429
430func setupTestJar(t *testing.T, mfContent []byte) string {
431 t.Helper()

Callers 2

TestExecutableJarFunction · 0.85
setupTestJarFunction · 0.85

Calls 2

BytesMethod · 0.80
WriteMethod · 0.45

Tested by

no test coverage detected