Skip to content

Commit 81bedad

Browse files
committed
Added ClientServiceSpec integration test
1 parent 04bff95 commit 81bedad

File tree

2 files changed

+65
-1
lines changed

2 files changed

+65
-1
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* Copyright 2015 Time Warner Cable, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.twcable.grabbit.server.services
18+
19+
import com.twcable.grabbit.GrabbitConfiguration
20+
import com.twcable.grabbit.client.services.ClientService
21+
import com.twcable.grabbit.client.services.impl.DefaultClientService
22+
import com.twcable.grabbit.jcr.AbstractJcrSpec
23+
import com.twcable.jackalope.impl.sling.SimpleResourceResolverFactory
24+
import com.twcable.jackalope.impl.sling.SlingRepositoryImpl
25+
import org.apache.sling.jcr.api.SlingRepository
26+
import org.springframework.context.ApplicationContext
27+
import org.springframework.context.ConfigurableApplicationContext
28+
import org.springframework.context.support.ClassPathXmlApplicationContext
29+
import org.springframework.context.support.StaticApplicationContext
30+
import spock.lang.Subject
31+
32+
@Subject(ServerService)
33+
class ClientServiceSpec extends AbstractJcrSpec {
34+
35+
SlingRepository slingRepository
36+
37+
ConfigurableApplicationContext appCtx
38+
39+
ClientService syncClientService
40+
41+
42+
def setup() {
43+
slingRepository = new SlingRepositoryImpl()
44+
45+
ApplicationContext parentAppCtx = new StaticApplicationContext()
46+
parentAppCtx.beanFactory.registerSingleton("slingRepository", slingRepository)
47+
parentAppCtx.beanFactory.registerSingleton("resourceResolverFactory", new SimpleResourceResolverFactory(slingRepository))
48+
parentAppCtx.refresh()
49+
appCtx = new ClassPathXmlApplicationContext(["META-INF/spring/client-batch-job.xml", "META-INF/spring/client-workflow-on-step.xml", "META-INF/spring/client-workflow-off-step.xml"] as String[], parentAppCtx)
50+
51+
syncClientService = new DefaultClientService(slingRepository: slingRepository,
52+
configurableApplicationContext: appCtx)
53+
}
54+
55+
56+
def "Service initiate a grab and return jobs"() {
57+
when:
58+
def jobIds = syncClientService.initiateGrab(new GrabbitConfiguration("admin", "adminPass", "testbox", "4502", false, [new GrabbitConfiguration.PathConfiguration("/content/test", [], [], false)]), "admin")
59+
60+
then:
61+
jobIds.size() == 1
62+
}
63+
64+
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ guava_version = 15.0
2222
httpcomponents_version = 4.3.4
2323
httpcomponents_client_version = 4.3.6
2424
httpcomponents_core_version = 4.3.2
25-
jackalope_version = 2.0.0
25+
jackalope_version = 3.0.1
2626
jackrabbit_ocm_version = 1.5.3
2727
jackrabbit_version = 2.10.0
2828
jcr_version = 2.0

0 commit comments

Comments
 (0)