Search in sources :

Example 6 with CodeBasePublication3

use of io.codekvast.javaagent.model.v3.CodeBasePublication3 in project codekvast by crispab.

the class HttpCodeBasePublisherImpl method doPublishCodeBase.

@Override
public void doPublishCodeBase(CodeBase codeBase) throws CodekvastPublishingException {
    String url = getConfig().getCodeBaseUploadEndpoint();
    File file = null;
    try {
        CodeBasePublication3 publication = codeBase.getCodeBasePublication(getCustomerId(), this.getSequenceNumber());
        file = FileUtils.serializeToFile(publication, getConfig().getFilenamePrefix("codebase-"), ".ser");
        doPost(file, url, codeBase.getFingerprint().toString(), publication.getEntries().size());
        logger.fine(String.format("Codekvast uploaded %d methods (%s) to %s", publication.getEntries().size(), LogUtil.humanReadableByteCount(file.length()), url));
    } catch (IOException e) {
        throw new CodekvastPublishingException("Cannot upload code base to " + url, e);
    } finally {
        FileUtils.safeDelete(file);
    }
}
Also used : CodeBasePublication3(io.codekvast.javaagent.model.v3.CodeBasePublication3) IOException(java.io.IOException) CodekvastPublishingException(io.codekvast.javaagent.publishing.CodekvastPublishingException) File(java.io.File)

Aggregations

CodeBasePublication3 (io.codekvast.javaagent.model.v3.CodeBasePublication3)6 CodeBaseEntry3 (io.codekvast.javaagent.model.v3.CodeBaseEntry3)5 Test (org.junit.Test)5 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)5 CommonPublicationData2 (io.codekvast.javaagent.model.v2.CommonPublicationData2)2 InvocationDataPublication2 (io.codekvast.javaagent.model.v2.InvocationDataPublication2)2 CodekvastPublishingException (io.codekvast.javaagent.publishing.CodekvastPublishingException)1 File (java.io.File)1 IOException (java.io.IOException)1 lombok.val (lombok.val)1