DATAREST-730 - Temporarily remove integration tests for Neo4j.

This commit is contained in:
Oliver Gierke
2015-12-16 16:45:41 +01:00
parent 414f314684
commit 1b99111634
9 changed files with 0 additions and 397 deletions

View File

@@ -31,7 +31,6 @@
<springdata.commons>1.12.0.BUILD-SNAPSHOT</springdata.commons>
<springdata.jpa>1.10.0.BUILD-SNAPSHOT</springdata.jpa>
<springdata.mongodb>1.9.0.BUILD-SNAPSHOT</springdata.mongodb>
<springdata.neo4j>3.5.0.BUILD-SNAPSHOT</springdata.neo4j>
<springdata.gemfire>1.8.0.BUILD-SNAPSHOT</springdata.gemfire>
<springdata.solr>1.6.0.BUILD-SNAPSHOT</springdata.solr>
<springdata.cassandra>1.4.0.BUILD-SNAPSHOT</springdata.cassandra>

View File

@@ -145,24 +145,6 @@
</profile>
<profile>
<id>neo4j</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<dependencies>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j</artifactId>
<version>${springdata.neo4j}</version>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
<profile>
<id>gemfire</id>

View File

@@ -1,47 +0,0 @@
/*
* 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.data.rest.webmvc.neo4j;
import org.springframework.data.neo4j.annotation.GraphId;
public abstract class AbstractEntity {
@GraphId//
private Long id;
public Long getId() {
return id;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (id == null || obj == null || !getClass().equals(obj.getClass())) {
return false;
}
return id.equals(((AbstractEntity) obj).id);
}
@Override
public int hashCode() {
return id == null ? 0 : id.hashCode();
}
}

View File

@@ -1,48 +0,0 @@
/*
* 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.data.rest.webmvc.neo4j;
import org.springframework.data.neo4j.annotation.NodeEntity;
@NodeEntity
public class Address extends AbstractEntity {
private String street, city;
private Country country;
public Address(String street, String city, Country country) {
this.street = street;
this.city = city;
this.country = country;
}
public Address() {
}
public String getStreet() {
return street;
}
public String getCity() {
return city;
}
public Country getCountry() {
return country;
}
}

View File

@@ -1,33 +0,0 @@
/*
* 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.data.rest.webmvc.neo4j;
import org.springframework.data.neo4j.annotation.Indexed;
import org.springframework.data.neo4j.annotation.NodeEntity;
@NodeEntity
public class Country extends AbstractEntity {
@Indexed(unique = true) String code;
String name;
public Country(String code, String name) {
this.code = code;
this.name = name;
}
public Country() {}
}

View File

@@ -1,88 +0,0 @@
/*
* 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.data.rest.webmvc.neo4j;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import org.springframework.data.neo4j.annotation.Indexed;
import org.springframework.data.neo4j.annotation.NodeEntity;
import org.springframework.data.neo4j.annotation.RelatedTo;
import org.springframework.util.Assert;
@NodeEntity
public class Customer extends AbstractEntity {
private String firstName, lastName;
@Indexed(unique = true)//
private String emailAddress;
@RelatedTo(type = "ADDRESS")//
private Set<Address> addresses = new HashSet<Address>();
public Customer(String firstName, String lastName, String emailAddress) {
Assert.hasText(firstName);
Assert.hasText(lastName);
Assert.hasText(emailAddress);
this.firstName = firstName;
this.lastName = lastName;
this.emailAddress = emailAddress;
}
protected Customer() {
}
public void add(Address address) {
this.addresses.add(address);
}
public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getEmailAddress() {
return emailAddress;
}
public void setEmailAddress(String emailAddress) {
this.emailAddress = emailAddress;
}
public Set<Address> getAddresses() {
return Collections.unmodifiableSet(addresses);
}
public boolean hasAddress(Address address) {
return addresses.contains(address);
}
@Override
public String toString() {
return String.format("%s %s <%s>", firstName, lastName, emailAddress);
}
}

View File

@@ -1,23 +0,0 @@
/*
* 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.data.rest.webmvc.neo4j;
import org.springframework.data.neo4j.repository.GraphRepository;
public interface CustomerRepository extends GraphRepository<Customer> {
Customer findByEmailAddress(String emailAddress);
}

View File

@@ -1,98 +0,0 @@
/*
* Copyright 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.data.rest.webmvc.neo4j;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import java.util.Arrays;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.factory.GraphDatabaseFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.neo4j.config.EnableNeo4jRepositories;
import org.springframework.data.neo4j.config.Neo4jConfiguration;
import org.springframework.data.rest.webmvc.CommonWebTests;
import org.springframework.hateoas.Link;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.transaction.annotation.EnableTransactionManagement;
/**
* Integration tests for exposed Neo4j repositories.
*
* @author Oliver Gierke
*/
@ContextConfiguration
@Ignore
public class Neo4jWebTests extends CommonWebTests {
@Configuration
@ComponentScan
@EnableNeo4jRepositories
@EnableTransactionManagement
static class TestConfig extends Neo4jConfiguration {
public TestConfig() {
setBasePackage(Neo4jWebTests.class.getPackage().getName());
}
@Bean(destroyMethod = "shutdown")
public GraphDatabaseService graphDatabaseService() {
return new GraphDatabaseFactory().newEmbeddedDatabase("target/graphdb");
}
}
@Autowired TestDataPopulator populator;
@Before
@Override
public void setUp() {
this.populator.populate();
super.setUp();
}
/*
* (non-Javadoc)
* @see org.springframework.data.rest.webmvc.AbstractWebIntegrationTests#expectedRootLinkRels()
*/
@Override
protected Iterable<String> expectedRootLinkRels() {
return Arrays.asList("customers");
}
/**
* @see DATAREST-184
*/
@Test
public void deletesCustomer() throws Exception {
// Lookup customer
Link customers = client.discoverUnique("customers");
Link customerLink = assertHasContentLinkWithRel("self", client.request(customers));
// Delete customer
mvc.perform(delete(customerLink.getHref()));
// Assert no customers anymore
assertDoesNotHaveContentLinkWithRel("self", client.request(customers));
}
}

View File

@@ -1,41 +0,0 @@
/*
* Copyright 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.data.rest.webmvc.neo4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
/**
* Simple component to populate the Neo4j repositories with sample data.
*
* @author Oliver Gierke
*/
@Component
public class TestDataPopulator {
@Autowired CustomerRepository repository;
@Transactional
public void populate() {
if (repository.count() > 0) {
return;
}
repository.save(new Customer("Oliver", "Gierke", "ogierke@gopivotal.com"));
}
}