@Test public void should_save_uploaded_invocations() throws Exception { String contents = "Dummy Invocations Publication"; File resultingFile = service.savePublication( PublicationType.INVOCATIONS, "key", "fingerprint", 1000, new ByteArrayInputStream(contents.getBytes())); assertThat(resultingFile, notNullValue()); assertThat(resultingFile.getName(), startsWith("invocations-")); assertThat(resultingFile.getName(), endsWith(".ser")); assertThat(resultingFile.exists(), is(true)); assertThat(resultingFile.length(), is((long) contents.length())); }
@Override @Transactional(readOnly = true) public File savePublication( @NonNull PublicationType publicationType, @NonNull String licenseKey, String codebaseFingerprint, int publicationSize, InputStream inputStream) throws LicenseViolationException, IOException { try (inputStream) { CustomerData customerData = customerService.getCustomerDataByLicenseKey(licenseKey); if (publicationType == PublicationType.CODEBASE) { customerService.assertPublicationSize(customerData, publicationSize); } return doSaveInputStream( publicationType, customerData.getCustomerId(), codebaseFingerprint, inputStream); } }
AgentServiceImpl implements AgentService { @Override @Transactional(readOnly = true) public File savePublication( @NonNull PublicationType publicationType, @NonNull String licenseKey, String codebaseFingerprint, int publicationSize, InputStream inputStream) throws LicenseViolationException, IOException { try (inputStream) { CustomerData customerData = customerService.getCustomerDataByLicenseKey(licenseKey); if (publicationType == PublicationType.CODEBASE) { customerService.assertPublicationSize(customerData, publicationSize); } return doSaveInputStream( publicationType, customerData.getCustomerId(), codebaseFingerprint, inputStream); } } }
AgentServiceImpl implements AgentService { @Override @Transactional(readOnly = true) public File savePublication( @NonNull PublicationType publicationType, @NonNull String licenseKey, String codebaseFingerprint, int publicationSize, InputStream inputStream) throws LicenseViolationException, IOException { try (inputStream) { CustomerData customerData = customerService.getCustomerDataByLicenseKey(licenseKey); if (publicationType == PublicationType.CODEBASE) { customerService.assertPublicationSize(customerData, publicationSize); } return doSaveInputStream( publicationType, customerData.getCustomerId(), codebaseFingerprint, inputStream); } }  }
AgentServiceImpl implements AgentService { @Override @Transactional(readOnly = true) public File savePublication( @NonNull PublicationType publicationType, @NonNull String licenseKey, String codebaseFingerprint, int publicationSize, InputStream inputStream) throws LicenseViolationException, IOException { try (inputStream) { CustomerData customerData = customerService.getCustomerDataByLicenseKey(licenseKey); if (publicationType == PublicationType.CODEBASE) { customerService.assertPublicationSize(customerData, publicationSize); } return doSaveInputStream( publicationType, customerData.getCustomerId(), codebaseFingerprint, inputStream); } }  @Override @Transactional @Restartable GetConfigResponse1 getConfig(GetConfigRequest1 request); @Override @Transactional @Restartable GetConfigResponse2 getConfig(GetConfigRequest2 request); @Override @Transactional(readOnly = true) File savePublication(
      @NonNull PublicationType publicationType,
      @NonNull String licenseKey,
      String codebaseFingerprint,
      int publicationSize,
      InputStream inputStream); @Override File generatePublicationFile(
      PublicationType publicationType, Long customerId, String correlationId); @Override PublicationType getPublicationTypeFromPublicationFile(File publicationFile); @Override String getCorrelationIdFromPublicationFile(File publicationFile); }
AgentServiceImpl implements AgentService { @Override @Transactional(readOnly = true) public File savePublication( @NonNull PublicationType publicationType, @NonNull String licenseKey, String codebaseFingerprint, int publicationSize, InputStream inputStream) throws LicenseViolationException, IOException { try (inputStream) { CustomerData customerData = customerService.getCustomerDataByLicenseKey(licenseKey); if (publicationType == PublicationType.CODEBASE) { customerService.assertPublicationSize(customerData, publicationSize); } return doSaveInputStream( publicationType, customerData.getCustomerId(), codebaseFingerprint, inputStream); } }  @Override @Transactional @Restartable GetConfigResponse1 getConfig(GetConfigRequest1 request); @Override @Transactional @Restartable GetConfigResponse2 getConfig(GetConfigRequest2 request); @Override @Transactional(readOnly = true) File savePublication(
      @NonNull PublicationType publicationType,
      @NonNull String licenseKey,
      String codebaseFingerprint,
      int publicationSize,
      InputStream inputStream); @Override File generatePublicationFile(
      PublicationType publicationType, Long customerId, String correlationId); @Override PublicationType getPublicationTypeFromPublicationFile(File publicationFile); @Override String getCorrelationIdFromPublicationFile(File publicationFile); static final String UNKNOWN_ENVIRONMENT; static final Pattern CORRELATION_ID_PATTERN; }