Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
e5cda040
Commit
e5cda040
authored
Jun 01, 2014
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restore test classes
Restore test classes accidentally deleted and ignored in
c43fd04f
.
parent
8aaaaa48
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
330 additions
and
2 deletions
+330
-2
.gitignore
spring-boot-autoconfigure/.gitignore
+1
-1
ElasticsearchRepositoriesAutoConfigurationTests.java
...data/ElasticsearchRepositoriesAutoConfigurationTests.java
+105
-0
CityElasticsearchDbRepository.java
...data/alt/elasticsearch/CityElasticsearchDbRepository.java
+24
-0
CityJpaRepository.java
...rk/boot/autoconfigure/data/alt/jpa/CityJpaRepository.java
+24
-0
CityMongoDbRepository.java
...t/autoconfigure/data/alt/mongo/CityMongoDbRepository.java
+24
-0
CitySolrRepository.java
.../boot/autoconfigure/data/alt/solr/CitySolrRepository.java
+24
-0
City.java
...framework/boot/autoconfigure/data/elasticsearch/City.java
+69
-0
CityRepository.java
...boot/autoconfigure/data/elasticsearch/CityRepository.java
+32
-0
EmptyDataPackage.java
...ework/boot/autoconfigure/data/empty/EmptyDataPackage.java
+26
-0
.gitignore
...-samples/spring-boot-sample-data-elasticsearch/.gitignore
+1
-1
No files found.
spring-boot-autoconfigure/.gitignore
View file @
e5cda040
data
/
data
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/ElasticsearchRepositoriesAutoConfigurationTests.java
0 → 100644
View file @
e5cda040
/*
* Copyright 2012-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
boot
.
autoconfigure
.
data
;
import
org.elasticsearch.client.Client
;
import
org.junit.After
;
import
org.junit.Test
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.autoconfigure.TestAutoConfigurationPackage
;
import
org.springframework.boot.autoconfigure.data.alt.elasticsearch.CityElasticsearchDbRepository
;
import
org.springframework.boot.autoconfigure.data.elasticsearch.City
;
import
org.springframework.boot.autoconfigure.data.elasticsearch.CityRepository
;
import
org.springframework.boot.autoconfigure.data.empty.EmptyDataPackage
;
import
org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchAutoConfiguration
;
import
org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchDataAutoConfiguration
;
import
org.springframework.context.annotation.AnnotationConfigApplicationContext
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
/**
* Tests for {@link ElasticsearchRepositoriesAutoConfiguration}.
*
* @author Phillip Webb
*/
public
class
ElasticsearchRepositoriesAutoConfigurationTests
{
private
AnnotationConfigApplicationContext
context
;
@After
public
void
close
()
{
this
.
context
.
close
();
}
@Test
public
void
testDefaultRepositoryConfiguration
()
throws
Exception
{
this
.
context
=
new
AnnotationConfigApplicationContext
();
this
.
context
.
register
(
TestConfiguration
.
class
,
ElasticsearchAutoConfiguration
.
class
,
ElasticsearchRepositoriesAutoConfiguration
.
class
,
ElasticsearchDataAutoConfiguration
.
class
,
PropertyPlaceholderAutoConfiguration
.
class
);
this
.
context
.
refresh
();
assertNotNull
(
this
.
context
.
getBean
(
CityRepository
.
class
));
assertNotNull
(
this
.
context
.
getBean
(
Client
.
class
));
}
@Test
public
void
testNoRepositoryConfiguration
()
throws
Exception
{
this
.
context
=
new
AnnotationConfigApplicationContext
();
this
.
context
.
register
(
EmptyConfiguration
.
class
,
ElasticsearchAutoConfiguration
.
class
,
ElasticsearchRepositoriesAutoConfiguration
.
class
,
ElasticsearchDataAutoConfiguration
.
class
,
PropertyPlaceholderAutoConfiguration
.
class
);
this
.
context
.
refresh
();
assertNotNull
(
this
.
context
.
getBean
(
Client
.
class
));
}
@Test
public
void
doesNotTriggerDefaultRepositoryDetectionIfCustomized
()
{
this
.
context
=
new
AnnotationConfigApplicationContext
();
this
.
context
.
register
(
CustomizedConfiguration
.
class
,
ElasticsearchAutoConfiguration
.
class
,
ElasticsearchRepositoriesAutoConfiguration
.
class
,
ElasticsearchDataAutoConfiguration
.
class
,
PropertyPlaceholderAutoConfiguration
.
class
);
this
.
context
.
refresh
();
assertNotNull
(
this
.
context
.
getBean
(
CityElasticsearchDbRepository
.
class
));
}
@Configuration
@TestAutoConfigurationPackage
(
City
.
class
)
protected
static
class
TestConfiguration
{
}
@Configuration
@TestAutoConfigurationPackage
(
EmptyDataPackage
.
class
)
protected
static
class
EmptyConfiguration
{
}
@Configuration
@TestAutoConfigurationPackage
(
ElasticsearchRepositoriesAutoConfigurationTests
.
class
)
@EnableElasticsearchRepositories
(
basePackageClasses
=
CityElasticsearchDbRepository
.
class
)
protected
static
class
CustomizedConfiguration
{
}
}
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/alt/elasticsearch/CityElasticsearchDbRepository.java
0 → 100644
View file @
e5cda040
/*
* Copyright 2012-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
boot
.
autoconfigure
.
data
.
alt
.
elasticsearch
;
import
org.springframework.boot.autoconfigure.data.elasticsearch.City
;
import
org.springframework.data.repository.Repository
;
public
interface
CityElasticsearchDbRepository
extends
Repository
<
City
,
Long
>
{
}
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/alt/jpa/CityJpaRepository.java
0 → 100644
View file @
e5cda040
/*
* Copyright 2012-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
boot
.
autoconfigure
.
data
.
alt
.
jpa
;
import
org.springframework.boot.autoconfigure.data.jpa.City
;
import
org.springframework.data.repository.Repository
;
public
interface
CityJpaRepository
extends
Repository
<
City
,
Long
>
{
}
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/alt/mongo/CityMongoDbRepository.java
0 → 100644
View file @
e5cda040
/*
* Copyright 2012-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
boot
.
autoconfigure
.
data
.
alt
.
mongo
;
import
org.springframework.boot.autoconfigure.data.mongo.City
;
import
org.springframework.data.repository.Repository
;
public
interface
CityMongoDbRepository
extends
Repository
<
City
,
Long
>
{
}
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/alt/solr/CitySolrRepository.java
0 → 100644
View file @
e5cda040
/*
* Copyright 2012-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
boot
.
autoconfigure
.
data
.
alt
.
solr
;
import
org.springframework.boot.autoconfigure.data.solr.City
;
import
org.springframework.data.repository.Repository
;
public
interface
CitySolrRepository
extends
Repository
<
City
,
String
>
{
}
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/elasticsearch/City.java
0 → 100644
View file @
e5cda040
/*
* Copyright 2012-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
boot
.
autoconfigure
.
data
.
elasticsearch
;
import
java.io.Serializable
;
import
org.springframework.data.annotation.Id
;
import
org.springframework.data.elasticsearch.annotations.Document
;
@Document
(
indexName
=
"city"
,
type
=
"city"
,
shards
=
1
,
replicas
=
0
,
refreshInterval
=
"-1"
)
public
class
City
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@Id
private
Long
id
;
private
String
name
;
private
String
state
;
private
String
country
;
private
String
map
;
protected
City
()
{
}
public
City
(
String
name
,
String
country
)
{
super
();
this
.
name
=
name
;
this
.
country
=
country
;
}
public
String
getName
()
{
return
this
.
name
;
}
public
String
getState
()
{
return
this
.
state
;
}
public
String
getCountry
()
{
return
this
.
country
;
}
public
String
getMap
()
{
return
this
.
map
;
}
@Override
public
String
toString
()
{
return
getName
()
+
","
+
getState
()
+
","
+
getCountry
();
}
}
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/elasticsearch/CityRepository.java
0 → 100644
View file @
e5cda040
/*
* Copyright 2012-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
boot
.
autoconfigure
.
data
.
elasticsearch
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.repository.Repository
;
public
interface
CityRepository
extends
Repository
<
City
,
Long
>
{
Page
<
City
>
findAll
(
Pageable
pageable
);
Page
<
City
>
findByNameLikeAndCountryLikeAllIgnoringCase
(
String
name
,
String
country
,
Pageable
pageable
);
City
findByNameAndCountryAllIgnoringCase
(
String
name
,
String
country
);
}
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/empty/EmptyDataPackage.java
0 → 100644
View file @
e5cda040
/*
* Copyright 2012-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
boot
.
autoconfigure
.
data
.
empty
;
/**
* Empty package used with data tests.
*
* @author Phillip Webb
*/
public
class
EmptyDataPackage
{
}
spring-boot-samples/spring-boot-sample-data-elasticsearch/.gitignore
View file @
e5cda040
data
/
data
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment