|
1 | 1 | /*
|
2 |
| - * Copyright 2008-2015 the original author or authors. |
| 2 | + * Copyright 2008-2016 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
26 | 26 | import org.junit.Test;
|
27 | 27 | import org.junit.runner.RunWith;
|
28 | 28 | import org.springframework.beans.factory.annotation.Autowired;
|
| 29 | +import org.springframework.dao.InvalidDataAccessApiUsageException; |
29 | 30 | import org.springframework.data.domain.Page;
|
30 | 31 | import org.springframework.data.domain.PageRequest;
|
31 | 32 | import org.springframework.data.domain.Slice;
|
|
37 | 38 | import org.springframework.data.repository.query.QueryLookupStrategy;
|
38 | 39 | import org.springframework.test.context.ContextConfiguration;
|
39 | 40 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
| 41 | +import org.springframework.transaction.annotation.Propagation; |
40 | 42 | import org.springframework.transaction.annotation.Transactional;
|
41 | 43 |
|
42 | 44 | /**
|
@@ -234,4 +236,19 @@ public void translatesNotContainsToNotMemberOf() {
|
234 | 236 | public void executesQueryWithProjectionContainingReferenceToPluralAttribute() {
|
235 | 237 | assertThat(userRepository.findRolesAndFirstnameBy(), is(notNullValue()));
|
236 | 238 | }
|
| 239 | + |
| 240 | + /** |
| 241 | + * @see DATAJPA-1023, DATACMNS-959 |
| 242 | + */ |
| 243 | + @Test(expected = InvalidDataAccessApiUsageException.class) |
| 244 | + @Transactional(propagation = Propagation.NOT_SUPPORTED) |
| 245 | + public void rejectsStreamExecutionIfNoSurroundingTransactionActive() { |
| 246 | + |
| 247 | + try { |
| 248 | + userRepository.findAllByCustomQueryAndStream(); |
| 249 | + } finally { |
| 250 | + roleRepository.deleteAll(); |
| 251 | + userRepository.deleteAll(); |
| 252 | + } |
| 253 | + } |
237 | 254 | }
|
0 commit comments