diff --git a/.circleci/config.yml b/.circleci/config.yml index e047c0f28f..ea48c06829 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -22,11 +22,6 @@ jobs: JVM_OPTS: -Xmx1024m steps: - checkout - - - run: - name: test - command : | - mkdir -p ~/.gradle && echo "org.gradle.daemon=false" >> ~/.gradle/gradle.properties - run: name: run unit tests command: | @@ -215,7 +210,9 @@ jobs: version=2.10.0 sdkversion="aws-android-sdk-$version" echo "sdkversion=$sdkversion" >> $BASH_ENV - git checkout resource aws-android-sdk + git checkout resources + git checkout master + git checkout resources aws-android-sdk mv aws-android-sdk "$sdkversion" - run: name: copy libs @@ -232,12 +229,12 @@ jobs: cp -R docs/reference/* "$sdkversion/documentation/javadoc" - run: name: zip sdk folder + command: | zip -r "$sdkversion.zip" "$sdkversion" - run: name: install aws cli command: | sudo pip install awscli - - run: name: upload to s3 command: | @@ -291,7 +288,7 @@ workflows: - release_javadoc: requires: - - release_maven + - release_tag filters: branches: ignore: /.*/ diff --git a/CircleciScripts/copylibs.py b/CircleciScripts/copylibs.py index 5605a1f3be..d5fc2c41dd 100644 --- a/CircleciScripts/copylibs.py +++ b/CircleciScripts/copylibs.py @@ -7,21 +7,21 @@ root = sys.argv[1] dest = sys.argv[2] if not os.path.exists(dest): - os.makedirs(dest) + os.makedirs(dest) modules = getmodules(root) print(modules) for module in modules: - print(module) - jarfile = os.path.join(root,module,"build/libs/{0}.jar".format(module)) - if os.path.isfile(jarfile) : - destfile = os.path.join(dest, "{0}.jar".format(module)) - copyfile(jarfile, destfile) - else: - aarfile = os.path.join(root,module,"build/outputs/aar/{0}-release.aar".format(module)) - if os.path.isfile(aarfile) : - destfile = os.path.join(dest, "{0}.aar".format(module)) - copyfile(aarfile, destfile) - else: - print("Did not find build result for {0}".format(module)) - exit(1) + print(module) + jarfile = os.path.join(root,module,"build/libs/{0}.jar".format(module)) + if os.path.isfile(jarfile) : + destfile = os.path.join(dest, "{0}.jar".format(module)) + copyfile(jarfile, destfile) + else: + aarfile = os.path.join(root,module,"build/outputs/aar/{0}-release.aar".format(module)) + if os.path.isfile(aarfile) : + destfile = os.path.join(dest, "{0}.aar".format(module)) + copyfile(aarfile, destfile) + else: + print("Did not find build result for {0}".format(module)) + exit(1) diff --git a/CircleciScripts/run_unittest.py b/CircleciScripts/run_unittest.py index 83d8c7d7d0..c54277e2bb 100644 --- a/CircleciScripts/run_unittest.py +++ b/CircleciScripts/run_unittest.py @@ -1,19 +1,14 @@ from functions import runcommand from functions import runtest from functions import TestTypes +from functions import getmodules import sys -import re +import os -with open("settings.gradle") as f: - lines = f.readlines() -# you may also want to remove whitespace characters like `\n` at the end of each line -testmodules = [] -for line in lines: - m = re.match(".*':(.*).*'", line) - if m is not None: - testmodules.append(m.group(1)) - else: - print(line) +test_results = sys.argv[1] +root = sys.argv[2] +print(root) +testmodules = getmodules(root) # testmodules = [ @@ -29,9 +24,11 @@ # ] -test_results = sys.argv[1] + runcommand("rm -rf {0}".format(test_results)) runcommand("mkdir {0}".format(test_results)) for module in testmodules: - if runtest(module, TestTypes.UnitTest, test_results) != 0 : - exit(1) + testfolder = os.path.join(root, module, "src/test") + if (os.path.isdir(testfolder)): + if runtest(module, TestTypes.UnitTest, test_results) != 0 : + exit(1) diff --git a/CircleciScripts/untitled.java b/CircleciScripts/untitled.java new file mode 100644 index 0000000000..210da4c0fe --- /dev/null +++ b/CircleciScripts/untitled.java @@ -0,0 +1,70 @@ + + @Test + public void testWhenWritingTooManyConcurrentRecords() throws + InterruptedException, IOException { + File recordsDirectory = null; + File recordsFile = null; + FileManager fileManager = new FileManager(TEST_DIRECTORY); + final FileRecordStore recordStore = new FileRecordStore(TEST_DIRECTORY, + RECORDER_FILE_NAME, MAX_STORAGE_SIZE); + + recordsDirectory = fileManager.getDirectory(Constants.RECORDS_DIRECTORY); + recordsFile = new File(recordsDirectory, Constants.RECORDS_FILE_NAME); + + SecureRandom random = new SecureRandom(); + + // first fill the disk + String tempRecordStr = ""; + for (int i = 0; i < 10000; i++) { + tempRecordStr = tempRecordStr + new BigInteger(130, random).toString(32); + } + + final String recordStr = tempRecordStr; + + for (int i = 0; i < 30; i++) { + recordStore.put(recordStr); + } + + long initialSize = recordsFile.length(); + assertTrue(recordsFile.length() <= MAX_STORAGE_SIZE); + + final CountDownLatch latch = new CountDownLatch(1); + ExecutorService threadPool = Executors.newFixedThreadPool(1); + threadPool.execute(new Runnable() { + @Override + public void run() { + try { + for (int i = 0; i < 100; i++) { + RecordIterator itr = recordStore.iterator(); + if (itr.hasNext()) { + String next = itr.next(); + assertEquals(next.length(), recordStr.length()); + itr.removeReadRecords(); + } + Thread.sleep(1); + } + } catch (InterruptedException e) { + e.printStackTrace(); + } catch (IOException e) { + throw new RuntimeException(e); + } finally { + latch.countDown(); + } + } + }); + + for (int i = 0; i < 10000; i++) { + recordStore.put(recordStr); + assertTrue(recordsFile.length() <= initialSize); + recordStore.put(recordStr); + assertTrue(recordsFile.length() <= initialSize); + recordStore.put(recordStr); + assertTrue(recordsFile.length() <= initialSize); + Thread.sleep(1); + } + + latch.await(); + assertEquals(recordsFile.length(), initialSize); + assertTrue(recordsFile.length() < MAX_STORAGE_SIZE); + + } \ No newline at end of file