本文整理汇总了Java中com.autonomy.aci.client.services.AciErrorException类的典型用法代码示例。如果您正苦于以下问题:Java AciErrorException类的具体用法?Java AciErrorException怎么用?Java AciErrorException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AciErrorException类属于com.autonomy.aci.client.services包,在下文中一共展示了AciErrorException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDocumentContent
import com.autonomy.aci.client.services.AciErrorException; //导入依赖的package包/类
@Override
public List<IdolSearchResult> getDocumentContent(final IdolGetContentRequest request) throws AciErrorException {
final List<IdolSearchResult> results = new ArrayList<>(request.getIndexesAndReferences().size());
for(final IdolGetContentRequestIndex indexAndReferences : request.getIndexesAndReferences()) {
// We use Query and not GetContent here so we can use Combine=simple to ensure returned references are unique
final AciParameters aciParameters = new AciParameters(QueryActions.Query.name());
parameterHandler.addGetDocumentOutputParameters(aciParameters, indexAndReferences, request.getPrint());
final QueryResponseData responseData = queryExecutor.executeQuery(aciParameters, QueryRequest.QueryType.RAW);
final List<Hit> hits = responseData.getHits();
results.addAll(queryResponseParser.parseQueryHits(hits));
}
return results;
}
示例2: getParametricValues
import com.autonomy.aci.client.services.AciErrorException; //导入依赖的package包/类
@Override
public Set<QueryTagInfo> getParametricValues(final IdolParametricRequest parametricRequest) throws AciErrorException {
final Collection<FieldPath> fieldNames = new HashSet<>();
fieldNames.addAll(parametricRequest.getFieldNames());
if(fieldNames.isEmpty()) {
fieldNames.addAll(lookupFields());
}
return fieldNames.isEmpty()
? Collections.emptySet()
: getFlatFields(parametricRequest, fieldNames)
.stream()
.map(this::flatFieldToTagInfo)
.filter(queryTagInfo -> !queryTagInfo.getValues().isEmpty())
.collect(Collectors.toCollection(LinkedHashSet::new));
}
示例3: getDependentParametricValues
import com.autonomy.aci.client.services.AciErrorException; //导入依赖的package包/类
@Override
public List<DependentParametricField> getDependentParametricValues(final IdolParametricRequest parametricRequest) throws AciErrorException {
final Collection<FieldPath> fieldNames = new ArrayList<>();
fieldNames.addAll(parametricRequest.getFieldNames());
if(fieldNames.isEmpty()) {
fieldNames.addAll(lookupFields());
}
final List<DependentParametricField> results;
if(fieldNames.isEmpty()) {
results = Collections.emptyList();
} else {
final AciParameters aciParameters = createAciParameters(parametricRequest, fieldNames);
aciParameters.add(GetQueryTagValuesParams.FieldDependence.name(), true);
aciParameters.add(GetQueryTagValuesParams.FieldDependenceMultiLevel.name(), true);
final GetQueryTagValuesResponseData responseData = executeAction(parametricRequest, aciParameters);
results = responseData.getField().isEmpty() || responseData.getValues() == null
? Collections.emptyList()
: addDisplayNamesToRecursiveFields(responseData.getValues().getField(), responseData.getField().get(0).getName());
}
return results;
}
示例4: getFields
import com.autonomy.aci.client.services.AciErrorException; //导入依赖的package包/类
@Override
@Cacheable(CacheNames.FIELDS)
public Map<FieldTypeParam, Set<TagName>> getFields(final IdolFieldsRequest request) throws AciErrorException {
final AciParameters aciParameters = new AciParameters(TagActions.GetTagNames.name());
Optional.ofNullable(request.getFieldTypes()).ifPresent(fieldTypes ->
aciParameters.add(GetTagNamesParams.FieldType.name(), String.join(",", fieldTypes.stream().map(FieldTypeParam::name).collect(Collectors.toList()))));
aciParameters.add(GetTagNamesParams.MaxValues.name(), request.getMaxValues());
aciParameters.add(GetTagNamesParams.TypeDetails.name(), true);
final GetTagNamesResponseData responseData = contentAciService.executeAction(aciParameters, tagNamesResponseProcessor);
return responseData.getName().stream()
.filter(name -> name.getTypes() != null)
.flatMap(name -> Arrays.stream(name.getTypes().split(",")).map(type -> new ImmutablePair<>(type, name.getValue())))
.filter(entry -> recognisableType(entry.getLeft()))
.collect(Collectors.groupingBy(entry -> FieldTypeParam.fromValue(entry.getKey()), Collectors.mapping(entry -> tagNameFactory.buildTagName(entry.getValue()), Collectors.toSet())));
}
示例5: queryWithInvalidAutoCorrect
import com.autonomy.aci.client.services.AciErrorException; //导入依赖的package包/类
@Test(expected = AutoCorrectException.class)
public void queryWithInvalidAutoCorrect() throws AciErrorException {
final IdolQueryRequest queryRequest = queryRequestBuilderFactory.getObject()
.queryRestrictions(queryRestrictionsBuilder.getObject()
.queryText("XORApple")
.fieldText("")
.databases(integrationTestUtils.buildQueryRestrictions().getDatabases())
.minDate(null)
.maxDate(ZonedDateTime.now())
.minScore(0)
.languageType(null)
.anyLanguage(true)
.stateMatchIds(Collections.emptyList())
.stateDontMatchIds(Collections.emptyList())
.build())
.autoCorrect(true)
.build();
documentsService.queryTextIndex(queryRequest);
}
示例6: process
import com.autonomy.aci.client.services.AciErrorException; //导入依赖的package包/类
@Override
public byte[] process(final XMLStreamReader idolResponse) throws AciErrorException, ProcessorException {
try {
if (isErrorResponse(idolResponse)) {
setErrorProcessor(new ErrorProcessor());
processErrorResponse(idolResponse);
}
while (idolResponse.hasNext()) {
// Get the event type...
final int eventType = idolResponse.next();
if ((XMLEvent.START_ELEMENT == eventType) && "context".equals(idolResponse.getLocalName())) {
return Base64.decodeBase64(idolResponse.getElementText().getBytes());
}
}
throw new ProcessorException("Unable to establish the GSSContext as no context was returned from the ACI Server.");
} catch (final XMLStreamException xmlse) {
throw new ProcessorException("Unable to get context information.", xmlse);
}
}
示例7: process
import com.autonomy.aci.client.services.AciErrorException; //导入依赖的package包/类
@Override
public ByteArrayInputStream process(final XMLStreamReader aciResponse) throws AciErrorException, ProcessorException {
try {
while (aciResponse.hasNext()) {
// Get the event type...
final int eventType = aciResponse.next();
if ((eventType == XMLEvent.START_ELEMENT) && "autn:encrypteddata".equals(aciResponse.getLocalName())) {
LOGGER.debug("Found an encrypted data block, decrypting and appending to buffer...");
buffer.write(encryptionCodec.decrypt(EncryptionCodecUtils.getInstance().toBytes(aciResponse.getElementText(), charsetName)));
}
}
// Return the decrypted response...
return new ByteArrayInputStream(buffer.toByteArray());
} catch (final XMLStreamException xmlse) {
throw new ProcessorException("Unable to decrypt the ACI response due to a problem with the input stream.", xmlse);
} catch (final IOException ioe) {
throw new ProcessorException("Unable to decrypt the ACI response due to an IOException.", ioe);
} catch (final EncryptionCodecException ece) {
throw new ProcessorException("Unable to decrypt the ACI response.", ece);
}
}
示例8: testFullErrorResponse
import com.autonomy.aci.client.services.AciErrorException; //导入依赖的package包/类
@Test
public void testFullErrorResponse() throws XMLStreamException, AciErrorException, ProcessorException {
try {
// Execute the processor...
processor.process(XmlTestUtils.getResourceAsXMLStreamReader("/com/autonomy/aci/client/services/processor/errorProcessorTestFullErrorResponse.xml"));
fail("Should have thrown an AciErrorException");
} catch (final AciErrorException exception) {
// Check it...
assertThat("errorId property not as expected.", exception.getErrorId(), is(equalTo("AutonomyIDOLServerWOBBLE1")));
assertThat("rawErrorId property not as expected.", exception.getRawErrorId(), is(nullValue()));
assertThat("errorString property not as expected.", exception.getErrorString(), is(equalTo("ERROR")));
assertThat("errorDescription property not as expected.", exception.getErrorDescription(), is(equalTo("The requested action was not recognised")));
assertThat("errorCode property not as expected.", exception.getErrorCode(), is(equalTo("ERRORNOTIMPLEMENTED")));
assertThat("errorTime property not as expected.", DateFormatUtils.format(exception.getErrorTime(), "dd MMM yy HH:mm:ss"), is(equalTo("06 Feb 06 17:03:54")));
}
}
示例9: testFullErrorResponseRawErrorId
import com.autonomy.aci.client.services.AciErrorException; //导入依赖的package包/类
@Test
public void testFullErrorResponseRawErrorId() throws XMLStreamException, AciErrorException, ProcessorException {
try {
// Execute the processor...
processor.process(XmlTestUtils.getResourceAsXMLStreamReader("/com/autonomy/aci/client/services/processor/errorProcessorTestFullErrorResponseRawErrorId.xml"));
fail("Should have thrown an AciErrorException");
} catch (final AciErrorException exception) {
// Check it...
assertThat("errorId property not as expected.", exception.getErrorId(), is(equalTo("DAHGETQUERYTAGVALUES525")));
assertThat("rawErrorId property not as expected.", exception.getRawErrorId(), is(equalTo("0x20D")));
assertThat("errorString property not as expected.", exception.getErrorString(), is(equalTo("No valid parametric fields")));
assertThat("errorDescription property not as expected.", exception.getErrorDescription(), is(equalTo("The fieldname parameter contained no valid parametric fields")));
assertThat("errorCode property not as expected.", exception.getErrorCode(), is(equalTo("ERRORPARAMINVALID")));
assertThat("errorTime property not as expected.", DateFormatUtils.format(exception.getErrorTime(), "dd MMM yy HH:mm:ss"), is(equalTo("09 Jul 08 15:48:22")));
}
}
示例10: testBadErrorTimeResponse
import com.autonomy.aci.client.services.AciErrorException; //导入依赖的package包/类
@Test
public void testBadErrorTimeResponse() throws XMLStreamException, AciErrorException, ProcessorException {
try {
// Execute the processor...
processor.process(XmlTestUtils.getResourceAsXMLStreamReader("/com/autonomy/aci/client/services/processor/errorProcessorTestBadErrorTimeResponse.xml"));
fail("Should have thrown an AciErrorException");
} catch (final AciErrorException exception) {
// Check it...
assertThat("errorId property not as expected.", exception.getErrorId(), is(equalTo("AutonomyIDOLServerWOBBLE1")));
assertThat("rawErrorId property not as expected.", exception.getRawErrorId(), is(nullValue()));
assertThat("errorString property not as expected.", exception.getErrorString(), is(equalTo("ERROR")));
assertThat("errorDescription property not as expected.", exception.getErrorDescription(), is(equalTo("The requested action was not recognised")));
assertThat("errorCode property not as expected.", exception.getErrorCode(), is(equalTo("ERRORNOTIMPLEMENTED")));
assertThat("errorTime property not as expected.", exception.getErrorTime(), is(nullValue()));
}
}
示例11: testPartialErrorResponse
import com.autonomy.aci.client.services.AciErrorException; //导入依赖的package包/类
@Test
public void testPartialErrorResponse() throws XMLStreamException, AciErrorException, ProcessorException {
try {
// Execute the processor...
processor.process(XmlTestUtils.getResourceAsXMLStreamReader("/com/autonomy/aci/client/services/processor/errorProcessorTestPartialErrorResponse.xml"));
fail("Should have thrown an AciErrorException");
} catch (final AciErrorException exception) {
// Check it...
assertThat("errorId property not as expected.", exception.getErrorId(), is(equalTo("AutonomyIDOLServerWOBBLE1")));
assertThat("rawErrorId property not as expected.", exception.getRawErrorId(), is(nullValue()));
assertThat("errorString property not as expected.", exception.getErrorString(), is(equalTo("ERROR")));
assertThat("errorDescription property not as expected.", exception.getErrorDescription(), is(equalTo("The requested action was not recognised")));
assertThat("errorCode property not as expected.", exception.getErrorCode(), is(equalTo("ERRORNOTIMPLEMENTED")));
assertThat("errorTime property not as expected.", DateFormatUtils.format(exception.getErrorTime(), "dd MMM yy HH:mm:ss"), is(equalTo("06 Feb 06 17:03:54")));
}
}
示例12: testErrorResponse
import com.autonomy.aci.client.services.AciErrorException; //导入依赖的package包/类
@Test(expected = AciErrorException.class)
public void testErrorResponse() throws IOException, ProcessorException, AciErrorException {
// Create the "response" and give it a content type...
final InputStreamEntity inputStreamEntity = new InputStreamEntity(getClass().getResourceAsStream("/AciException-1.xml"), -1);
inputStreamEntity.setContentType("text/xml");
// Create a response...
final BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
response.setEntity(inputStreamEntity);
// Set the AciResponseInputStream...
final AciResponseInputStream stream = new AciResponseInputStreamImpl(response);
// Process...
processor.process(stream);
fail("Should have thrown a AciErrorException.");
}
示例13: testXmlResponse
import com.autonomy.aci.client.services.AciErrorException; //导入依赖的package包/类
@Test(expected = AciErrorException.class)
public void testXmlResponse() throws IOException, ProcessorException, AciErrorException {
// Create the "response" and give it a content type...
final InputStreamEntity inputStreamEntity = new InputStreamEntity(getClass().getResourceAsStream("/GetVersion.xml"), -1);
inputStreamEntity.setContentType("text/xml");
// Create a response...
final BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
response.setEntity(inputStreamEntity);
// Set the AciResponseInputStream...
final AciResponseInputStream stream = new AciResponseInputStreamImpl(response);
// Process...
processor.process(stream);
fail("Should have thrown a AciErrorException.");
}
示例14: testNonXmlResponse
import com.autonomy.aci.client.services.AciErrorException; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void testNonXmlResponse() throws IOException, ProcessorException, AciErrorException {
// This is the "known" response...
final String string = "This is a test...";
// Create the "response" and give it a content type...
final StringEntity stringEntity = new StringEntity(string);
stringEntity.setContentType("text/text");
// Create a response...
final BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
response.setEntity(stringEntity);
// Set the AciResponseInputStream...
final AciResponseInputStream stream = new AciResponseInputStreamImpl(response);
// Process...
final byte[] result = processor.process(stream);
assertThat("result is wrong", new String(result, "UTF-8"), is(equalTo(string)));
}
示例15: testConvertACIResponseToDOMInvalidDocumentBuilderFactory
import com.autonomy.aci.client.services.AciErrorException; //导入依赖的package包/类
@Test(expected = FactoryConfigurationError.class)
public void testConvertACIResponseToDOMInvalidDocumentBuilderFactory() throws AciErrorException, IOException, ProcessorException {
// Set a duff property for the DocumentBuilderFactory...
System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "com.autonomy.DuffDocumentBuilderFactory");
try {
// Setup with a proper XML response file...
final BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
response.setEntity(new InputStreamEntity(getClass().getResourceAsStream("/GetVersion.xml"), -1));
// Set the AciResponseInputStream...
final AciResponseInputStream stream = new AciResponseInputStreamImpl(response);
// Process...
processor.process(stream);
fail("Should have raised an ProcessorException.");
} finally {
// Remove the duff system property...
System.clearProperty("javax.xml.parsers.DocumentBuilderFactory");
}
}