"실패"당신이 또는 이와 유사한 "예외가 발생"을 의미한다. 그렇다면 WEB-INF/datastore-indexes.xml
의 autoGenerate
속성을 false로 설정해야합니다.
예 WEB-INF/datastore-indexes.xml
: 복합 인덱스가 예외를 던질 필요로하는 쿼리를 만들 것입니다 false로 autoGenerate
설정
<datastore-indexes autoGenerate="false">
</datastore-indexes>
. 예제 코드 :
SEVERE: com.google.appengine.api.datastore.DatastoreNeedIndexException: Query com.google.appengine.api.datastore.dev.LocalCompositeIndexManager$IndexComponentsO
[email protected] requires a composite index that is not defined. You must update C:\appengine-java-sdk\dev\core1\war\WEB-INF\datastore-indexes.xml or enable au
toGenerate to have it automatically added.
The suggested index for this query is:
<datastore-index kind="Action" ancestor="false" source="manual">
<property name="encrypter" direction="asc"/>
<property name="requester" direction="asc"/>
<property name="time" direction="desc"/>
</datastore-index>
자세한 내용은 datastore-indexes.xml reference를 참조하십시오
try {
Query q = new Query("Action")
.addSort("encrypter", Query.SortDirection.ASCENDING)
.addSort("requester", Query.SortDirection.ASCENDING)
.addSort("time", Query.SortDirection.DESCENDING);
//...snip...
} catch (Exception e) {
log.severe(e.toString());
}
나는 예상대로 기록 예외를이 테스트를하고 있어요.
출처
2017-01-22 18:37:10
Rei
단원 테스트에서이 오류가 발생하는 예가 있습니까? 이 설정을 가지고 있으며 dev 서버에서 실행 중일 때 쿼리가 실패하지만 동일한 쿼리를 실행하는 테스트가 실패하지는 않습니다. 아마도 테스트를 위해 파일을 읽도록 구성해야하는 다른 것이있을 것입니다. –
재생산을 위해 테스트 작성 방법에 대한 최소한의 실무 사례를 제공 할 수 있습니까? 또는 다음과 같이 정의 된 XmlDocument 개체에 대해 쿼리를 실행 해보십시오. 'XmlDocument doc = new XmlDocument(); doc.Load (xmlFilePath);' – Alex