Skip to content

Commit fe9afa7

Browse files
committed
add CouchDbStatsReduceResponse
1 parent 1b9b40e commit fe9afa7

File tree

6 files changed

+257
-1
lines changed

6 files changed

+257
-1
lines changed
Binary file not shown.
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<modelVersion>4.0.0</modelVersion>
3+
<groupId>com.n1global</groupId>
4+
<artifactId>async-couchdb-client</artifactId>
5+
<version>0.71</version>
6+
<name>async-couchdb-client</name>
7+
8+
<properties>
9+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
10+
<project.resources.sourceEncoding>UTF-8</project.resources.sourceEncoding>
11+
<maven.compiler.source>1.8</maven.compiler.source>
12+
<maven.compiler.target>1.8</maven.compiler.target>
13+
</properties>
14+
15+
<dependencies>
16+
<dependency>
17+
<groupId>com.ning</groupId>
18+
<artifactId>async-http-client</artifactId>
19+
<version>1.9.33</version>
20+
</dependency>
21+
22+
<dependency>
23+
<groupId>com.fasterxml.jackson.core</groupId>
24+
<artifactId>jackson-databind</artifactId>
25+
<version>2.7.1-1</version>
26+
</dependency>
27+
28+
<dependency>
29+
<groupId>com.fasterxml.jackson.datatype</groupId>
30+
<artifactId>jackson-datatype-jsr310</artifactId>
31+
<version>2.7.1</version>
32+
</dependency>
33+
34+
<dependency>
35+
<groupId>ch.qos.logback</groupId>
36+
<artifactId>logback-classic</artifactId>
37+
<version>1.1.5</version>
38+
</dependency>
39+
40+
<dependency>
41+
<groupId>org.springframework</groupId>
42+
<artifactId>spring-web</artifactId>
43+
<version>4.2.5.RELEASE</version>
44+
<exclusions>
45+
<exclusion>
46+
<groupId>*</groupId>
47+
</exclusion>
48+
</exclusions>
49+
</dependency>
50+
51+
<!-- For testing -->
52+
<dependency>
53+
<groupId>org.slf4j</groupId>
54+
<artifactId>jcl-over-slf4j</artifactId>
55+
<version>1.7.16</version>
56+
<scope>test</scope>
57+
</dependency>
58+
59+
<dependency>
60+
<groupId>net.coobird</groupId>
61+
<artifactId>thumbnailator</artifactId>
62+
<version>0.4.8</version>
63+
<scope>test</scope>
64+
</dependency>
65+
66+
<dependency>
67+
<groupId>junit</groupId>
68+
<artifactId>junit</artifactId>
69+
<version>4.12</version>
70+
<scope>test</scope>
71+
</dependency>
72+
73+
<dependency>
74+
<groupId>org.assertj</groupId>
75+
<artifactId>assertj-core</artifactId>
76+
<version>3.3.0</version>
77+
<scope>test</scope>
78+
</dependency>
79+
80+
<dependency>
81+
<groupId>org.springframework</groupId>
82+
<artifactId>spring-context</artifactId>
83+
<version>4.2.5.RELEASE</version>
84+
<exclusions>
85+
<exclusion>
86+
<groupId>commons-logging</groupId>
87+
<artifactId>commons-logging</artifactId>
88+
</exclusion>
89+
</exclusions>
90+
<scope>test</scope>
91+
</dependency>
92+
93+
<dependency>
94+
<groupId>org.springframework</groupId>
95+
<artifactId>spring-test</artifactId>
96+
<version>4.2.5.RELEASE</version>
97+
<scope>test</scope>
98+
</dependency>
99+
100+
<dependency>
101+
<groupId>org.apache.lucene</groupId>
102+
<artifactId>lucene-core</artifactId>
103+
<version>5.5.0</version>
104+
<scope>test</scope>
105+
</dependency>
106+
107+
<dependency>
108+
<groupId>org.apache.lucene</groupId>
109+
<artifactId>lucene-analyzers-common</artifactId>
110+
<version>5.5.0</version>
111+
<scope>test</scope>
112+
</dependency>
113+
</dependencies>
114+
115+
<build>
116+
<plugins>
117+
<plugin>
118+
<groupId>org.apache.maven.plugins</groupId>
119+
<artifactId>maven-source-plugin</artifactId>
120+
<version>2.4</version>
121+
<executions>
122+
<execution>
123+
<id>attach-sources</id>
124+
<goals>
125+
<goal>jar</goal>
126+
</goals>
127+
</execution>
128+
</executions>
129+
</plugin>
130+
131+
<plugin>
132+
<artifactId>maven-resources-plugin</artifactId>
133+
<version>2.7</version>
134+
<executions>
135+
<execution>
136+
<id>copy-configuration-files</id>
137+
<phase>install</phase>
138+
<goals>
139+
<goal>copy-resources</goal>
140+
</goals>
141+
<configuration>
142+
<outputDirectory>${project.basedir}/maven/com/n1global/${project.artifactId}/${project.version}</outputDirectory>
143+
<resources>
144+
<resource>
145+
<directory>${project.build.directory}</directory>
146+
<includes>
147+
<include>*.jar</include>
148+
</includes>
149+
</resource>
150+
</resources>
151+
</configuration>
152+
</execution>
153+
</executions>
154+
</plugin>
155+
156+
<plugin>
157+
<artifactId>maven-antrun-plugin</artifactId>
158+
<version>1.8</version>
159+
<executions>
160+
<execution>
161+
<phase>install</phase>
162+
<configuration>
163+
<tasks>
164+
<copy file="${project.basedir}/pom.xml" tofile="${project.basedir}/maven/com/n1global/${project.artifactId}/${project.version}/${project.artifactId}-${project.version}.pom"/>
165+
</tasks>
166+
</configuration>
167+
<goals>
168+
<goal>run</goal>
169+
</goals>
170+
</execution>
171+
</executions>
172+
</plugin>
173+
</plugins>
174+
</build>
175+
</project>

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<modelVersion>4.0.0</modelVersion>
33
<groupId>com.n1global</groupId>
44
<artifactId>async-couchdb-client</artifactId>
5-
<version>0.7</version>
5+
<version>0.71</version>
66
<name>async-couchdb-client</name>
77

