Search in sources :

Example 1 with CodeBasePublication

use of io.codekvast.javaagent.model.v1.CodeBasePublication in project codekvast by crispab.

the class MariadbIntegrationTest method should_import_codeBasePublication1.

@SuppressWarnings("deprecation")
@Test
public void should_import_codeBasePublication1() {
    // @formatter:off
    CodeBasePublication publication = CodeBasePublication.builder().commonData(CommonPublicationData.sampleCommonPublicationData()).entries(Arrays.asList(CodeBaseEntry.sampleCodeBaseEntry())).overriddenSignatures(Collections.singletonMap("signature", "overriddenBySignature")).strangeSignatures(Collections.singletonMap("rawStrangeSignature", "normalizedStrangeSignature")).build();
    // @formatter:on
    codeBaseImporter.importPublication(CodeBasePublication2.fromV1Format(publication));
}
Also used : CodeBasePublication(io.codekvast.javaagent.model.v1.CodeBasePublication) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 2 with CodeBasePublication

use of io.codekvast.javaagent.model.v1.CodeBasePublication in project codekvast by crispab.

the class CodeBasePublication2Test method should_transform_from_v1_format.

@SuppressWarnings("deprecation")
@Test
public void should_transform_from_v1_format() {
    CodeBasePublication pub1 = CodeBasePublication.builder().commonData(CommonPublicationData.sampleCommonPublicationData()).entries(Collections.singletonList(CodeBaseEntry.sampleCodeBaseEntry())).overriddenSignatures(Collections.singletonMap("key1", "value1")).strangeSignatures(Collections.singletonMap("key2", "value2")).build();
    CodeBasePublication2 pub2 = CodeBasePublication2.fromV1Format(pub1);
    assertThat(pub2.getCommonData(), is(CommonPublicationData2.sampleCommonPublicationData()));
    assertThat(pub2.getEntries(), hasItems(CodeBaseEntry2.sampleCodeBaseEntry()));
}
Also used : CodeBasePublication2(io.codekvast.javaagent.model.v2.CodeBasePublication2) CodeBasePublication(io.codekvast.javaagent.model.v1.CodeBasePublication) Test(org.junit.Test)

Example 3 with CodeBasePublication

use of io.codekvast.javaagent.model.v1.CodeBasePublication in project codekvast by crispab.

the class PublicationV1DeserializationTest method should_deserialize_codebaseV1_file.

@Test
public void should_deserialize_codebaseV1_file() throws IOException, ClassNotFoundException {
    ObjectInputStream ois = new ObjectInputStream(new BufferedInputStream(getClass().getResourceAsStream(CODEBASE_RESOURCE)));
    CodeBasePublication publication = (CodeBasePublication) ois.readObject();
    assertThat(publication, isA(CodeBasePublication.class));
}
Also used : BufferedInputStream(java.io.BufferedInputStream) CodeBasePublication(io.codekvast.javaagent.model.v1.CodeBasePublication) ObjectInputStream(java.io.ObjectInputStream) Test(org.junit.Test)

Aggregations

CodeBasePublication (io.codekvast.javaagent.model.v1.CodeBasePublication)3 Test (org.junit.Test)2 CodeBasePublication2 (io.codekvast.javaagent.model.v2.CodeBasePublication2)1 BufferedInputStream (java.io.BufferedInputStream)1 ObjectInputStream (java.io.ObjectInputStream)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1