use of io.codekvast.javaagent.model.v2.CommonPublicationData2 in project codekvast by crispab.
the class ImportDAOImpl method ensureInitialInvocations.
private void ensureInitialInvocations(CommonPublicationData2 data, long customerId, long appId, long environmentId, long jvmId, Collection<CodeBaseEntry2> entries, Map<String, Long> existingMethods, Set<Long> existingInvocations) {
long startedAtMillis = System.currentTimeMillis();
int importCount = 0;
for (CodeBaseEntry2 entry : entries) {
long methodId = existingMethods.get(entry.getSignature());
if (!existingInvocations.contains(methodId)) {
SignatureStatus2 initialStatus = calculateInitialStatus(data, entry);
jdbcTemplate.update(new InsertInvocationStatement(customerId, appId, environmentId, jvmId, methodId, initialStatus, 0L, 0L));
existingInvocations.add(methodId);
importCount += 1;
}
}
logger.debug("Imported {} invocations in {} ms", importCount, System.currentTimeMillis() - startedAtMillis);
}
use of io.codekvast.javaagent.model.v2.CommonPublicationData2 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()));
}
use of io.codekvast.javaagent.model.v2.CommonPublicationData2 in project codekvast by crispab.
the class CommonPublicationData2Test method should_transform_from_v1_format.
@SuppressWarnings("deprecation")
@Test
public void should_transform_from_v1_format() {
CommonPublicationData cd1 = CommonPublicationData.sampleCommonPublicationData();
CommonPublicationData2 cd2 = CommonPublicationData2.sampleCommonPublicationData();
assertThat(CommonPublicationData2.fromV1format(cd1), is(cd2));
}
use of io.codekvast.javaagent.model.v2.CommonPublicationData2 in project codekvast by crispab.
the class InvocationDataImporterImpl method importPublication.
@Override
@Transactional(rollbackFor = Exception.class)
public boolean importPublication(InvocationDataPublication2 publication) {
logger.info("Importing {}", publication);
CommonPublicationData2 commonData = publication.getCommonData();
long customerId = commonData.getCustomerId();
long appId = importDAO.importApplication(commonData);
long environmentId = importDAO.importEnvironment(commonData);
long jvmId = importDAO.importJvm(commonData, appId, environmentId);
importDAO.importInvocations(customerId, appId, environmentId, jvmId, publication.getRecordingIntervalStartedAtMillis(), new TreeSet<>(publication.getInvocations()));
return true;
}
Aggregations