我有以下结构:
/Users
/build
/.jenkins
/jobs
/Job1
config.xml
someotherfiles.blah
/Job2
config.xml
someotherfiles.blah
/JobN
config.xml
someotherfiles.blah
Run Code Online (Sandbox Code Playgroud)
我想只将config.xml文件备份到另一个文件夹,保持新文件夹中的文件夹结构相同,但修剪掉/User/build/.jenkins/jobs
我的新文件夹看起来像这样:
backup/
/Job1
config.xml
/Job2
config.xml
/JobN
config.xml
Run Code Online (Sandbox Code Playgroud)
这可以用rsync吗?
编辑:在输出中不小心包含了someotherfiles.blah,我实际上不想要那些.我想要的只是config.xml文件以及1级文件夹结构.
在设计SpringMVC应用程序时,@ExceptionHandler可以在REST层中使用注释.通过将异常处理卸载到一组半泛型处理程序,这极大地破坏了控制器方法.
我们服务的基本架构是这样的:
[REST API] <==> [应用程序服务] <==> [数据层]
我相信REST层控制器不应直接处理数据层异常,而应仅处理应用程序服务异常.
但是,这意味着我的所有Application Services方法基本上必须如下所示:
public DomainObject getSomeDomainObjectById(String id) {
DomainObject retVal = null;
try {
myDomainDao.getSomeDomainObjectById(id);
} catch (DataLayerExceptionOfSomeSort ex) {
throw translateToAppropriateServiceException(ex);
}
//do some further processing
return retVal;
}
Run Code Online (Sandbox Code Playgroud)
对我来说,这是很多面对面的异常处理,我不在乎.我怎么能解决这个问题?是否有一种简单的方法可以在Application Services层中实现与Rest层中相同的功能?
我的第一个想法是AOP.我对此持开放态度,因为它不会增加很多瑕疵并且易于配置.
我有以下路由设置,但是当我的地图在第一个完整的块中返回时,我收到一个错误:
could not find implicit value for evidence parameter of type spray.httpx.marshalling.Marshaller[scala.collection.immutable.Map[String,String]]
import spray.routing.HttpService
import akka.actor.Actor
import spray.http.HttpRequest
import spray.routing.RequestContext
import spray.json.DefaultJsonProtocol._
class UserServiceActor extends Actor with RestUserService {
def actorRefFactory = context
def receive = runRoute(linkRoute)
}
trait RestUserService extends HttpService {
val userService = new LinkUserService
def linkRoute =
pathPrefix("user" / Segment) {
userId =>
path("link") {
parameters('service ! "YT") {
complete {
Map("status"-> "OK", "auth_url" -> "http://mydomain.com/auth")
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
根据这个测试,我应该能够在导入DefaultJsonProtocol._时将Map转换为json,但即使这样也失败了:
val map:Map[String, …Run Code Online (Sandbox Code Playgroud) 我有以下课程:
class LinkUserService() {
//** cake pattern **
oauthProvider: OAuthProvider =>
//******************
def isUserLinked(userId: String, service: String) = {
val cred = oauthProvider.loadCredential(userId)
cred != null
}
def linkUserAccount(userId: String, service: String): (String, Option[String]) = {
if (isUserLinked(userId, service)) {
("SERVICE_LINKED", None)
} else {
val authUrl = oauthProvider.newAuthorizationUrl
("SERVICE_NOT_LINKED", Some(authUrl))
}
}
def setLinkAuthToken(userId: String, service:String, token:String):String = {
oauthProvider.createAndStoreCredential(userId, token)
}
}
Run Code Online (Sandbox Code Playgroud)
通常我会在生产中使用这个类,如下所示:
val linkService = LinkUserService with GoogleOAuthProvider
当涉及到测试时,我想oauthProvider用一个模拟替换,这样我的单元测试已经训练过这样的响应:oauthProvider.loadCredential("nobody") returns null.这可能吗?如果是这样,我将如何设置我的单元测试呢?
我目前有一组以约定命名的数据访问对象*SlickRepo.因此,例如,UserSlickRepo,DistributionSlickRepo,ContentSlickRepo,等...
这些Repos中的每一个都有基于此约定的方法:
trait SomethingRepoImpl extends SomethingRepo {
val somethingRepo: SomethingRepo = new SomethingRepoImpl
class SomethingRepoImpl extends SomethingRepo with MySlickDatastore {
def getSomething(id: UUID): Either[SomethingNotFoundError, Something] = {
getDatabase withDynSession {
// Slick stuff
}
}
def createSomething .....
}
}
Run Code Online (Sandbox Code Playgroud)
现在在服务级别,我们在这个repo类中烘焙,我们的方法看起来像这样:
trait SomethingServiceImpl extends SomethingService {
dep: SomethingRepo with SomethingElseRepo =>
val somethingService = new SomethingServiceImpl
class SomethingServiceImpl extends SomethingService {
def createSomethingGood(): Either[SomeError, (Something, SomethingElse)] = {
(dep.somethingRepo.createSomething, dep.somethingElseRepo.createSomethingElse)
}
} …Run Code Online (Sandbox Code Playgroud) 我为phpmyadmin设置了以下设置:
<Directory /usr/share/phpmyadmin>
Options FollowSymLinks
DirectoryIndex index.php
Order Deny,Allow
Allow from 127.0.0.1
Deny from all
Run Code Online (Sandbox Code Playgroud)
...
</Directory>
Run Code Online (Sandbox Code Playgroud)
基本上,我只允许从localhost访问phpmyadmin.如果来自外界的人试图去http:// mydomain/phpmyadmin,他们将获得403(禁止).这可能会让他们知道它在那里,但他们无法达到它.
问题:我宁愿让Apache在这个例子中返回404.那可能吗?
我正在创建一个应用程序,要求允许通过OAuth2管理YouTube帐户(Google帐户).
这很有效,但我遇到的问题是,如果用户决定使用链接到其Google帐户的YouTube频道帐户向我们的应用授予权限,我就无法了解如何允许他们撤销他们的权限.
例如,如果我们的应用程序已转换为普通的Google帐户,我们可以转到此页面:https://security.google.com/settings/u/0/security/permissions ,然后通过查找我们的应用程序撤消该权限列表并单击右侧的"撤消访问"按钮.
我们无法为关联的YouTube频道帐户执行此操作.这些帐户似乎没有任何此类权限仪表板可用.
使用上述仪表板时,通常可以通过单击页面右上角的帐户图片来"切换帐户".但是,当我这样做时,未列出链接的帐户.
TL; DR 我想使用该sh步骤,即使Jenkins在Windows上运行.我不想使用这个bat步骤,除非你能告诉我如何轻松地再现我需要做的事情bat
我一直在将一些旧的Jenkins工作转换为2.x Pipeline脚本.我的一个工作使用"发布SSH插件"来:
例如:
我想在Pipeline Script中复制它,所以我做了以下事情:
stage('Deploy') {
withCredentials([[$class: 'FileBinding', credentialsId: 'bitbucket-key-file', variable: 'SSHKEY']]) {
sh '''
scp -i "$SSHKEY" dsub.tar.gz tprmbbuild@192.168.220.57:dsubdeploy
scp -i "$SSHKEY" deployDsubUi.sh tprmbbuild@192.168.220.57:dsubdeploy
ssh -i "$SSHKEY" -o StrictHostKeyChecking=no 192.168.220.57 <<- EOF
DEPLOY_DIR=/home/tprmbbuild/dsubdeploy
echo '*** dos2unix using sed'
sed -e 's/\r$//' $DEPLOY_DIR/deployDsubUi.sh > $DEPLOY_DIR/deployDsubUi-new.sh
mv $DEPLOY_DIR/deployDsubUi-new.sh $DEPLOY_DIR/deployDsubUi.sh
chmod 755 $DEPLOY_DIR/deployDsubUi.sh
echo '*** Deploying Dsub UI'
$DEPLOY_DIR/deployDsubUi.sh $DEPLOY_DIR/dsub.tar.gz
EOF'''
}
}
Run Code Online (Sandbox Code Playgroud)
问题是,我在执行构建时得到了这个堆栈跟踪:
[Pipeline] sh
[E:\Jenkins\jenkins_home\workspace\tpr-ereg-ui-deploy@2] Running shell script
1 …Run Code Online (Sandbox Code Playgroud) 我正在使用Rational Application Developer来创建一些Web服务.我遇到的问题是我按照屏幕演示中的说明进行操作,但是当我到达我选择"JAX-WS"的部分时,它抱怨Websphere没有Web服务库的实现,因为所选择的服务器只是一个"存根".
作为WAS的新手,我想知道这意味着什么?是不是RAD没有附带WAS的实际实现,而只是存根库,所以你的代码可以编译?是否需要在本地安装一个完整的WAS服务器才能测试我的Web服务代码?
TLDR;问题:有没有办法准备一个 XArchive,然后他们可以自己分配一个供应配置文件并使用适当的分发证书签名?
长问题: 我的客户向我发送了我为他们开发的应用程序的配置文件。他们不想向我发送他们的分发证书(.p12 文件)。
他们给我的指示如下:
问题是,在执行步骤 4 时,出现以下错误:
CodeSign error: code signing is required for product type 'Application' in SDK 'iOS 7.0'
Run Code Online (Sandbox Code Playgroud)
他们的想法是他们会在他们这边对应用程序进行协同设计(从而保护他们的证书)。有没有办法做到这一点?
scala ×3
apache ×1
apache2 ×1
cake-pattern ×1
google-oauth ×1
ios ×1
java ×1
jenkins ×1
mockito ×1
rad ×1
rsync ×1
slick-2.0 ×1
spray-json ×1
spring ×1
spring-mvc ×1
unit-testing ×1
websphere ×1
xcode ×1
xcode5 ×1
youtube ×1