小编Mat*_*ker的帖子

禁用HttpClient日志记录

我在集成测试套件中使用commons-httpclient 3.1.HttpClient的默认日志记录非常嘈杂,我似乎无法将其关闭.我试过按照这里的说明,但没有一个有任何区别.

大多数情况下,我只需要关闭org.apache.http.wire记录器.问题的一部分是我不知道HttpClient尝试使用什么类型的记录器,大多数问题是我之前从未使用过这个库.我尝试创建一个log4j.properties文件并将其放在我的test/resources文件夹中,修改jre/lib中的master logging.properties文件,并按照日志页面上的指定将各种日志记录选项发送到Maven ,而不是它们都没有有所作为.

任何帮助表示赞赏......这让我疯狂.

更新:更正:看来有问题的输出实际上是通过jwebunit使用HttpClient而不是我自己的.无论哪种方式,这都是不可取的.

更新:感谢迄今为止的尝试.我已经尝试了下面提出的所有建议,但仍然没有运气.我在src/test/resources文件夹中有一个文件commons-logging.properties,其中包含以下内容

org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.Log4jFactory
log4j.configuration=log4j.properties
Run Code Online (Sandbox Code Playgroud)

以及具有以下内容的同一文件夹中的文件log4j.properties

log4j.rootLogger=ERROR, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%c] %m%n

#This is the line that should make httpclient shut up
log4j.logger.org.apache.http=ERROR
Run Code Online (Sandbox Code Playgroud)

但是,当我运行我的测试时,我仍然得到一堆像这样的输出:

21:57:41.413 [main] DEBUG org.apache.http.wire - << "                                   [\r][\n]"
21:57:41.413 [main] DEBUG org.apache.http.wire - << "[\r][\n]"
21:57:41.413 [main] DEBUG org.apache.http.wire - << "                                   [\r][\n]"
21:57:41.413 [main] DEBUG org.apache.http.wire - << "                               </ul>[\n]"
21:57:41.413 [main] DEBUG org.apache.http.wire - << "    [\n]"
21:57:41.424 [main] DEBUG …
Run Code Online (Sandbox Code Playgroud)

java logging jwebunit apache-commons-httpclient

123
推荐指数
11
解决办法
9万
查看次数

TARGET_OS_IPHONE和ApplicationTests

编译ApplicationTests单元测试包时,为什么这段代码不起作用?

#if TARGET_OS_IPHONE
   #import <Foundation/Foundation.h>
   #import <UIKit/UIKit.h>
#else
   #import <Cocoa/Cocoa.h>
#endif
Run Code Online (Sandbox Code Playgroud)

我的一个依赖项有这个检查,并在我的主应用程序包中编译得很好,但它<Cocoa/Cocoa.h>在编译我的ApplicationTests包时尝试加载.这可能只是我对Xcode缺乏了解,但是当我的测试包没有构建时我会感到紧张.有什么建议?

xcode gcc mgtwitterengine ios

22
推荐指数
3
解决办法
1万
查看次数

哪个CouchDB API用于Rails?

我目前正在调查CouchDB在我当前项目中的可能应用(用Rails编写),并希望从实际使用这些API的人那里获得一些反馈.你会推荐哪个?为什么?

  • ActiveCouch
  • CouchFoo
  • CouchRest
  • CouchRest摆幅
  • CouchPotato

couchdb ruby-on-rails nosql

16
推荐指数
2
解决办法
5426
查看次数

在iOS 4.1 SDK中破坏了单元测试?

升级到4.1 iOS SDK后,我的单元测试包总是返回以下两个错误和一个警告:

An internal error occurred when handling command output: -[XCBuildLogCommandInvocationSection setTestsPassedString:]: unrecognized selector sent to instance
An internal error occurred when handling command output: -[XCBuildLogCommandInvocationSectionRecorder endmarker:]: unrecognized selector sent to instance
Run unit tests for architecture 'i386' (GC OFF) did not finish
Run Code Online (Sandbox Code Playgroud)

尽管它报告X测试中的所有X都通过了,但我得到了这些错误.我读到了旧版XCode中的一个类似的错误,它也是在它发布之后立即发生的(关于时间正则表达式中的错误)可以通过将你的时区设置为太平洋时间来缓解,但我不能肯定地说,这是一个回归到那里.

还有其他人有这个问题吗?

iphone unit-testing ocunit ios4

11
推荐指数
1
解决办法
2605
查看次数

单元测试模型继承自NSManagedObject的类

所以...我正试图在我的iPhone应用程序中设置单元测试,但我遇到了一些问题.我正在尝试测试我的模型类,但它们直接从NSManagedObject继承.我确定这是一个问题,但我不知道如何绕过它.

一切都按预期构建和运行但是在我正在测试的类上调用任何方法时出现此错误:

Unknown.m:0:0 unrecognized selector sent to instance 0xc2b120

如果我按照这个结构在我的测试中创建我的对象,我最终会得到另一个错误,但它仍然无法帮助我.

如果我像这样实例化我的模型:

entry = [[TimeEntry alloc]
        initWithEntity:nil
        insertIntoManagedObjectContext:nil];
Run Code Online (Sandbox Code Playgroud)

然后我在运行时结束这个错误:

An NSManagedObject of class 'TimeEntry' must have a valid NSEntityDescription.

如果我这样尝试:

entry = [[TimeEntry alloc] init];
Run Code Online (Sandbox Code Playgroud)

然后我最终得到了这个错误:

unrecognized selector sent to instance 0xc2b120

如果我遵循这里列出的模式:

model = [[NSManagedObjectModel mergedModelFromBundles: nil] retain];
NSLog(@"model: %@", model);
coord = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel: model];
store = [coord addPersistentStoreWithType: NSInMemoryStoreType
                            configuration: nil
                                      URL: nil
                                  options: nil 
                                    error: NULL];
