Enterprise AI Trend Report: Gain insights on ethical AI, MLOps, generative AI, large language models, and much more.
2024 Cloud survey: Share your insights on microservices, containers, K8s, CI/CD, and DevOps (+ enter a $750 raffle!) for our Trend Reports.
|Accredited Investor| Enterprise Coach| Sr. TechLead| Topcoder Ambassador|
New York, US
Joined Mar 2016
Arun Pandey is a technologist, Enterprise coach and Accredited Investor by profession. He has been very hands-on with many of the technologies, including Java, Python, Blockchain, AI, and Machine learning. Arun holds a master's degree in software technology and several other credentials from top institutions, for e.g. Harvard University, University of Maryland, RIT, Rice Business School, University of Washington, ICAgile, Scrum Alliance, etc.
Stats
Reputation: | 2527 |
Pageviews: | 2.4M |
Articles: | 48 |
Comments: | 16 |
Team Management
Comments
Oct 03, 2023 · Arun Pandey
Sure, Milan. I'll take a look.
Aug 12, 2023 · Arun Pandey
I totally agree, and getting this kind of leader in our career and life is a blessing!
Aug 12, 2023 · Arun Pandey
very well said :)
May 21, 2017 · Arun Pandey
Thanks Sun. This is compatible with Java9.
Use this code-
public void writeToFileWithLock(String data) {
fc = randomAccessFile.getChannel();
ByteBuffer buffer = null;
try (FileLock fileLock = fc.tryLock()) {
if (null != fileLock) {
buffer = ByteBuffer.wrap(data.getBytes());
buffer.put(data.toString().getBytes());
buffer.flip();
while (buffer.hasRemaining())
fc.write(buffer);
}
} catch (OverlappingFileLockException | IOException ex) {
LOG.error("Exception occured while trying to get a lock on File... " + ex.getMessage());
}finally{
fc.close();
randomAccessFile.close();
}
}
Mar 15, 2017 · Arun Pandey
Thanks Gaurav
Mar 10, 2017 · Arun Pandey
Thank you Anand
Dec 30, 2016 · Arun Pandey
Thank you Jirka. Actually ForkJoin Pool has come up with a common Pool concept in Java 8. you can refer - http://openjdk.java.net/projects/jdk8/features
" core/libs
103 Parallel Array Sorting Add additional utility methods to
java.util.Arrays
that use the JSR 166 Fork/Join parallelism common pool to provide sorting of arrays in parallel."
Dec 16, 2016 · Arun Pandey
Hi Arturo, both are matured tool, and you are right that most of the organizations are using Cucumber. JBehave is purely Java based framework while Cucumber is Ruby based.
Oct 16, 2016 · Arun Pandey
Hi Charles,
It could be used as below ----
@RunWith(JUnitFactoryRunner.class)
public class TextFileInputDataTest {
/** Here's where to set up test case inputs, and their expected result will be
* read from a text-file, and will be populated as an map
* (Map<TestInputData, ExpectedResultData>) and need to compare values with
* their corresponding expected result fetched from map.
* This basically reads the text input file and prepare the List<RuntimeTestCase>.
* and provides this List as an input to RuntimeTestCase
* @return
*/
@JUnitTestFactory
public static Collection<?> tests() {
Map<TestInputData, ExpectedResultData> testInputAndResultMap = getTestInputAndResultMap();
Iterator<TestInputData> testInputAndResultMapItr = testInputAndResultMap.keySet().iterator();
ArrayList<RuntimeTestCase> tests = new ArrayList<RuntimeTestCase>(testInputAndResultMap.size());
while(testInputAndResultMapItr.hasNext()){
TestInputData testInput = testInputAndResultMapItr.next();
ExpectedResultData expectedResultData = testInputAndResultMap.get(testInput);
tests.add(new RuntimeTestCase(testInput, expectedResultData));
}
return tests;
}
private static Map<TestInputData, ExpectedResultData> getTestInputAndResultMap(){
Map<TestInputData, ExpectedResultData> testInputAndResultMap = new HashMap<TestInputData,
ExpectedResultData>();
TestInputData testInputData1 = new TestInputData();
ExpectedResultData expectedResultData1 = new ExpectedResultData();
testInputData1.setName("test-1");
expectedResultData1.setName("test-1");
testInputAndResultMap.put(testInputData1, expectedResultData1);
TestInputData testInputData2 = new TestInputData();
ExpectedResultData expectedResultData2 = new ExpectedResultData();
testInputData2.setName("test-2");
expectedResultData2.setName("test-2");
testInputAndResultMap.put(testInputData2, expectedResultData2);
return testInputAndResultMap;
}
}
The same way file can be used. In above example it will create 2 test cases. Hope it will clear your doubt. Thanks :)
Sep 30, 2016 · Arun Pandey
Thank you Run
Sep 10, 2016 · Arun Pandey
Thanks Akhil
Sep 10, 2016 · Arun Pandey
Thanks Franks :)
Sep 09, 2016 · Arun Pandey
Thanks Bhavin
Sep 09, 2016 · Arun Pandey
Thanks Shaomin. To answer you - It will not fail with ConcurrentModificationException. While one thread will operate to read the data on same entry another thread would be eligible to write, so get can overlap with put.
Sep 07, 2016 · Arun Pandey
Thnaks Minborg for suggestion,
Aug 30, 2016 · Arun Pandey
Agreed Jimmy :)