Tag: 2服务

在maven项目之间共享testing资源

有一个明确的解决scheme,使用maven-jar-plugin插件的test-jar目标(参见这里 )共享maven项目之间的通用testing代码。 我需要用testing资源来做类似的事情,特别是我希望testing期间项目B的类path中可以使用项目A的testing资源。 对于项目,需要声明: <!– Package and attach test resources to the list of artifacts: –> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution> <phase>package</phase> <goals> <goal>run</goal> </goals> <configuration> <tasks> <jar destfile="${project.build.directory}/test-resources.jar"> <fileset dir="${project.basedir}/test-resources" /> </jar> </tasks> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <executions> <execution> <phase>package</phase> <goals> <goal>attach-artifact</goal> </goals> <configuration> <artifacts> <artifact> <file>${project.build.directory}/test-resources.jar</file> <type>jar</type> <classifier>test-resources</classifier> </artifact> </artifacts> […]

Angular 2中的EventEmitter.next()和EventEmitter.emit()之间的区别

EventEmitter.emit()和EventEmitter.next()什么EventEmitter.next() ? 将事件分派给订阅的听众。 export class MyService { @Output() someEvent$: EventEmitter<any> = new EventEmitter(); someFunc() { this.someEvent$.emit({myObj: true}); this.someEvent$.next({myObj: true}); } } EventEmitter的文档目前不太有用。

pipe道''无法findangular2自定义pipe道

我似乎无法解决这个错误。 我有一个search栏和一个ngFor。 我想用这样的自定义pipe道过滤数组: import { Pipe, PipeTransform } from '@angular/core'; import { User } from '../user/user'; @Pipe({ name: 'usersPipe', pure: false }) export class UsersPipe implements PipeTransform { transform(users: User [], searchTerm: string) { return users.filter(user => user.name.indexOf(searchTerm) !== -1); } } 用法: <input [(ngModel)]="searchTerm" type="text" placeholder="Search users"> <div *ngFor="let user of (users | usersPipe:searchTerm)"> […]

使用Retrofit2和Mockito或Robolectric的Androidunit testing

我可以testingretrofit2beta4的真实反应吗? 我需要Mockito还是Robolectic? 我没有在我的项目活动,这将是一个图书馆,我需要testing是服务器响应正确。 现在我有这样的代码卡住了… @Mock ApiManager apiManager; @Captor private ArgumentCaptor<ApiCallback<Void>> cb; @Before public void setUp() throws Exception { apiManager = ApiManager.getInstance(); MockitoAnnotations.initMocks(this); } @Test public void test_login() { Mockito.verify(apiManager) .loginUser(Mockito.eq(login), Mockito.eq(pass), cb.capture()); // cb.getValue(); // assertEquals(cb.getValue().isError(), false); } 我可以做出假的回应,但我需要testing真实。 成功了吗? 它的身体是否正确? 你能帮我用代码吗?

在maven中,main / resources和main / config有什么区别?

我想把一个configuration文件放到我的Maven项目中。 看一下标准的目录布局 ,有两个看起来很明智的地方,“ src/main/resources ”和“ src/main/config ”。 有人可以解释这些之间的差异,并解释什么时候你会把东西在config和resources ? 在这种情况下,我正在看的文件是ehcache.xml ,但我的问题不是ehcache特定的,我很好奇log4j.properties等 有一点谷歌search发现这个人有同样的问题 ,但答案似乎矛盾,而不是很认真。

哪里是指定maven仓库,pom.xml或settings.xml的最佳位置?

哪里是最好的地方来指定所需的maven项目的仓库, pom.xml或settings.xml ? 每个地点有什么优点和缺点? 什么是最佳做法? 在我看来,在POM中定义存储库是有好处的,原因如下: 可重复性:相关的工件来自POM中明确声明的已知位置。 用户configuration不当的存储库也会导致问题的机会减less。 可移植性:这个POM将build立在安装了maven的任何人的机器上。 对额外的用户configuration的存储库设置没有额外的要求。 易于使用:新开发人员更容易检索和构build项目,因为安装的configuration较less。 也许一个问题是,如果版本库的位置将来发生变化,则需要安装代理,或者需要发布旧软件的补丁版本,以指定新的版本库位置(或者.m2/settings.xml始终可以提供额外的版本库最后的手段)。 然而,这似乎是在释放pipe理中的良好可重复性和可移植性的必要分支,而不是一个骗局。 任何其他的想法?

用Doctrine 2检查重复的键

有一个简单的方法来检查重复密钥与教条2之前做一个刷新?

如何在Angular 2应用程序中configuration不同的开发环境

我有一个恒定的文件 export class constants { public static get API_ENDPOINT(): string { return 'https://dvelopment-server/'; } } 我将它导入我的服务 private _registrationUrl = constants.API_ENDPOINT+'api/v1/register'; 如何更改服务器更改的endpont。 我有开发服务器登台服务器和本地服务器。 我想要应用程序来检测环境的变化。 在我的angular1应用程序中,我使用了envserviceprovider。 我可以使用相同的angular2应用程序?

Zend Framework 2 + Doctrine 2

我想开始与Zend Framework开发,我想使用zf2。 由于我使用Doctrine 2,你能提供一些教程来帮助我将它集成到zf2吗? 谢谢!

学说和LIKE查询

我有学说的实体: <?php /** * @Entity * @Table(name="orders") */ class Orders { /** @Id @Column(name="OID",type="integer") @GeneratedValue */ private $id; /** @Column(name="Product",type="string")*/ private $product; /** @Column(name="RegCode",type="string")*/ private $reg_code; /** @Column(name="OrderEmail",type="string")*/ private $email; } 我需要这样的查询: select * from `orders` where `OrderEmail`='some@mail.com' and `Product` LIKE 'My Products%' 我尝试处理查询不喜欢: $em->getRepository("Orders")->findByEmailAndProduct($uname,$product); 但它会造成错误。 为什么? 我可以在没有DQL的情况下做这个查询吗 我想让这个查询使用魔术方法findBy **