assertNull("NO ISSUEZILLA ID", insertionResult.getIssuezillaId());
assertEquals("Exception report", ExceptionsData.DataType.EXC_REPORT, insertionResult.getDataType());
waitLogsParsed();
List<Nbuser> usersList = PersistenceUtils.getAll(em, Nbuser.class);
Nbuser user = usersList.get(0);
assertEquals("THERE MUST BE ONE USER", 1, usersList.size());
assertEquals("USER NAME CHECK", user.getName(), params[3]);
List<org.netbeans.modules.exceptions.entity.Exceptions> exceptionList = PersistenceUtils.getAll(em, org.netbeans.modules.exceptions.entity.Exceptions.class);
org.netbeans.modules.exceptions.entity.Exceptions exception = exceptionList.get(0);
assertEquals("THERE MUST BE ONE ISSUE", 1, exceptionList.size());
assertEquals("THIS ISSUE WAS ADDED WITH ID", insertionResult.getSubmitId(), exception.getId());
assertEquals("SUMMARY CHECK", exception.getSummary(), params[4]);
assertEquals(fileNames[0], exception.getLogfileId().getFileName());
assertEquals("VM MACHINE CHECK", exception.getVmId().getName(), params[1]);
assertEquals("NB PRODUCT VERSION CHECK", exception.getLogfileId().getProductVersionId().getProductVersion(), params[2]);
String os = exception.getOperatingsystemId().getName() + ", " + exception.getOperatingsystemId().getVersion() + ", " + exception.getOperatingsystemId().getArch();
assertEquals("OPERATING SYSTEM NAME CHECK", os, params[0]);
assertEquals("PRODUCT BUILD NUMBER", exception.getBuild(), Long.valueOf("070212"));
assertEquals("NR. OF DUPLICATES SHOULD BE 1", 1, exception.getReportId().getSubmitCollection().size());
assertEquals("STACKTRACE LINES NUMBER", thrown.getStackTrace().length, exception.getStacktrace().getLineCollection().size());
List<Line> linesList = PersistenceUtils.getAll(em, Line.class);
Iterator<Line> lineIterator = linesList.iterator();
assertTrue("THERE MUST BE FEW LINES", linesList.size() > 0);
List<StackTraceElement> list = Arrays.asList(thrown.getStackTrace());
do{
Line line = lineIterator.next();
assertNotNull("JarFile is not inserted", line.getJarfileId());
int lineOrder = line.getLinePK().getLineOrder();
int lineNumber = line.getLinePK().getLinenumber();
int stackLineNumber = list.get(lineOrder).getLineNumber();
if (stackLineNumber < 0) stackLineNumber = 0;
assertEquals(lineNumber, stackLineNumber);
}while (lineIterator.hasNext());
assertEquals(linesList.size(), list.size());
Integer count = perUtils.count(Jarfile.class);
assertTrue("THE NUMBER MUST BE NOT 0", count > 0);
logFiles = AddLogFileTest.logFiles(em);
assertEquals("JUST ONE logfile: " + logFiles,1, logFiles.size());
assertEquals("Build Number", logFiles.get(0).getBuildnumber(), Long.valueOf("070212"));
assertEquals("Upload Number", logFiles.get(0).getUploadNumber(), new Integer(session));
assertEquals("userDir", logFiles.get(0).getUserdir(), userId);
assertEquals("File Name", logFiles.get(0).getFileName(), userId+"."+String.valueOf(session-1));
assertNull("IP is null - it was not set", logFiles.get(0).getIp());
//********* ADD DUPLICATE *********/
params[3] = users[1];
params[5] = comments[1];
params[2] = productVersion[1];
rec.setParameters(params);
log = new Logfile(userId, session+1);
insertion = new DbInsertion(rec, thrown, new TestLogFileTask(em, log));
insertionResult = getInsertionData(insertion);
assertTrue("THIS ISSUE IS A DUPLICATE", insertionResult.isDuplicateReport());
assertAreDuplicates("DUPLICATE INSERTION", em, new Integer(1), insertionResult.getSubmitId());
assertNull("NO ISSUEZILLA ID", insertionResult.getIssuezillaId());
assertEquals("Exception report", ExceptionsData.DataType.EXC_REPORT, insertionResult.getDataType());
waitLogsParsed();
Integer nextCount = perUtils.count(Jarfile.class);
assertEquals("THE NUMBER OF JAR FILES MUST BE THE SAME", count, nextCount);
usersList = PersistenceUtils.getAll(em, Nbuser.class);
user = usersList.get(0);
assertEquals("THERE MUST BE USER", 1, usersList.size());
assertEquals(users[0], user.getName());
List<Comment> commentList = PersistenceUtils.getAll(em, Comment.class);
assertEquals("THERE SHOULD BE TWO COMMENTS", 2, commentList.size());