ctx = [[NSManagedObjectContext alloc] init];
[ctx …
Run Code Online (Sandbox Code Playgroud)

unit-testing core-data objective-c

6
推荐指数
1
解决办法
5539
查看次数

iOS通用链接和URL缩短器

当通过缩短的goo.glURL 访问UL时,我们最近开始遇到我们的Universal Link实施的问题.

这个作品: https://site.domain.com/Deep/Link

这不是:https://goo .gl/fake- > 302 Redirect- >https://site.domain.com/Deep/Link

还有其他人经历过同样的事情吗?

注意:我不得不拆掉缩短的Google网址,以防止StackOverflow的编辑对我大吼大叫.

ios ios-universal-links

6
推荐指数
1
解决办法
2141
查看次数

svn externals ...是或否?

我在这里读了几个答案,谴责使用svn:externals.我确实看到它们如何被滥用,它确实让我们更加依赖Subversion,但我真的没有看到我们的团队很快就会离开它.

无论如何,这是我的困境.我们的解决方案引用了多个项目,这些项目位于存储库的各自部分.其中许多项目在多个解决方案之间共享,我们也不希望阻止共享我们的项目.我们还在我们的存储库(单元测试框架,库等)中检查了几个固定版本依赖项.

我想配置一些只使用外部的"工作空间"(就Subversion而言,它们只是空目录,或者可能只包含一个解决方案文件)来为我们的开发人员配置解决方案.单独检出大多数项目将不足以构建它们,但是检查它的工作区将足以构建它,因为它的所有依赖项都将随附它.有没有其他人实现过类似的解决方案,并且svn:externals是一个很好的方法来解决这个问题?如果我们走这条路,你对我有什么谨慎的话?

基本上结构看起来像这样(为了简洁省略了trunk/branches/tags):

/projects
   /project1
   /project2
/dependencies
   /xUnit
      /1.5
      /1.4
   /NHibernate
      /2.1.0
      /2.0.1
/workspaces
   /project1
      /project1 (external to ^/projects/project1)
      /xUnit (external to ^/dependencies/xUnit/1.5)
      /NHibernate (external to ^/dependencies/NHibernate/2.0.1)
   /project2
      /project2 (external to ^/projects/project2)
      /xUnit (external to ^/dependencies/xUnit/1.4)
      /NHibernate (external to ^/dependencies/NHibernate/2.1.0)
Run Code Online (Sandbox Code Playgroud)

svn version-control externals

5
推荐指数
1
解决办法
1092
查看次数

.NET 请求被中止:无法创建 SSL/TLS 安全通道

我已经尝试了针对此问题遇到的所有假设解决方案,但似乎没有任何效果。以下是提取的跟踪日志(一个用于尝试与 Paypal 对话,另一个用于尝试与 GetSentry 对话):

System.Net Information: 0 : [10776] SecureChannel#49633458::.ctor(hostname=svcs.sandbox.paypal.com, #clientCertificates=0, encryptionPolicy=RequireEncryption)
System.Net Information: 0 : [10776] SecureChannel#49633458 - Left with 0 client certificates to choose from.
System.Net Information: 0 : [10776] Using the cached credential handle.
System.Net Information: 0 : [10776] InitializeSecurityContext(credential = System.Net.SafeFreeCredential_SECURITY, context = (null), targetName = svcs.sandbox.paypal.com, inFlags = ReplayDetect, SequenceDetect, Confidentiality, AllocateMemory, InitManualCredValidation)
System.Net Information: 0 : [10776] InitializeSecurityContext(In-Buffer length=0, Out-Buffer length=58, returned code=ContinueNeeded).
System.Net Information: 0 : [10776] InitializeSecurityContext(credential = System.Net.SafeFreeCredential_SECURITY, context = …
Run Code Online (Sandbox Code Playgroud)

c# ssl paypal

5
推荐指数
1
解决办法
3739
查看次数

如何在Go中解码包含数组的查询字符串?

你如何使用Go来解码这样结构化的查询字符串?

/comments?ids[]=1&ids[]=2&ids[]=3

现在这段代码:

query := r.URL.Query()
for k, _ := range query { fmt.Printf("%s\n", k) }
ids := query.Get("ids[]")
if (ids != "") {
    fmt.Printf("Ids: %s\n", ids)
}
Run Code Online (Sandbox Code Playgroud)

结果是:

ids[]
Ids: 1
Run Code Online (Sandbox Code Playgroud)

是否有内置的方式来支持这个或者我将不得不手动解析它?

go

3
推荐指数
1
解决办法
77
查看次数

Mixpanel与EmberJS

注意:我开始写这个问题,并在写作中最终解决了问题.我会把它留在这里,希望它会帮助别人.

我已经用一段时间将我的头撞在墙上一段时间,并且不断得到不一致的结果.

尝试1(从这里)

App.ApplicationController = Ember.Controller.extend({ 
    routeChanged: function (){
        mixpanel.track("pageview", {"url": window.location.href });
    }.observes('currentPath')
});
Run Code Online (Sandbox Code Playgroud)

因为mixpanel.track_pageview()被弃用,我不得不偏离这个例子.这导致错误的位置记录,因为一旦转换重写URL,我找不到获取新哈希路径的方法,并且此时URL尚未更新.

尝试2

$(window).on('hashchange', function(){
    mixpanel.track("pageview", {"url": window.location.href });
});
Run Code Online (Sandbox Code Playgroud)

这在URL散列更改时有效,但现在我没有在首次加载站点时进行任何跟踪.

transitions mixpanel ember.js

3
推荐指数
1
解决办法
856
查看次数