All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.hyperfoil.api.config.BenchmarkData Maven / Gradle / Ivy

There is a newer version: 0.27
Show newest version
package io.hyperfoil.api.config;

import java.io.File;
import java.io.InputStream;
import java.util.Collections;
import java.util.Map;

public interface BenchmarkData {
   BenchmarkData EMPTY = new BenchmarkData() {
      @Override
      public InputStream readFile(String file) {
         throw new MissingFileException(file, "Cannot load file " + file + " (file set is empty).", null);
      }

      @Override
      public Map files() {
         return Collections.emptyMap();
      }
   };

   static String sanitize(String file) {
      return file.replace(File.separatorChar, '_').replace(File.pathSeparatorChar, '_');
   }

   InputStream readFile(String file);

   Map files();

   class MissingFileException extends RuntimeException {
      public final String file;

      public MissingFileException(String file) {
         this.file = file;
      }

      public MissingFileException(String file, String message, Throwable cause) {
         super(message, cause);
         this.file = file;
      }
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy