Search Java Code Snippets


  Help us in improving the repository. Add new snippets through 'Submit Code Snippet ' link.





Java - Code Samples

 Sample 1. Code Sample / Example / Snippet of org.apache.ace.repository.ext.BackupRepository

    public void testInitialCheckout() throws IllegalArgumentException, IOException {

Repository m_repository = new MockRepository();

byte[] testContent = new byte[] {'i', 'n', 'i', 't', 'i', 'a', 'l'};

m_repository.commit(new ByteArrayInputStream(testContent), 0);

BackupRepository m_backupRepository = new MockBackupRepository();



CachedRepository m_cachedRepository = new CachedRepositoryImpl(m_repository, m_backupRepository, 0);



InputStream input = m_cachedRepository.checkout(1);

byte[] inputBytes = AdminTestUtil.copy(input);

assert AdminTestUtil.byteArraysEqual(inputBytes, testContent) : "We got something different than 'initial' from checkout: " + new String(inputBytes);

input = m_cachedRepository.getLocal(false);

inputBytes = AdminTestUtil.copy(input);

assert AdminTestUtil.byteArraysEqual(inputBytes, testContent) : "We got something different than 'initial' from getLocal: " + new String(inputBytes);

input = m_backupRepository.read();

inputBytes = AdminTestUtil.copy(input);

assert AdminTestUtil.byteArraysEqual(inputBytes, testContent) : "We got something different than 'initial' from the backup repository: " + new String(inputBytes);

}


   Like      Feedback      org.apache.ace.repository.ext.BackupRepository



Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner