本文整理汇总了Java中com.blackducksoftware.integration.hub.rest.RestConnection类的典型用法代码示例。如果您正苦于以下问题:Java RestConnection类的具体用法?Java RestConnection怎么用?Java RestConnection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RestConnection类属于com.blackducksoftware.integration.hub.rest包,在下文中一共展示了RestConnection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testUpdate
import com.blackducksoftware.integration.hub.rest.RestConnection; //导入依赖的package包/类
@Test
public void testUpdate() throws Exception {
final StatusMock status = new StatusMock();
status.setName(STATUS_NAME);
final ApplicationUserMock assignee = new ApplicationUserMock();
assignee.setName(ASSIGNEE_USER_NAME);
final Issue issue = createIssue(new Long(1), JIRA_PROJECT_ID, JIRA_PROJECT_NAME, status, assignee);
issueHandler.updateHubIssue(ISSUE_URL, issue);
assertFalse(issueServiceMock.issueMap.isEmpty());
final IssueView hubIssue = issueServiceMock.issueMap.get(ISSUE_URL);
final SimpleDateFormat dateFormatter = new SimpleDateFormat(RestConnection.JSON_DATE_FORMAT);
dateFormatter.setTimeZone(TimeZone.getTimeZone("UTC"));
final String expectedCreatedAt = dateFormatter.format(issue.getCreated());
final String expectedUpdatedAt = dateFormatter.format(issue.getUpdated());
assertEquals(issue.getKey(), hubIssue.issueId);
assertEquals(issue.getDescription(), hubIssue.issueDescription);
assertEquals(issue.getStatus().getName(), hubIssue.issueStatus);
assertEquals(expectedCreatedAt, hubIssue.issueCreatedAt);
assertEquals(expectedUpdatedAt, hubIssue.issueUpdatedAt);
assertEquals(issue.getAssignee().getDisplayName(), hubIssue.issueAssignee);
}
开发者ID:blackducksoftware,项目名称:hub-jira,代码行数:27,代码来源:HubIssueTrackerHandlerTest.java
示例2: createDateRange
import com.blackducksoftware.integration.hub.rest.RestConnection; //导入依赖的package包/类
public DateRange createDateRange() {
final Date endDate = new Date();
Date startDate = endDate;
try {
final File lastRunFile = new File(lastRunPath);
if (lastRunFile.exists()) {
final String lastRunValue = FileUtils.readFileToString(lastRunFile, "UTF-8");
startDate = RestConnection.parseDateString(lastRunValue);
startDate = new Date(startDate.getTime());
} else {
startDate = endDate;
}
FileUtils.write(lastRunFile, RestConnection.formatDate(endDate), "UTF-8");
} catch (final Exception e) {
logger.error("Error creating date range", e);
}
return new DateRange(startDate, endDate);
}
开发者ID:blackducksoftware,项目名称:hub-email-extension,代码行数:19,代码来源:IntervalNotifier.java
示例3: HubJiraTask
import com.blackducksoftware.integration.hub.rest.RestConnection; //导入依赖的package包/类
public HubJiraTask(final PluginConfigurationDetails configDetails, final JiraContext jiraContext, final JiraSettingsService jiraSettingsService,
final TicketInfoFromSetup ticketInfoFromSetup) {
this.pluginConfigDetails = configDetails;
this.jiraContext = jiraContext;
this.runDate = new Date();
dateFormatter = new SimpleDateFormat(RestConnection.JSON_DATE_FORMAT);
dateFormatter.setTimeZone(java.util.TimeZone.getTimeZone("Zulu"));
this.runDateString = dateFormatter.format(runDate);
logger.debug("Install date: " + configDetails.getInstallDateString());
logger.debug("Last run date: " + configDetails.getLastRunDateString());
this.jiraSettingsService = jiraSettingsService;
this.ticketInfoFromSetup = ticketInfoFromSetup;
this.fieldCopyMappingJson = configDetails.getFieldCopyMappingJson();
logger.debug("createVulnerabilityIssues: " + configDetails.isCreateVulnerabilityIssues());
}
开发者ID:blackducksoftware,项目名称:hub-jira,代码行数:19,代码来源:HubJiraTask.java
示例4: assertIssueCreated
import com.blackducksoftware.integration.hub.rest.RestConnection; //导入依赖的package包/类
private void assertIssueCreated(final Long eventTypeId) {
final Issue issue = createValidIssue();
final IssueEvent event = createIssueEvent(issue, eventTypeId);
listener.onIssueEvent(event);
assertFalse(issueServiceMock.issueMap.isEmpty());
final IssueView hubIssue = issueServiceMock.issueMap.get(ISSUE_URL);
final SimpleDateFormat dateFormatter = new SimpleDateFormat(RestConnection.JSON_DATE_FORMAT);
dateFormatter.setTimeZone(TimeZone.getTimeZone("UTC"));
final String expectedCreatedAt = dateFormatter.format(issue.getCreated());
final String expectedUpdatedAt = dateFormatter.format(issue.getUpdated());
assertEquals(issue.getKey(), hubIssue.issueId);
assertEquals(issue.getDescription(), hubIssue.issueDescription);
assertEquals(issue.getStatus().getName(), hubIssue.issueStatus);
assertEquals(expectedCreatedAt, hubIssue.issueCreatedAt);
assertEquals(expectedUpdatedAt, hubIssue.issueUpdatedAt);
assertEquals(issue.getAssignee().getDisplayName(), hubIssue.issueAssignee);
}
开发者ID:blackducksoftware,项目名称:hub-jira,代码行数:22,代码来源:IssueEventListenerTest.java
示例5: testCreate
import com.blackducksoftware.integration.hub.rest.RestConnection; //导入依赖的package包/类
@Test
public void testCreate() throws Exception {
final StatusMock status = new StatusMock();
status.setName(STATUS_NAME);
final ApplicationUserMock assignee = new ApplicationUserMock();
assignee.setName(ASSIGNEE_USER_NAME);
final Issue issue = createIssue(new Long(1), JIRA_PROJECT_ID, JIRA_PROJECT_NAME, status, assignee);
issueHandler.createHubIssue(ISSUE_URL, issue);
assertFalse(issueServiceMock.issueMap.isEmpty());
final IssueView hubIssue = issueServiceMock.issueMap.get(ISSUE_URL);
final SimpleDateFormat dateFormatter = new SimpleDateFormat(RestConnection.JSON_DATE_FORMAT);
dateFormatter.setTimeZone(TimeZone.getTimeZone("UTC"));
final String expectedCreatedAt = dateFormatter.format(issue.getCreated());
final String expectedUpdatedAt = dateFormatter.format(issue.getUpdated());
assertEquals(issue.getKey(), hubIssue.issueId);
assertEquals(issue.getDescription(), hubIssue.issueDescription);
assertEquals(issue.getStatus().getName(), hubIssue.issueStatus);
assertEquals(expectedCreatedAt, hubIssue.issueCreatedAt);
assertEquals(expectedUpdatedAt, hubIssue.issueUpdatedAt);
assertEquals(issue.getAssignee().getDisplayName(), hubIssue.issueAssignee);
}
开发者ID:blackducksoftware,项目名称:hub-jira,代码行数:27,代码来源:HubIssueTrackerHandlerTest.java
示例6: testDelete
import com.blackducksoftware.integration.hub.rest.RestConnection; //导入依赖的package包/类
@Test
public void testDelete() throws Exception {
final StatusMock status = new StatusMock();
status.setName(STATUS_NAME);
final ApplicationUserMock assignee = new ApplicationUserMock();
assignee.setName(ASSIGNEE_USER_NAME);
final Issue issue = createIssue(new Long(1), JIRA_PROJECT_ID, JIRA_PROJECT_NAME, status, assignee);
final SimpleDateFormat dateFormatter = new SimpleDateFormat(RestConnection.JSON_DATE_FORMAT);
dateFormatter.setTimeZone(TimeZone.getTimeZone("UTC"));
final String expectedCreatedAt = dateFormatter.format(issue.getCreated());
final String expectedUpdatedAt = dateFormatter.format(issue.getUpdated());
final IssueView hubIssue = new IssueView();
hubIssue.issueId = issue.getKey();
hubIssue.issueDescription = issue.getDescription();
hubIssue.issueStatus = issue.getStatus().getName();
hubIssue.issueCreatedAt = expectedCreatedAt;
hubIssue.issueUpdatedAt = expectedUpdatedAt;
hubIssue.issueAssignee = issue.getAssignee().getDisplayName();
issueServiceMock.issueMap.put(ISSUE_URL, hubIssue);
issueHandler.deleteHubIssue(ISSUE_URL, issue);
assertTrue(issueServiceMock.issueMap.isEmpty());
}
开发者ID:blackducksoftware,项目名称:hub-jira,代码行数:26,代码来源:HubIssueTrackerHandlerTest.java
示例7: testDeleteEmptyURL
import com.blackducksoftware.integration.hub.rest.RestConnection; //导入依赖的package包/类
@Test
public void testDeleteEmptyURL() throws Exception {
final StatusMock status = new StatusMock();
status.setName(STATUS_NAME);
final ApplicationUserMock assignee = new ApplicationUserMock();
assignee.setName(ASSIGNEE_USER_NAME);
final Issue issue = createIssue(new Long(1), JIRA_PROJECT_ID, JIRA_PROJECT_NAME, status, assignee);
final SimpleDateFormat dateFormatter = new SimpleDateFormat(RestConnection.JSON_DATE_FORMAT);
dateFormatter.setTimeZone(TimeZone.getTimeZone("UTC"));
final String expectedCreatedAt = dateFormatter.format(issue.getCreated());
final String expectedUpdatedAt = dateFormatter.format(issue.getUpdated());
final IssueView hubIssue = new IssueView();
hubIssue.issueId = issue.getKey();
hubIssue.issueDescription = issue.getDescription();
hubIssue.issueStatus = issue.getStatus().getName();
hubIssue.issueCreatedAt = expectedCreatedAt;
hubIssue.issueUpdatedAt = expectedUpdatedAt;
hubIssue.issueAssignee = issue.getAssignee().getDisplayName();
issueServiceMock.issueMap.put(ISSUE_URL, hubIssue);
issueHandler.deleteHubIssue("", issue);
assertFalse(issueServiceMock.issueMap.isEmpty());
assertNotNull(settings.get(HubJiraConstants.HUB_JIRA_ERROR));
}
开发者ID:blackducksoftware,项目名称:hub-jira,代码行数:27,代码来源:HubIssueTrackerHandlerTest.java
示例8: createHubServicesFactory
import com.blackducksoftware.integration.hub.rest.RestConnection; //导入依赖的package包/类
/**
* Create the Hub Services factory based on logger
*
* @param logger
* @return
*/
private static HubServicesFactory createHubServicesFactory(final IntLogger logger, final PropertyConstants propertyConstants) {
final RestConnection restConnection = getApplicationPropertyRestConnection(propertyConstants);
restConnection.logger = logger;
// Adjust the number of connections in the connection pool. The keepAlive info is the same as the default
// constructor
restConnection.builder.connectionPool(new ConnectionPool(propertyConstants.getMaximumThreadSize(), 5, TimeUnit.MINUTES));
final HubServicesFactory hubServicesFactory = new HubServicesFactory(restConnection);
return hubServicesFactory;
}
开发者ID:blackducksoftware,项目名称:hub-fortify-ssc-integration-service,代码行数:16,代码来源:RestConnectionHelper.java
示例9: initRestConnection
import com.blackducksoftware.integration.hub.rest.RestConnection; //导入依赖的package包/类
public RestConnection initRestConnection(final String hubUri) {
final IntLogger extLogger = new ExtensionLogger(logger);
final OAuthRestConnectionBuilder builder = new OAuthRestConnectionBuilder();
builder.setLogger(extLogger);
builder.setBaseUrl(hubServerConfig.getHubUrl().toString());
builder.setTimeout(hubServerConfig.getTimeout());
builder.setTokenManager(tokenManager);
builder.setAccessType(AccessType.USER);
builder.setAlwaysTrustServerCertificate(alwaysTrustServerCertificate);
final RestConnection restConnection = builder.build();
return restConnection;
}
开发者ID:blackducksoftware,项目名称:hub-email-extension,代码行数:13,代码来源:EmailEngine.java
示例10: createRestConnection
import com.blackducksoftware.integration.hub.rest.RestConnection; //导入依赖的package包/类
@Override
public RestConnection createRestConnection(final String hubUri) {
try {
return new MockRestConnection(new MockLogger(), new URL(hubUri));
} catch (final MalformedURLException e) {
throw new RuntimeException(e);
}
}
开发者ID:blackducksoftware,项目名称:hub-email-extension,代码行数:9,代码来源:TestEmailEngine.java
示例11: init
import com.blackducksoftware.integration.hub.rest.RestConnection; //导入依赖的package包/类
@Before
public void init() throws Exception {
final RestConnection restConnection = new MockRestConnection(new IntBufferedLogger(), null);
final HubServicesFactory factory = new HubServicesFactory(restConnection);
metaService = factory.createMetaService();
gson = restConnection.gson;
}
开发者ID:blackducksoftware,项目名称:hub-email-extension,代码行数:8,代码来源:NotificationCapacityTest.java
示例12: createHubServicesFactory
import com.blackducksoftware.integration.hub.rest.RestConnection; //导入依赖的package包/类
private HubServicesFactory createHubServicesFactory(final PluginSettings settings, final HubJiraConfigSerializable config) {
final RestConnection restConnection = createRestConnection(settings, config);
if (config.hasErrors()) {
return null;
}
final HubServicesFactory hubServicesFactory = new HubServicesFactory(restConnection);
return hubServicesFactory;
}
开发者ID:blackducksoftware,项目名称:hub-jira,代码行数:9,代码来源:HubJiraConfigController.java
示例13: HubIssueTrackerHandler
import com.blackducksoftware.integration.hub.rest.RestConnection; //导入依赖的package包/类
public HubIssueTrackerHandler(final JiraServices jiraServices, final JiraSettingsService jiraSettingsService, final BomComponentIssueRequestService issueRequestService) {
this.jiraServices = jiraServices;
this.jiraSettingsService = jiraSettingsService;
this.issueRequestService = issueRequestService;
dateFormatter = new SimpleDateFormat(RestConnection.JSON_DATE_FORMAT);
dateFormatter.setTimeZone(TimeZone.getTimeZone("UTC"));
}
开发者ID:blackducksoftware,项目名称:hub-jira,代码行数:9,代码来源:HubIssueTrackerHandler.java
示例14: createHubServicesFactory
import com.blackducksoftware.integration.hub.rest.RestConnection; //导入依赖的package包/类
private HubServicesFactory createHubServicesFactory(final HubServerConfig hubServerConfig) throws EncryptionException {
final RestConnection restConnection = new CredentialsRestConnection(logger, hubServerConfig.getHubUrl(),
hubServerConfig.getGlobalCredentials().getUsername(), hubServerConfig.getGlobalCredentials().getDecryptedPassword(),
hubServerConfig.getTimeout());
final HubServicesFactory hubServicesFactory = new HubServicesFactory(restConnection);
return hubServicesFactory;
}
开发者ID:blackducksoftware,项目名称:hub-jira,代码行数:8,代码来源:HubJiraTask.java
示例15: initTest
import com.blackducksoftware.integration.hub.rest.RestConnection; //导入依赖的package包/类
@Before
public void initTest() throws MalformedURLException {
settings = createPluginSettings();
pluginSettingsFactory = new PluginSettingsFactoryMock(settings);
jiraServices = new JiraServicesMock();
jiraServices.setJsonEntityPropertyManager(new JSonEntityPropertyManagerMock());
final UserManagerMock userManager = new UserManagerMock();
userManager.setMockApplicationUser(createApplicationUser());
jiraServices.setUserManager(userManager);
final URL url = new URL("http://www.google.com");
final RestConnection restConnection = new CredentialsRestConnection(Mockito.mock(HubJiraLogger.class), url, "", "", 120);
issueServiceMock = new BomComponentIssueServiceMock(restConnection);
versionRequestServiceMock = new HubVersionRequestServiceMock(restConnection);
final VersionComparison versionComparison = new VersionComparison();
versionComparison.consumerVersion = "3.7.0";
versionComparison.producerVersion = "3.7.0";
versionComparison.numericResult = 0;
versionComparison.operatorResult = "=";
versionRequestServiceMock.setHubVersionComparison(versionComparison);
final HubServicesFactory hubServicesFactory = Mockito.mock(HubServicesFactory.class);
Mockito.when(hubServicesFactory.createBomComponentIssueRequestService()).thenReturn(issueServiceMock);
Mockito.when(hubServicesFactory.createHubVersionRequestService()).thenReturn(versionRequestServiceMock);
final ApplicationUser jiraUser = Mockito.mock(ApplicationUser.class);
Mockito.when(jiraUser.getName()).thenReturn(JIRA_USER);
listener = new IssueListenerWithMocks(eventPublisher, pluginSettingsFactory, jiraServices, hubServicesFactory);
}
开发者ID:blackducksoftware,项目名称:hub-jira,代码行数:29,代码来源:IssueEventListenerTest.java
示例16: testDeleteEventWithEntityProperty
import com.blackducksoftware.integration.hub.rest.RestConnection; //导入依赖的package包/类
@Test
public void testDeleteEventWithEntityProperty() {
populateProjectSettings();
createEntityProperty();
final StatusMock status = new StatusMock();
status.setName(STATUS_NAME);
final ApplicationUserMock assignee = new ApplicationUserMock();
assignee.setName(ASSIGNEE_USER_NAME);
final Issue issue = createIssue(new Long(1), JIRA_PROJECT_ID, JIRA_PROJECT_NAME, status, assignee);
final IssueEvent event = createIssueEvent(issue, EventType.ISSUE_DELETED_ID);
final SimpleDateFormat dateFormatter = new SimpleDateFormat(RestConnection.JSON_DATE_FORMAT);
dateFormatter.setTimeZone(TimeZone.getTimeZone("UTC"));
final String expectedCreatedAt = dateFormatter.format(issue.getCreated());
final String expectedUpdatedAt = dateFormatter.format(issue.getUpdated());
final IssueView hubIssue = new IssueView();
hubIssue.issueId = issue.getKey();
hubIssue.issueDescription = issue.getDescription();
hubIssue.issueStatus = issue.getStatus().getName();
hubIssue.issueCreatedAt = expectedCreatedAt;
hubIssue.issueUpdatedAt = expectedUpdatedAt;
hubIssue.issueAssignee = issue.getAssignee().getDisplayName();
issueServiceMock.issueMap.put(ISSUE_URL, hubIssue);
listener.onIssueEvent(event);
assertTrue(issueServiceMock.issueMap.isEmpty());
}
开发者ID:blackducksoftware,项目名称:hub-jira,代码行数:30,代码来源:IssueEventListenerTest.java
示例17: initTest
import com.blackducksoftware.integration.hub.rest.RestConnection; //导入依赖的package包/类
@Before
public void initTest() throws Exception {
settings = new PluginSettingsMock();
final URL url = new URL("http://www.google.com");
final RestConnection restConnection = new CredentialsRestConnection(Mockito.mock(HubJiraLogger.class), url, "", "", 120);
issueServiceMock = new BomComponentIssueServiceMock(restConnection);
issueHandler = new HubIssueTrackerHandler(new JiraServicesMock(), new JiraSettingsService(settings), issueServiceMock);
}
开发者ID:blackducksoftware,项目名称:hub-jira,代码行数:10,代码来源:HubIssueTrackerHandlerTest.java
示例18: getRestConnection
import com.blackducksoftware.integration.hub.rest.RestConnection; //导入依赖的package包/类
public RestConnection getRestConnection() {
return restConnection;
}
开发者ID:blackducksoftware,项目名称:hub-email-extension,代码行数:4,代码来源:EmailEngine.java
示例19: createNotificationDateFormat
import com.blackducksoftware.integration.hub.rest.RestConnection; //导入依赖的package包/类
public DateFormat createNotificationDateFormat() {
final DateFormat dateFormat = new SimpleDateFormat(RestConnection.JSON_DATE_FORMAT);
dateFormat.setTimeZone(java.util.TimeZone.getTimeZone("Zulu"));
return dateFormat;
}
开发者ID:blackducksoftware,项目名称:hub-email-extension,代码行数:6,代码来源:EmailEngine.java
示例20: createRestConnection
import com.blackducksoftware.integration.hub.rest.RestConnection; //导入依赖的package包/类
public RestConnection createRestConnection(final String hubUri) {
final RestConnection restConnection = initRestConnection(hubUri);
return restConnection;
}
开发者ID:blackducksoftware,项目名称:hub-email-extension,代码行数:5,代码来源:EmailEngine.java
注:本文中的com.blackducksoftware.integration.hub.rest.RestConnection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论