@Test public void testDisconnectedServer() { MockDisconnectedAssetPropertyIterator iterator = new MockDisconnectedAssetPropertyIterator(null, 10, 100); try { iterator.next(); assertTrue(false); } catch (OCFRuntimeException err) { assertTrue(err.getMessage().contains("OCF-PROPERTIES-404-002 ")); } catch (Throwable exc) { assertTrue(false); } }
@Override public AssetPropertyBase next() { if (this.hasNext()) { AssetPropertyBase retrievedElement; if (cachedElementPointer == cachedElementList.size()) { try { cachedElementList = iterator.getCachedList(cachedElementStart, maxCacheSize); cachedElementPointer = 0; } catch (PropertyServerException error) { throw new OCFRuntimeException(OCFErrorCode.PROPERTIES_NOT_AVAILABLE.getMessageDefinition(error.getReportedErrorMessage(), this.toString()), this.getClass().getName(), "next", error); } } retrievedElement = iterator.cloneElement(getParentAsset(), cachedElementList.get(cachedElementPointer)); cachedElementPointer++; cachedElementStart++; log.debug("Returning next element:"); log.debug("==> totalElementCount: " + totalElementCount); log.debug("==> cachedElementPointer: " + cachedElementPointer); log.debug("==> cachedElementStart:" + cachedElementStart); log.debug("==> maxCacheSize:" + maxCacheSize); return retrievedElement; } else { throw new OCFRuntimeException(OCFErrorCode.NO_MORE_ELEMENTS.getMessageDefinition(this.getClass().getSimpleName(), super.getParentAssetName(), super.getParentAssetTypeName()), this.getClass().getName(), "next"); } }
AssetPagingIterator extends AssetPropertyBase implements Iterator<AssetPropertyBase> { @Override public AssetPropertyBase next() { if (this.hasNext()) { AssetPropertyBase retrievedElement; if (cachedElementPointer == cachedElementList.size()) { try { cachedElementList = iterator.getCachedList(cachedElementStart, maxCacheSize); cachedElementPointer = 0; } catch (PropertyServerException error) { throw new OCFRuntimeException(OCFErrorCode.PROPERTIES_NOT_AVAILABLE.getMessageDefinition(error.getReportedErrorMessage(), this.toString()), this.getClass().getName(), "next", error); } } retrievedElement = iterator.cloneElement(getParentAsset(), cachedElementList.get(cachedElementPointer)); cachedElementPointer++; cachedElementStart++; log.debug("Returning next element:"); log.debug("==> totalElementCount: " + totalElementCount); log.debug("==> cachedElementPointer: " + cachedElementPointer); log.debug("==> cachedElementStart:" + cachedElementStart); log.debug("==> maxCacheSize:" + maxCacheSize); return retrievedElement; } else { throw new OCFRuntimeException(OCFErrorCode.NO_MORE_ELEMENTS.getMessageDefinition(this.getClass().getSimpleName(), super.getParentAssetName(), super.getParentAssetTypeName()), this.getClass().getName(), "next"); } } }
AssetPagingIterator extends AssetPropertyBase implements Iterator<AssetPropertyBase> { @Override public AssetPropertyBase next() { if (this.hasNext()) { AssetPropertyBase retrievedElement; if (cachedElementPointer == cachedElementList.size()) { try { cachedElementList = iterator.getCachedList(cachedElementStart, maxCacheSize); cachedElementPointer = 0; } catch (PropertyServerException error) { throw new OCFRuntimeException(OCFErrorCode.PROPERTIES_NOT_AVAILABLE.getMessageDefinition(error.getReportedErrorMessage(), this.toString()), this.getClass().getName(), "next", error); } } retrievedElement = iterator.cloneElement(getParentAsset(), cachedElementList.get(cachedElementPointer)); cachedElementPointer++; cachedElementStart++; log.debug("Returning next element:"); log.debug("==> totalElementCount: " + totalElementCount); log.debug("==> cachedElementPointer: " + cachedElementPointer); log.debug("==> cachedElementStart:" + cachedElementStart); log.debug("==> maxCacheSize:" + maxCacheSize); return retrievedElement; } else { throw new OCFRuntimeException(OCFErrorCode.NO_MORE_ELEMENTS.getMessageDefinition(this.getClass().getSimpleName(), super.getParentAssetName(), super.getParentAssetTypeName()), this.getClass().getName(), "next"); } } AssetPagingIterator(AssetDescriptor           parentAsset,
                               AssetPropertyIteratorBase iterator,
                               int                       totalElementCount,
                               int                       maxCacheSize);  AssetPagingIterator(AssetDescriptor           parentAsset,
                               AssetPropertyIteratorBase iterator,
                               AssetPagingIterator       templateIterator); }
