-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from enginer/issue1
merge issue1 to master
- Loading branch information
Showing
14 changed files
with
134 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.ayfaar.app.utils; | ||
|
||
import org.apache.commons.lang.NotImplementedException; | ||
|
||
public class ItemsCleaner { | ||
public static String clean(String value) { | ||
// fixme: issue#2 | ||
throw new NotImplementedException("issue#2"); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/main/java/org/ayfaar/app/utils/servlet/AddAccessControlAllowOriginFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package org.ayfaar.app.utils.servlet; | ||
|
||
import org.springframework.web.filter.OncePerRequestFilter; | ||
|
||
import javax.servlet.FilterChain; | ||
import javax.servlet.ServletException; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
import java.io.IOException; | ||
|
||
/** | ||
* From http://stackoverflow.com/a/16191770/975169 | ||
*/ | ||
public class AddAccessControlAllowOriginFilter extends OncePerRequestFilter { | ||
@Override | ||
protected void doFilterInternal(HttpServletRequest request, | ||
HttpServletResponse response, FilterChain filterChain) | ||
throws ServletException, IOException { | ||
response.addHeader("Access-Control-Allow-Origin", "*"); | ||
if (request.getHeader("Access-Control-Request-Method") != null | ||
&& "OPTIONS".equals(request.getMethod())) { | ||
response.addHeader("Access-Control-Allow-Methods", | ||
"GET, POST, PUT, DELETE"); | ||
response.addHeader("Access-Control-Allow-Headers", | ||
"X-Requested-With,Origin,Content-Type, Accept"); | ||
} | ||
filterChain.doFilter(request, response); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package issues.issue2; | ||
|
||
import org.ayfaar.app.IntegrationTest; | ||
import org.ayfaar.app.dao.ItemDao; | ||
import org.ayfaar.app.model.Item; | ||
import org.junit.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.beans.factory.annotation.Value; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
public class Issue2IntegrationTest extends IntegrationTest { | ||
|
||
@Value("#{T(org.apache.commons.io.FileUtils).readFileToString(" + | ||
"T(org.springframework.util.ResourceUtils).getFile('classpath:issues/issue2/clean-item-3.0089.txt')" + | ||
")}") | ||
String itemExpectedContent; | ||
|
||
@Autowired ItemDao itemDao; | ||
|
||
@Test | ||
public void checkParticularItem() { | ||
Item item = itemDao.getByNumber("3.0089"); | ||
assertEquals(itemExpectedContent, item.getContent()); | ||
} | ||
|
||
// Ещё нужен тест на то, что больше ни в одном item нет слова Глава | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package issues.issue2; | ||
|
||
import org.apache.commons.io.IOUtils; | ||
import org.ayfaar.app.utils.ItemsCleaner; | ||
import org.junit.Test; | ||
|
||
import java.io.IOException; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
public class Issue2UnitTest { | ||
|
||
@Test | ||
public void test1() throws IOException { | ||
String valueWithBug = IOUtils.toString(Issue2UnitTest.class.getResourceAsStream("clean-item-3.0089.txt")); | ||
String expectedValue = IOUtils.toString(Issue2UnitTest.class.getResourceAsStream("dirty-item-3.0089.txt")); | ||
String actualValue = ItemsCleaner.clean(valueWithBug); | ||
assertEquals(expectedValue, actualValue); | ||
} | ||
|
||
// todo: проверить на null, пустую строку | ||
// todo: придумать ещё варианты тестов :) | ||
} |
14 changes: 5 additions & 9 deletions
14
src/test/java/IntegrationTest.java → .../java/org/ayfaar/app/IntegrationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,18 @@ | ||
import org.ayfaar.app.SpringTestConfiguration; | ||
import org.ayfaar.app.dao.ItemDao; | ||
import org.ayfaar.app.model.Item; | ||
import org.junit.Test; | ||
package org.ayfaar.app; | ||
|
||
import org.junit.runner.RunWith; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.test.context.ContextConfiguration; | ||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | ||
|
||
import static org.junit.Assert.assertNotNull; | ||
|
||
@RunWith(SpringJUnit4ClassRunner.class) | ||
@ContextConfiguration(classes = SpringTestConfiguration.class) | ||
public class IntegrationTest { | ||
@Autowired ItemDao itemDao; | ||
/*@Autowired | ||
ItemDao itemDao; | ||
@Test | ||
public void integrationTest() { | ||
Item item = itemDao.getByNumber("1.0001"); | ||
assertNotNull(item); | ||
} | ||
}*/ | ||
} |
2 changes: 2 additions & 0 deletions
2
src/test/java/MorphTest.java → .../java/org/ayfaar/app/utils/MorphTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
src/test/java/RegExpTest.java → ...java/org/ayfaar/app/utils/RegExpTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
package org.ayfaar.app.utils; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
В сллоогрентной Фокусной Динамике Формо-Творцов данного типа Коллективного Сознания человечества всё ещё преобладают СФУУРММ-Формы низкокачественного (то есть недосинтезированного по множеству Аспектов каждого из ЧКК) Опыта, который и является главной причиной той повышенной психоментальной имперсептности и даже крувурсорртности (нравственной, культурной, политической, религиозной, национальной и тому подобное), наблюдаемой нами в современном человеческом сообществе. Поэтому ф-Конфигурации большинства людей пока что продолжают структурироваться ф-Конфигурациями всего лишь 386 (в среднем!) дооллсовых «личностей». Но у тех, кто активно занимается интеллектуальным и духовным самосовершенствованием, этот показатель непрерывно повышается и всевозможные признаки слабонутационного дооллсового режима Существования постепенно теряются в повышенной коварллертности меж-Качественных взаимосвязей. Поэтому в более амплиативных из наших Форм Самосознаний количество ф-Конфигураций, структурирующих каждый из наших одномоментных волновых Стерео-Типов, постоянно увеличивается. При перефокусировании во флаксовые режимы Существования, количество Стерео-Типов, структурирующих ф-Конфигурацию проявления каждой флаксовой «личности», будет представлять собой интеграл гейлитургентных между собой ф-Конфигураций абсолютно всех микстумных и димидиомиттенсных Формо-Типов данной ЛЛУУ-ВВУ-Сущности. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
В сллоогрентной Фокусной Динамике Формо-Творцов данного типа Коллективного Сознания человечества всё ещё преобладают СФУУРММ-Формы низкокачественного (то есть недосинтезированного по множеству Аспектов каждого из ЧКК) Опыта, который и является главной причиной той повышенной психоментальной имперсептности и даже крувурсорртности (нравственной, культурной, политической, религиозной, национальной и тому подобное), наблюдаемой нами в современном человеческом сообществе. Поэтому ф-Конфигурации большинства людей пока что продолжают структурироваться ф-Конфигурациями всего лишь 386 (в среднем!) дооллсовых «личностей». Но у тех, кто активно занимается интеллектуальным и духовным самосовершенствованием, этот показатель непрерывно повышается и всевозможные признаки слабонутационного дооллсового режима Существования постепенно теряются в повышенной коварллертности меж-Качественных взаимосвязей. Поэтому в более амплиативных из наших Форм Самосознаний количество ф-Конфигураций, структурирующих каждый из наших одномоментных волновых Стерео-Типов, постоянно увеличивается. При перефокусировании во флаксовые режимы Существования, количество Стерео-Типов, структурирующих ф-Конфигурацию проявления каждой флаксовой «личности», будет представлять собой интеграл гейлитургентных между собой ф-Конфигураций абсолютно всех микстумных и димидиомиттенсных Формо-Типов данной ЛЛУУ-ВВУ-Сущности. | ||
|
||
Глава 4. Конкретизация окружающей нас субъективной Реальности осуществляется благодаря генерациям Форм Самосознаний элементарных частиц |