88
<properties>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package com.n1global.acc.json;
2+
3+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4+
5+
@JsonIgnoreProperties(ignoreUnknown = true)
6+
public class CouchDbStatsReduceResponse {
7+
private double sum;
8+
9+
private double count;
10+
11+
private double min;
12+
13+
private double max;
14+
15+
public double getSum() {
16+
return sum;
17+
}
18+
19+
public double getCount() {
20+
return count;
21+
}
22+
23+
public double getMin() {
24+
return min;
25+
}
26+
27+
public double getMax() {
28+
return max;
29+
}
30+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package com.n1global.acc;
2+
3+
import org.junit.After;
4+
import org.junit.Assert;
5+
import org.junit.Before;
6+
import org.junit.Test;
7+
8+
import com.n1global.acc.fixture.TestDb;
9+
import com.n1global.acc.fixture.TestDoc;
10+
import com.ning.http.client.AsyncHttpClient;
11+
import com.ning.http.client.AsyncHttpClientConfig;
12+
13+
public class CouchDbBulkTest {
14+
private TestDb db;
15+
16+
private AsyncHttpClient httpClient;
17+
18+
@Before
19+
public void before() {
20+
httpClient = new AsyncHttpClient(new AsyncHttpClientConfig.Builder().setRequestTimeout(-1).build());
21+
22+
db = new TestDb(new CouchDbConfig.Builder().setServerUrl("http://127.0.0.1:5984")
23+
.setUser("admin")
24+
.setPassword("root")
25+
.setHttpClient(httpClient)
26+
.build());
27+
}
28+
29+
@After
30+
public void after() {
31+
db.deleteDb();
32+
33+
httpClient.close();
34+
}
35+
36+
@Test
37+
public void shouldSaveInBulk() {
38+
TestDoc testDoc1 = new TestDoc("new 1");
39+
TestDoc testDoc2 = new TestDoc("new 2");
40+
41+
db.saveOrUpdate(testDoc1, testDoc2);
42+
43+
testDoc1.setName("updated 1");
44+
testDoc2.setName("updated 2");
45+
46+
db.saveOrUpdate(testDoc1, testDoc2);
47+
48+
Assert.assertEquals("updated 1", db.<TestDoc>get(testDoc1.getDocId()).getName());
49+
Assert.assertEquals("updated 2", db.<TestDoc>get(testDoc2.getDocId()).getName());
50+
}
51+
}

0 commit comments

Comments
 (0)