AssetPagingIterator extends AssetPropertyBase implements Iterator<AssetPropertyBase> { @Override public AssetPropertyBase next() { if (this.hasNext()) { AssetPropertyBase retrievedElement; if (cachedElementPointer == cachedElementList.size()) { try { cachedElementList = iterator.getCachedList(cachedElementStart, maxCacheSize); cachedElementPointer = 0; } catch (PropertyServerException error) { throw new OCFRuntimeException(OCFErrorCode.PROPERTIES_NOT_AVAILABLE.getMessageDefinition(error.getReportedErrorMessage(), this.toString()), this.getClass().getName(), "next", error); } } retrievedElement = iterator.cloneElement(getParentAsset(), cachedElementList.get(cachedElementPointer)); cachedElementPointer++; cachedElementStart++; log.debug("Returning next element:"); log.debug("==> totalElementCount: " + totalElementCount); log.debug("==> cachedElementPointer: " + cachedElementPointer); log.debug("==> cachedElementStart:" + cachedElementStart); log.debug("==> maxCacheSize:" + maxCacheSize); return retrievedElement; } else { throw new OCFRuntimeException(OCFErrorCode.NO_MORE_ELEMENTS.getMessageDefinition(this.getClass().getSimpleName(), super.getParentAssetName(), super.getParentAssetTypeName()), this.getClass().getName(), "next"); } } AssetPagingIterator(AssetDescriptor           parentAsset,
                               AssetPropertyIteratorBase iterator,
                               int                       totalElementCount,
                               int                       maxCacheSize);  AssetPagingIterator(AssetDescriptor           parentAsset,
                               AssetPropertyIteratorBase iterator,
                               AssetPagingIterator       templateIterator); @Override boolean hasNext(); @Override AssetPropertyBase next(); int getElementCount(); @Override void remove(); @Override String toString(); }
AssetPagingIterator extends AssetPropertyBase implements Iterator<AssetPropertyBase> { @Override public AssetPropertyBase next() { if (this.hasNext()) { AssetPropertyBase retrievedElement; if (cachedElementPointer == cachedElementList.size()) { try { cachedElementList = iterator.getCachedList(cachedElementStart, maxCacheSize); cachedElementPointer = 0; } catch (PropertyServerException error) { throw new OCFRuntimeException(OCFErrorCode.PROPERTIES_NOT_AVAILABLE.getMessageDefinition(error.getReportedErrorMessage(), this.toString()), this.getClass().getName(), "next", error); } } retrievedElement = iterator.cloneElement(getParentAsset(), cachedElementList.get(cachedElementPointer)); cachedElementPointer++; cachedElementStart++; log.debug("Returning next element:"); log.debug("==> totalElementCount: " + totalElementCount); log.debug("==> cachedElementPointer: " + cachedElementPointer); log.debug("==> cachedElementStart:" + cachedElementStart); log.debug("==> maxCacheSize:" + maxCacheSize); return retrievedElement; } else { throw new OCFRuntimeException(OCFErrorCode.NO_MORE_ELEMENTS.getMessageDefinition(this.getClass().getSimpleName(), super.getParentAssetName(), super.getParentAssetTypeName()), this.getClass().getName(), "next"); } } AssetPagingIterator(AssetDescriptor           parentAsset,
                               AssetPropertyIteratorBase iterator,
                               int                       totalElementCount,
                               int                       maxCacheSize);  AssetPagingIterator(AssetDescriptor           parentAsset,
                               AssetPropertyIteratorBase iterator,
                               AssetPagingIterator       templateIterator); @Override boolean hasNext(); @Override AssetPropertyBase next(); int getElementCount(); @Override void remove(); @Override String toString();  }