本文整理汇总了Java中com.taskadapter.redmineapi.RedmineManager类的典型用法代码示例。如果您正苦于以下问题:Java RedmineManager类的具体用法?Java RedmineManager怎么用?Java RedmineManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RedmineManager类属于com.taskadapter.redmineapi包,在下文中一共展示了RedmineManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findNameFor
import com.taskadapter.redmineapi.RedmineManager; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* @see hudson.tasks.UserNameResolver#findNameFor(hudson.model.User)
*/
@Override
public String findNameFor(hudson.model.User u) {
LOGGER.info("Search username for {}", u);
RedmineManager redmineManager = getRedmineManager();
if (redmineManager == null) {
return null;
}
String userId = u.getId();
try {
return redmineManager.getUserByLogin(userId).getFullName();
} catch (RedmineException e) {
LOGGER.info("User {} not found: {}", userId, e.getMessage());
return null;
}
}
示例2: findMailAddressFor
import com.taskadapter.redmineapi.RedmineManager; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* @see hudson.tasks.MailAddressResolver#findMailAddressFor(hudson.model.User)
*/
@Override
public String findMailAddressFor(hudson.model.User u) {
RedmineManager redmineManager = getRedmineManager();
if (redmineManager == null) {
return null;
}
try {
return redmineManager.getUserByLogin(u.getId()).getMail();
} catch (RedmineException e) {
LOGGER.error("Email not found for {}", u);
return null;
}
}
示例3: createRedmineProject
import com.taskadapter.redmineapi.RedmineManager; //导入依赖的package包/类
private RedmineProject createRedmineProject(RedmineManager redmineManager) {
RedmineProject project = new RedmineProject(redmineManager);
String projectId = getProjectId();
project.setProjectId(projectId);
String currentVersion = getCurrentVersion();
project.setCurrentVersion(currentVersion);
project.addCustomFieldValue(87,"Specializace","Java Developer");
project.setScmUsername("SCM");
project.setStateNew("1");
project.setStateInProgress("4");
project.setStateResolved("6");
project.setStateClosed("7");
/* FG statuses
<option value="1">Nový</option>
<option value="2">Reakce</option>
<option value="3">Ke korektuře</option>
<option value="4" selected="selected">Přiřazený</option>
<option value="5">Schválený</option>
<option value="6">Vyřešený</option>
<option value="7">Uzavřený</option>
*/
return project;
}
示例4: lookup
import com.taskadapter.redmineapi.RedmineManager; //导入依赖的package包/类
@Override
public Object lookup(ArquillianResource resource, Annotation... qualifiers) {
final RedmineManager redmineManager = this.redmineManager.get();
if (redmineManager == null) {
throw new IllegalStateException("Redmine manager was not found.");
}
return redmineManager;
}
示例5: isRedmineConnectSuccessful
import com.taskadapter.redmineapi.RedmineManager; //导入依赖的package包/类
private boolean isRedmineConnectSuccessful() {
ui.message("Checking Redmine connectivity ... ");
try {
RedmineManager redmineManager =
new RedmineManager(redmineUrl, redmineApiKey);
redmineManager.getCurrentUser();
ui.message("[OK]\n");
return true;
} catch (RedmineException e) {
ui.message("*FAILED* (%s)\n", e.toString());
return false;
}
}
示例6: RedmineItsFacade
import com.taskadapter.redmineapi.RedmineManager; //导入依赖的package包/类
/**
* Constructor
*
* @param pluginName plugin name
* @param config gerrit configuration
*/
@Inject
public RedmineItsFacade(@PluginName String pluginName,
@GerritServerConfig Config config) {
this.pluginName = pluginName;
this.config = config;
String host = getHost();
String apiAccessKey =
config.getString(pluginName, null, GERRIT_CONFIG_API_KEY);
LOGGER.trace("Initialize redmine-its to {} host", host);
this.redmineManager = new RedmineManager(host, apiAccessKey);
}
示例7: testAddRelatedLink
import com.taskadapter.redmineapi.RedmineManager; //导入依赖的package包/类
/**
* Test of method
* {@link RedmineItsFacade#addRelatedLink(String, java.net.URL, String)}
*/
@Test
public void testAddRelatedLink() {
try {
LOGGER.info("------ testAddRelatedLink -------");
IMocksControl control = EasyMock.createStrictControl();
RedmineManager redmineManager = control.createMock(RedmineManager.class);
Issue expectedIssue = new Issue();
expectedIssue.setId(42);
expectedIssue
.setNotes("Related URL: \"description\":http://myredmine.org");
RedmineItsFacade instance = new RedmineItsFacade(redmineManager);
control.reset();
redmineManager.update(expectedIssue);
expectLastCall();
control.replay();
instance.addRelatedLink("42", new URL("http://myredmine.org"),
"description");
control.verify();
} catch (Exception e) {
LOGGER.error("Unexpected error: " + e.getMessage(), e);
fail("Unexpected error: " + e.getMessage());
}
}
示例8: init
import com.taskadapter.redmineapi.RedmineManager; //导入依赖的package包/类
/**
* Initialize Redmine connection
* @param rst connection parameters
*/
public static void init(RedmineSourceType rst)
{
if (rst != null)
{
Main.redmineLogger.info("Initialising connection to " + rst.getHost()); //$NON-NLS-1$
redmineManager = new RedmineManager(rst.getHost(), rst.getAccessKey());
}
}
示例9: join
import com.taskadapter.redmineapi.RedmineManager; //导入依赖的package包/类
public static String join(String delimToUse, RedmineManager.INCLUDE... include) {
String delim = "";
StringBuilder sb = new StringBuilder();
for (RedmineManager.INCLUDE i : include) {
sb.append(delim).append(i);
delim = delimToUse;
}
return sb.toString();
}
示例10: getRedmineManager
import com.taskadapter.redmineapi.RedmineManager; //导入依赖的package包/类
/**
* Return instance of {@link RedmineManager}
*
* @return
*/
RedmineManager getRedmineManager() {
SecurityRealm realm = Jenkins.getInstance().getSecurityRealm();
if (!(realm instanceof RedmineSecurityRealm)) {
LOGGER.error("Redmine manager not found");
return null;
}
return ((RedmineSecurityRealm) realm).getManager();
}
示例11: authenticate
import com.taskadapter.redmineapi.RedmineManager; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* @see hudson.security.AbstractPasswordBasedSecurityRealm#authenticate(java.lang.String, java.lang.String)
*/
@Override
protected UserDetails authenticate(String username, String password) throws AuthenticationException {
try {
RedmineManager currentManager = getUserRedmineManager(username, password);
return getUserDetails(currentManager.getCurrentUser());
} catch (RedmineException e) {
LOGGER.error("login failed for user {}: {}", username, e.getMessage(), e);
throw new AuthenticationServiceException("login failed for user " + username, e);
}
}
示例12: loadUserByUsername
import com.taskadapter.redmineapi.RedmineManager; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* @see hudson.security.AbstractPasswordBasedSecurityRealm#loadUserByUsername(java.lang.String)
*/
@Override
public UserDetails loadUserByUsername(String username) {
try {
RedmineManager redmineManager = getManager();
return getUserDetails(redmineManager.getUserByLogin(username));
} catch (RedmineException e) {
LOGGER.info("User {} not found", username);
throw new UsernameNotFoundException(e.getMessage(), e);
}
}
示例13: testLoadGroupByGroupname
import com.taskadapter.redmineapi.RedmineManager; //导入依赖的package包/类
/**
* Test de la méthode {@link RedmineSecurityRealm#loadGroupByGroupname}
*/
@Test
public void testLoadGroupByGroupname() {
LOGGER.info("------ testLoadGroupByGroupname -------");
try {
IMocksControl control = createStrictControl();
final RedmineManager redmineManager = control.createMock(RedmineManager.class);
RedmineSecurityRealm instance = new RedmineSecurityRealm(
"url", "key") {
/**
* {@inheritDoc}
*
* @see com.bouygtel.jenkins.redmine.RedmineSecurityRealm#getUserRedmineManager(java.lang.String,
* java.lang.String)
*/
@Override
RedmineManager getUserRedmineManager(String username, String password) {
assertThat(username, is("username"));
assertThat(password, is("password"));
return redmineManager;
}
};
control.reset();
control.replay();
GroupDetails result = instance.loadGroupByGroupname("groupname");
assertThat(result, is((GroupDetails) new RedmineGroupDetails("groupname")));
control.verify();
} catch (Exception e) {
LOGGER.error("Erreur imprévue: " + e.getMessage(), e);
Assert.fail("Erreur imprévue: " + e.getMessage());
}
}
示例14: isUnderDevelopmentSuspect
import com.taskadapter.redmineapi.RedmineManager; //导入依赖的package包/类
protected boolean isUnderDevelopmentSuspect(Issue issue) {
try {
Integer id = Integer.valueOf(issue.getId());
log.debug("Get issue {}",id);
com.taskadapter.redmineapi.bean.Issue redmineIssue = project.getRedmineManager().getIssueById(id, RedmineManager.INCLUDE.journals);
boolean result = isIssueWithSpentHours(redmineIssue) || isIssueWithDoneRatio(redmineIssue) || isIssueWithCommits(redmineIssue);
if ( result ) {
log.debug("Issue {} is suspect as under development",redmineIssue);
}
return result;
} catch (RedmineException e) {
throw new RuntimeException(e);
}
}
示例15: getRedmineManager
import com.taskadapter.redmineapi.RedmineManager; //导入依赖的package包/类
public RedmineManager getRedmineManager(Properties properties) {
String uri = properties.getProperty("redmine-uri");
String login = properties.getProperty("redmine-login");
String password = properties.getProperty("redmine-password");
String apiAccessKey = properties.getProperty("redmine-apiAccessKey");
if ( apiAccessKey!=null ) {
return new RedmineManager(uri,apiAccessKey);
}
else {
return new RedmineManager(uri,login,password);
}
}