use of org.springframework.test.context.jdbc.Sql in project codekvast by crispab.
the class MariadbIntegrationTest method should_getConfig_for_disabled_agent.
@Test
@Sql(scripts = "/sql/base-data.sql")
public void should_getConfig_for_disabled_agent() {
// given
new Timestamps().invoke();
// when
GetConfigResponse1 response = agentService.getConfig(GetConfigRequest1.sample().toBuilder().jvmUuid("uuid2").licenseKey("").startedAtMillis(Instant.now().minus(2, HOURS).toEpochMilli()).build());
// then
assertConfigPollResponse(response, "enabled=false");
assertAgentEnabled("uuid1", TRUE);
assertAgentEnabled("uuid2", FALSE);
assertAgentEnabled("uuid3", FALSE);
assertAgentEnabled("uuid4", FALSE);
}
use of org.springframework.test.context.jdbc.Sql in project codekvast by crispab.
the class MariadbIntegrationTest method should_accept_valid_getCustomerDataByExternalId_without_pricePlanOverride.
@Test
@Sql(scripts = "/sql/base-data.sql")
public void should_accept_valid_getCustomerDataByExternalId_without_pricePlanOverride() {
CustomerData customerData = customerService.getCustomerDataByExternalId("external-2");
assertThat(customerData.getCustomerId(), is(2L));
assertThat(customerData.getPricePlan().getOverrideBy(), nullValue());
assertThat(customerData.isTrialPeriodExpired(Instant.now()), is(false));
}
use of org.springframework.test.context.jdbc.Sql in project commons-dao by reportportal.
the class AttachmentCommonDataStoreServiceTest method AttachFileToExistingLogTest.
@Test
@Sql("/db/fill/data-store/data-store-fill.sql")
void AttachFileToExistingLogTest() {
String fileID = "fileID";
String thumbnailID = "thumbnailID";
String contentType = "content-type";
long fileSize = 1024;
final LocalDateTime creationDate = LocalDateTime.of(2020, Month.JANUARY, 1, 1, 1);
BinaryDataMetaInfo binaryDataMetaInfo = new BinaryDataMetaInfo();
binaryDataMetaInfo.setFileId(fileID);
binaryDataMetaInfo.setThumbnailFileId(thumbnailID);
binaryDataMetaInfo.setContentType(contentType);
binaryDataMetaInfo.setFileSize(fileSize);
Long projectId = 1L;
Long itemId = 1L;
AttachmentMetaInfo attachmentMetaInfo = AttachmentMetaInfo.builder().withProjectId(projectId).withLaunchId(1L).withItemId(itemId).withLogId(1L).withCreationDate(creationDate).build();
attachmentBinaryDataService.attachToLog(binaryDataMetaInfo, attachmentMetaInfo);
Optional<Attachment> attachment = attachmentRepository.findByFileId(fileID);
assertTrue(attachment.isPresent());
assertEquals(projectId, attachment.get().getProjectId());
assertEquals(itemId, attachment.get().getItemId());
assertEquals(fileID, attachment.get().getFileId());
assertEquals(thumbnailID, attachment.get().getThumbnailId());
assertEquals(contentType, attachment.get().getContentType());
assertEquals(fileSize, attachment.get().getFileSize());
assertEquals(creationDate, attachment.get().getCreationDate());
}
use of org.springframework.test.context.jdbc.Sql in project commons-dao by reportportal.
the class LogRepositoryTest method findLogMessagesByItemIdAndLogLevelNestedTest.
@Sql("/db/fill/item/items-with-nested-steps.sql")
@Test
void findLogMessagesByItemIdAndLogLevelNestedTest() {
TestItem testItem = testItemRepository.findById(132L).get();
List<String> messagesByItemIdAndLevelGte = logRepository.findMessagesByLaunchIdAndItemIdAndPathAndLevelGte(testItem.getLaunchId(), testItem.getItemId(), testItem.getPath(), LogLevel.ERROR.toInt());
assertTrue(CollectionUtils.isNotEmpty(messagesByItemIdAndLevelGte));
assertEquals(1, messagesByItemIdAndLevelGte.size());
assertEquals("java.lang.NullPointerException: Oops\n" + "\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n" + "\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n" + "\tat java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n" + "\tat java.base/java.lang.reflect.Method.invoke(Method.java:566)\n", messagesByItemIdAndLevelGte.get(0));
}
use of org.springframework.test.context.jdbc.Sql in project apollo by ctripcorp.
the class NamespaceBranchServiceTest method testFindBranch.
@Test
@Sql(scripts = "/sql/namespace-branch-test.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/sql/clean.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testFindBranch() {
Namespace branch = namespaceBranchService.findBranch(testApp, testCluster, testNamespace);
Assert.assertNotNull(branch);
Assert.assertEquals(testBranchName, branch.getClusterName());
}
Aggregations