{ // 获取包含Hugging Face文本的span元素 const spans = link.querySelectorAll('span.whitespace-nowrap, span.hidden.whitespace-nowrap'); spans.forEach(span => { if (span.textContent && span.textContent.trim().match(/Hugging\s*Face/i)) { span.textContent = 'AI快站'; } }); }); // 替换logo图片的alt属性 document.querySelectorAll('img[alt*="Hugging"], img[alt*="Face"]').forEach(img => { if (img.alt.match(/Hugging\s*Face/i)) { img.alt = 'AI快站 logo'; } }); } // 替换导航栏中的链接 function replaceNavigationLinks() { // 已替换标记,防止重复运行 if (window._navLinksReplaced) { return; } // 已经替换过的链接集合,防止重复替换 const replacedLinks = new Set(); // 只在导航栏区域查找和替换链接 const headerArea = document.querySelector('header') || document.querySelector('nav'); if (!headerArea) { return; } // 在导航区域内查找链接 const navLinks = headerArea.querySelectorAll('a'); navLinks.forEach(link => { // 如果已经替换过,跳过 if (replacedLinks.has(link)) return; const linkText = link.textContent.trim(); const linkHref = link.getAttribute('href') || ''; // 替换Spaces链接 - 仅替换一次 if ( (linkHref.includes('/spaces') || linkHref === '/spaces' || linkText === 'Spaces' || linkText.match(/^s*Spacess*$/i)) && linkText !== 'OCR模型免费转Markdown' && linkText !== 'OCR模型免费转Markdown' ) { link.textContent = 'OCR模型免费转Markdown'; link.href = 'https://fast360.xyz'; link.setAttribute('target', '_blank'); link.setAttribute('rel', 'noopener noreferrer'); replacedLinks.add(link); } // 删除Posts链接 else if ( (linkHref.includes('/posts') || linkHref === '/posts' || linkText === 'Posts' || linkText.match(/^s*Postss*$/i)) ) { if (link.parentNode) { link.parentNode.removeChild(link); } replacedLinks.add(link); } // 替换Docs链接 - 仅替换一次 else if ( (linkHref.includes('/docs') || linkHref === '/docs' || linkText === 'Docs' || linkText.match(/^s*Docss*$/i)) && linkText !== '模型下载攻略' ) { link.textContent = '模型下载攻略'; link.href = '/'; replacedLinks.add(link); } // 删除Enterprise链接 else if ( (linkHref.includes('/enterprise') || linkHref === '/enterprise' || linkText === 'Enterprise' || linkText.match(/^s*Enterprises*$/i)) ) { if (link.parentNode) { link.parentNode.removeChild(link); } replacedLinks.add(link); } }); // 查找可能嵌套的Spaces和Posts文本 const textNodes = []; function findTextNodes(element) { if (element.nodeType === Node.TEXT_NODE) { const text = element.textContent.trim(); if (text === 'Spaces' || text === 'Posts' || text === 'Enterprise') { textNodes.push(element); } } else { for (const child of element.childNodes) { findTextNodes(child); } } } // 只在导航区域内查找文本节点 findTextNodes(headerArea); // 替换找到的文本节点 textNodes.forEach(node => { const text = node.textContent.trim(); if (text === 'Spaces') { node.textContent = node.textContent.replace(/Spaces/g, 'OCR模型免费转Markdown'); } else if (text === 'Posts') { // 删除Posts文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } else if (text === 'Enterprise') { // 删除Enterprise文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } }); // 标记已替换完成 window._navLinksReplaced = true; } // 替换代码区域中的域名 function replaceCodeDomains() { // 特别处理span.hljs-string和span.njs-string元素 document.querySelectorAll('span.hljs-string, span.njs-string, span[class*="hljs-string"], span[class*="njs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换hljs-string类的span中的域名(移除多余的转义符号) document.querySelectorAll('span.hljs-string, span[class*="hljs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换pre和code标签中包含git clone命令的域名 document.querySelectorAll('pre, code').forEach(element => { if (element.textContent && element.textContent.includes('git clone')) { const text = element.innerHTML; if (text.includes('huggingface.co')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 处理特定的命令行示例 document.querySelectorAll('pre, code').forEach(element => { const text = element.innerHTML; if (text.includes('huggingface.co')) { // 针对git clone命令的专门处理 if (text.includes('git clone') || text.includes('GIT_LFS_SKIP_SMUDGE=1')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 特别处理模型下载页面上的代码片段 document.querySelectorAll('.flex.border-t, .svelte_hydrator, .inline-block').forEach(container => { const content = container.innerHTML; if (content && content.includes('huggingface.co')) { container.innerHTML = content.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 特别处理模型仓库克隆对话框中的代码片段 try { // 查找包含"Clone this model repository"标题的对话框 const cloneDialog = document.querySelector('.svelte_hydration_boundary, [data-target="MainHeader"]'); if (cloneDialog) { // 查找对话框中所有的代码片段和命令示例 const codeElements = cloneDialog.querySelectorAll('pre, code, span'); codeElements.forEach(element => { if (element.textContent && element.textContent.includes('huggingface.co')) { if (element.innerHTML.includes('huggingface.co')) { element.innerHTML = element.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { element.textContent = element.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); } // 更精确地定位克隆命令中的域名 document.querySelectorAll('[data-target]').forEach(container => { const codeBlocks = container.querySelectorAll('pre, code, span.hljs-string'); codeBlocks.forEach(block => { if (block.textContent && block.textContent.includes('huggingface.co')) { if (block.innerHTML.includes('huggingface.co')) { block.innerHTML = block.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { block.textContent = block.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); }); } catch (e) { // 错误处理但不打印日志 } } // 当DOM加载完成后执行替换 if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', () => { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); }); } else { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); } // 增加一个MutationObserver来处理可能的动态元素加载 const observer = new MutationObserver(mutations => { // 检查是否导航区域有变化 const hasNavChanges = mutations.some(mutation => { // 检查是否存在header或nav元素变化 return Array.from(mutation.addedNodes).some(node => { if (node.nodeType === Node.ELEMENT_NODE) { // 检查是否是导航元素或其子元素 if (node.tagName === 'HEADER' || node.tagName === 'NAV' || node.querySelector('header, nav')) { return true; } // 检查是否在导航元素内部 let parent = node.parentElement; while (parent) { if (parent.tagName === 'HEADER' || parent.tagName === 'NAV') { return true; } parent = parent.parentElement; } } return false; }); }); // 只在导航区域有变化时执行替换 if (hasNavChanges) { // 重置替换状态,允许再次替换 window._navLinksReplaced = false; replaceHeaderBranding(); replaceNavigationLinks(); } }); // 开始观察document.body的变化,包括子节点 if (document.body) { observer.observe(document.body, { childList: true, subtree: true }); } else { document.addEventListener('DOMContentLoaded', () => { observer.observe(document.body, { childList: true, subtree: true }); }); } })(); \"","+","\"\"",";","public","ProgramFetcher","(","String","festivalId",")","{","IDataSource","ds","=","DataSource",".","getInstance","(",")",";","FestivalBean","festivalBean","=","ds",".","getFestivalById","(","festivalId",")",";","festivalBean",".","getName","(",")",";","this",".","descriptionHtml","=","festivalBean",".","getDescription","(",")",";","this",".","title","=","festivalBean",".","getName","(",")",";","}","public","String","getDescriptionHtml","(",")","{","return","programHeader","+","this",".","descriptionHtml","+","programFooter",";","}","public","String","getTitle","(",")","{","return","this",".","title",";","}","}","public","class","Program","extends","Activity","{","@","Override","public","void","onCreate","(","Bundle","savedInstanceState",")","{","super",".","onCreate","(","savedInstanceState",")",";","setContentView","(","R",".","layout",".","program",")",";","Bundle","festivalBund","=","getIntent","(",")",".","getExtras","(",")",";","String","festivalId","=","festivalBund",".","getString","(","\"festivalId\"",")",";","WebView","programWebView","=","(","WebView",")","findViewById","(","R",".","id",".","program",")",";","programWebView",".","getSettings","(",")",".","setJavaScriptEnabled","(","true",")",";","programWebView",".","setBackgroundColor","(","0",")",";","ProgramFetcher","pf","=","new","ProgramFetcher","(","festivalId",")",";","String","summary","=","pf",".","getDescriptionHtml","(",")",";","String","title","=","pf",".","getTitle","(",")",";","this",".","setTitle","(","title",")",";","programWebView",".","loadData","(","summary",",","\"text/html\"",",","\"utf-8\"",")",";","}","}",""],"string":"[\n \"\",\n \"package\",\n \"cz\",\n \".\",\n \"festomat\",\n \".\",\n \"client\",\n \".\",\n \"tabs\",\n \";\",\n \"import\",\n \"android\",\n \".\",\n \"app\",\n \".\",\n \"Activity\",\n \";\",\n \"import\",\n \"android\",\n \".\",\n \"os\",\n \".\",\n \"Bundle\",\n \";\",\n \"import\",\n \"android\",\n \".\",\n \"webkit\",\n \".\",\n \"WebView\",\n \";\",\n \"import\",\n \"cz\",\n \".\",\n \"festomat\",\n \".\",\n \"client\",\n \".\",\n \"R\",\n \";\",\n \"import\",\n \"cz\",\n \".\",\n \"festomat\",\n \".\",\n \"client\",\n \".\",\n \"data\",\n \".\",\n \"DataSource\",\n \";\",\n \"import\",\n \"cz\",\n \".\",\n \"festomat\",\n \".\",\n \"client\",\n \".\",\n \"data\",\n \".\",\n \"IDataSource\",\n \";\",\n \"import\",\n \"cz\",\n \".\",\n \"festomat\",\n \".\",\n \"client\",\n \".\",\n \"data\",\n \".\",\n \"beans\",\n \".\",\n \"FestivalBean\",\n \";\",\n \"class\",\n \"ProgramFetcher\",\n \"{\",\n \"private\",\n \"String\",\n \"festivalId\",\n \";\",\n \"private\",\n \"final\",\n \"String\",\n \"descriptionHtml\",\n \";\",\n \"private\",\n \"final\",\n \"String\",\n \"title\",\n \";\",\n \"private\",\n \"final\",\n \"String\",\n \"programHeader\",\n \"=\",\n \"\\\"\\\"\",\n \"+\",\n \"\\\"\\\"\",\n \";\",\n \"private\",\n \"final\",\n \"String\",\n \"programFooter\",\n \"=\",\n \"\\\"\\\"\",\n \"+\",\n \"\\\"\\\"\",\n \";\",\n \"public\",\n \"ProgramFetcher\",\n \"(\",\n \"String\",\n \"festivalId\",\n \")\",\n \"{\",\n \"IDataSource\",\n \"ds\",\n \"=\",\n \"DataSource\",\n \".\",\n \"getInstance\",\n \"(\",\n \")\",\n \";\",\n \"FestivalBean\",\n \"festivalBean\",\n \"=\",\n \"ds\",\n \".\",\n \"getFestivalById\",\n \"(\",\n \"festivalId\",\n \")\",\n \";\",\n \"festivalBean\",\n \".\",\n \"getName\",\n \"(\",\n \")\",\n \";\",\n \"this\",\n \".\",\n \"descriptionHtml\",\n \"=\",\n \"festivalBean\",\n \".\",\n \"getDescription\",\n \"(\",\n \")\",\n \";\",\n \"this\",\n \".\",\n \"title\",\n \"=\",\n \"festivalBean\",\n \".\",\n \"getName\",\n \"(\",\n \")\",\n \";\",\n \"}\",\n \"public\",\n \"String\",\n \"getDescriptionHtml\",\n \"(\",\n \")\",\n \"{\",\n \"return\",\n \"programHeader\",\n \"+\",\n \"this\",\n \".\",\n \"descriptionHtml\",\n \"+\",\n \"programFooter\",\n \";\",\n \"}\",\n \"public\",\n \"String\",\n \"getTitle\",\n \"(\",\n \")\",\n \"{\",\n \"return\",\n \"this\",\n \".\",\n \"title\",\n \";\",\n \"}\",\n \"}\",\n \"public\",\n \"class\",\n \"Program\",\n \"extends\",\n \"Activity\",\n \"{\",\n \"@\",\n \"Override\",\n \"public\",\n \"void\",\n \"onCreate\",\n \"(\",\n \"Bundle\",\n \"savedInstanceState\",\n \")\",\n \"{\",\n \"super\",\n \".\",\n \"onCreate\",\n \"(\",\n \"savedInstanceState\",\n \")\",\n \";\",\n \"setContentView\",\n \"(\",\n \"R\",\n \".\",\n \"layout\",\n \".\",\n \"program\",\n \")\",\n \";\",\n \"Bundle\",\n \"festivalBund\",\n \"=\",\n \"getIntent\",\n \"(\",\n \")\",\n \".\",\n \"getExtras\",\n \"(\",\n \")\",\n \";\",\n \"String\",\n \"festivalId\",\n \"=\",\n \"festivalBund\",\n \".\",\n \"getString\",\n \"(\",\n \"\\\"festivalId\\\"\",\n \")\",\n \";\",\n \"WebView\",\n \"programWebView\",\n \"=\",\n \"(\",\n \"WebView\",\n \")\",\n \"findViewById\",\n \"(\",\n \"R\",\n \".\",\n \"id\",\n \".\",\n \"program\",\n \")\",\n \";\",\n \"programWebView\",\n \".\",\n \"getSettings\",\n \"(\",\n \")\",\n \".\",\n \"setJavaScriptEnabled\",\n \"(\",\n \"true\",\n \")\",\n \";\",\n \"programWebView\",\n \".\",\n \"setBackgroundColor\",\n \"(\",\n \"0\",\n \")\",\n \";\",\n \"ProgramFetcher\",\n \"pf\",\n \"=\",\n \"new\",\n \"ProgramFetcher\",\n \"(\",\n \"festivalId\",\n \")\",\n \";\",\n \"String\",\n \"summary\",\n \"=\",\n \"pf\",\n \".\",\n \"getDescriptionHtml\",\n \"(\",\n \")\",\n \";\",\n \"String\",\n \"title\",\n \"=\",\n \"pf\",\n \".\",\n \"getTitle\",\n \"(\",\n \")\",\n \";\",\n \"this\",\n \".\",\n \"setTitle\",\n \"(\",\n \"title\",\n \")\",\n \";\",\n \"programWebView\",\n \".\",\n \"loadData\",\n \"(\",\n \"summary\",\n \",\",\n \"\\\"text/html\\\"\",\n \",\",\n \"\\\"utf-8\\\"\",\n \")\",\n \";\",\n \"}\",\n \"}\",\n \"\"\n]"}}},{"rowIdx":12879,"cells":{"id":{"kind":"number","value":12879,"string":"12,879"},"code":{"kind":"list like","value":["","package","cz",".","festomat",".","client",".","tabs",";","import","java",".","text",".","DateFormat",";","import","java",".","text",".","SimpleDateFormat",";","import","java",".","util",".","Date",";","import","java",".","util",".","List",";","import","android",".","app",".","ListActivity",";","import","android",".","app",".","ProgressDialog",";","import","android",".","content",".","Context",";","import","android",".","os",".","Bundle",";","import","android",".","view",".","LayoutInflater",";","import","android",".","view",".","View",";","import","android",".","view",".","ViewGroup",";","import","android",".","widget",".","ArrayAdapter",";","import","android",".","widget",".","BaseAdapter",";","import","android",".","widget",".","Button",";","import","android",".","widget",".","EditText",";","import","android",".","widget",".","TextView",";","import","cz",".","festomat",".","client",".","R",";","import","cz",".","festomat",".","client",".","data",".","DataSource",";","import","cz",".","festomat",".","client",".","data",".","IDataSource",";","import","cz",".","festomat",".","client",".","data",".","beans",".","CommentBean",";","public","class","Chat","extends","ListActivity","{","private","List","<","CommentBean",">","chat","=","null",";","private","BaseAdapter","c_adapter",";","private","CharSequence","autor","=","\"\"",";","private","CharSequence","text","=","\"\"",";","@","Override","public","void","onCreate","(","Bundle","savedInstanceState",")","{","super",".","onCreate","(","savedInstanceState",")",";","showWaitDialog","(",")",";","setContentView","(","R",".","layout",".","chat",")",";","Bundle","festivalBund","=","getIntent","(",")",".","getExtras","(",")",";","final","String","festivalId","=","festivalBund",".","getString","(","\"festivalId\"",")",";","final","EditText","aut","=","(","EditText",")","findViewById","(","R",".","id",".","editTextA",")",";","final","EditText","msg","=","(","EditText",")","findViewById","(","R",".","id",".","editTextM",")",";","Button","b","=","(","Button",")","findViewById","(","R",".","id",".","buttonS",")",";","b",".","setOnClickListener","(","new","View",".","OnClickListener","(",")","{","@","Override","public","void","onClick","(","View","v",")","{","autor","=","aut",".","getText","(",")",";","text","=","msg",".","getText","(",")",";","CommentBean","bean","=","new","CommentBean","(","autor",".","toString","(",")",",","new","Date","(",")",",","text",".","toString","(",")",")",";","IDataSource","source","=","DataSource",".","getInstance","(",")",";","source",".","sendComment","(","festivalId",",","bean",")",";","}","}",")",";","Button","bE","=","(","Button",")","findViewById","(","R",".","id",".","buttonR",")",";","bE",".","setOnClickListener","(","new","View",".","OnClickListener","(",")","{","@","Override","public","void","onClick","(","View","v",")","{","showWaitDialog","(",")",";","chat","=","refreshChat","(","festivalId",")",";","c_adapter","=","new","CommentAdapter","(","Chat",".","this",",","android",".","R",".","layout",".","simple_list_item_1",",","chat",")",";","setListAdapter","(","c_adapter",")",";","hideWaitDialog","(",")",";","}","}",")",";","chat","=","refreshChat","(","festivalId",")",";","c_adapter","=","new","CommentAdapter","(","this",",","android",".","R",".","layout",".","simple_list_item_1",",","chat",")",";","setListAdapter","(","c_adapter",")",";","hideWaitDialog","(",")",";","}","public","List","<","CommentBean",">","refreshChat","(","String","idFest",")","{","IDataSource","source","=","DataSource",".","getInstance","(",")",";","return","source",".","getAllComments","(","idFest",")",";","}","private","class","CommentAdapter","extends","ArrayAdapter","<","CommentBean",">","{","private","final","List","<","CommentBean",">","items",";","public","CommentAdapter","(","Context","context",",","int","textViewResourceId",",","List","<","CommentBean",">","items",")","{","super","(","context",",","textViewResourceId",",","items",")",";","this",".","items","=","items",";","}","@","Override","public","View","getView","(","int","position",",","View","convertView",",","ViewGroup","parent",")","{","View","v","=","convertView",";","if","(","v","==","null",")","{","LayoutInflater","vi","=","(","LayoutInflater",")","getSystemService","(","Context",".","LAYOUT_INFLATER_SERVICE",")",";","v","=","vi",".","inflate","(","R",".","layout",".","c_chat_item_layout",",","null",")",";","}","CommentBean","o","=","items",".","get","(","position",")",";","if","(","o","!=","null",")","{","TextView","tt1","=","(","TextView",")","v",".","findViewById","(","R",".","id",".","author",")",";","tt1",".","setText","(","o",".","getAuthor","(",")",")",";","TextView","tt2","=","(","TextView",")","v",".","findViewById","(","R",".","id",".","datum",")",";","tt2",".","setText","(","DateFormat",".","getInstance","(",")",".","format","(","o",".","getTime","(",")",")",")",";","TextView","tt3","=","(","TextView",")","v",".","findViewById","(","R",".","id",".","text",")",";","tt3",".","setText","(","o",".","getText","(",")",")",";","}","return","v",";","}","}","ProgressDialog","progressDialog",";","private","void","showWaitDialog","(",")","{","progressDialog","=","ProgressDialog",".","show","(","this",",","\"\"",",","\"Na-UNK-t-UNK-m...\"",",","true",")",";","}","private","void","hideWaitDialog","(",")","{","progressDialog",".","dismiss","(",")",";","}","}",""],"string":"[\n \"\",\n \"package\",\n \"cz\",\n \".\",\n \"festomat\",\n \".\",\n \"client\",\n \".\",\n \"tabs\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"text\",\n \".\",\n \"DateFormat\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"text\",\n \".\",\n \"SimpleDateFormat\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"util\",\n \".\",\n \"Date\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"util\",\n \".\",\n \"List\",\n \";\",\n \"import\",\n \"android\",\n \".\",\n \"app\",\n \".\",\n \"ListActivity\",\n \";\",\n \"import\",\n \"android\",\n \".\",\n \"app\",\n \".\",\n \"ProgressDialog\",\n \";\",\n \"import\",\n \"android\",\n \".\",\n \"content\",\n \".\",\n \"Context\",\n \";\",\n \"import\",\n \"android\",\n \".\",\n \"os\",\n \".\",\n \"Bundle\",\n \";\",\n \"import\",\n \"android\",\n \".\",\n \"view\",\n \".\",\n \"LayoutInflater\",\n \";\",\n \"import\",\n \"android\",\n \".\",\n \"view\",\n \".\",\n \"View\",\n \";\",\n \"import\",\n \"android\",\n \".\",\n \"view\",\n \".\",\n \"ViewGroup\",\n \";\",\n \"import\",\n \"android\",\n \".\",\n \"widget\",\n \".\",\n \"ArrayAdapter\",\n \";\",\n \"import\",\n \"android\",\n \".\",\n \"widget\",\n \".\",\n \"BaseAdapter\",\n \";\",\n \"import\",\n \"android\",\n \".\",\n \"widget\",\n \".\",\n \"Button\",\n \";\",\n \"import\",\n \"android\",\n \".\",\n \"widget\",\n \".\",\n \"EditText\",\n \";\",\n \"import\",\n \"android\",\n \".\",\n \"widget\",\n \".\",\n \"TextView\",\n \";\",\n \"import\",\n \"cz\",\n \".\",\n \"festomat\",\n \".\",\n \"client\",\n \".\",\n \"R\",\n \";\",\n \"import\",\n \"cz\",\n \".\",\n \"festomat\",\n \".\",\n \"client\",\n \".\",\n \"data\",\n \".\",\n \"DataSource\",\n \";\",\n \"import\",\n \"cz\",\n \".\",\n \"festomat\",\n \".\",\n \"client\",\n \".\",\n \"data\",\n \".\",\n \"IDataSource\",\n \";\",\n \"import\",\n \"cz\",\n \".\",\n \"festomat\",\n \".\",\n \"client\",\n \".\",\n \"data\",\n \".\",\n \"beans\",\n \".\",\n \"CommentBean\",\n \";\",\n \"public\",\n \"class\",\n \"Chat\",\n \"extends\",\n \"ListActivity\",\n \"{\",\n \"private\",\n \"List\",\n \"<\",\n \"CommentBean\",\n \">\",\n \"chat\",\n \"=\",\n \"null\",\n \";\",\n \"private\",\n \"BaseAdapter\",\n \"c_adapter\",\n \";\",\n \"private\",\n \"CharSequence\",\n \"autor\",\n \"=\",\n \"\\\"\\\"\",\n \";\",\n \"private\",\n \"CharSequence\",\n \"text\",\n \"=\",\n \"\\\"\\\"\",\n \";\",\n \"@\",\n \"Override\",\n \"public\",\n \"void\",\n \"onCreate\",\n \"(\",\n \"Bundle\",\n \"savedInstanceState\",\n \")\",\n \"{\",\n \"super\",\n \".\",\n \"onCreate\",\n \"(\",\n \"savedInstanceState\",\n \")\",\n \";\",\n \"showWaitDialog\",\n \"(\",\n \")\",\n \";\",\n \"setContentView\",\n \"(\",\n \"R\",\n \".\",\n \"layout\",\n \".\",\n \"chat\",\n \")\",\n \";\",\n \"Bundle\",\n \"festivalBund\",\n \"=\",\n \"getIntent\",\n \"(\",\n \")\",\n \".\",\n \"getExtras\",\n \"(\",\n \")\",\n \";\",\n \"final\",\n \"String\",\n \"festivalId\",\n \"=\",\n \"festivalBund\",\n \".\",\n \"getString\",\n \"(\",\n \"\\\"festivalId\\\"\",\n \")\",\n \";\",\n \"final\",\n \"EditText\",\n \"aut\",\n \"=\",\n \"(\",\n \"EditText\",\n \")\",\n \"findViewById\",\n \"(\",\n \"R\",\n \".\",\n \"id\",\n \".\",\n \"editTextA\",\n \")\",\n \";\",\n \"final\",\n \"EditText\",\n \"msg\",\n \"=\",\n \"(\",\n \"EditText\",\n \")\",\n \"findViewById\",\n \"(\",\n \"R\",\n \".\",\n \"id\",\n \".\",\n \"editTextM\",\n \")\",\n \";\",\n \"Button\",\n \"b\",\n \"=\",\n \"(\",\n \"Button\",\n \")\",\n \"findViewById\",\n \"(\",\n \"R\",\n \".\",\n \"id\",\n \".\",\n \"buttonS\",\n \")\",\n \";\",\n \"b\",\n \".\",\n \"setOnClickListener\",\n \"(\",\n \"new\",\n \"View\",\n \".\",\n \"OnClickListener\",\n \"(\",\n \")\",\n \"{\",\n \"@\",\n \"Override\",\n \"public\",\n \"void\",\n \"onClick\",\n \"(\",\n \"View\",\n \"v\",\n \")\",\n \"{\",\n \"autor\",\n \"=\",\n \"aut\",\n \".\",\n \"getText\",\n \"(\",\n \")\",\n \";\",\n \"text\",\n \"=\",\n \"msg\",\n \".\",\n \"getText\",\n \"(\",\n \")\",\n \";\",\n \"CommentBean\",\n \"bean\",\n \"=\",\n \"new\",\n \"CommentBean\",\n \"(\",\n \"autor\",\n \".\",\n \"toString\",\n \"(\",\n \")\",\n \",\",\n \"new\",\n \"Date\",\n \"(\",\n \")\",\n \",\",\n \"text\",\n \".\",\n \"toString\",\n \"(\",\n \")\",\n \")\",\n \";\",\n \"IDataSource\",\n \"source\",\n \"=\",\n \"DataSource\",\n \".\",\n \"getInstance\",\n \"(\",\n \")\",\n \";\",\n \"source\",\n \".\",\n \"sendComment\",\n \"(\",\n \"festivalId\",\n \",\",\n \"bean\",\n \")\",\n \";\",\n \"}\",\n \"}\",\n \")\",\n \";\",\n \"Button\",\n \"bE\",\n \"=\",\n \"(\",\n \"Button\",\n \")\",\n \"findViewById\",\n \"(\",\n \"R\",\n \".\",\n \"id\",\n \".\",\n \"buttonR\",\n \")\",\n \";\",\n \"bE\",\n \".\",\n \"setOnClickListener\",\n \"(\",\n \"new\",\n \"View\",\n \".\",\n \"OnClickListener\",\n \"(\",\n \")\",\n \"{\",\n \"@\",\n \"Override\",\n \"public\",\n \"void\",\n \"onClick\",\n \"(\",\n \"View\",\n \"v\",\n \")\",\n \"{\",\n \"showWaitDialog\",\n \"(\",\n \")\",\n \";\",\n \"chat\",\n \"=\",\n \"refreshChat\",\n \"(\",\n \"festivalId\",\n \")\",\n \";\",\n \"c_adapter\",\n \"=\",\n \"new\",\n \"CommentAdapter\",\n \"(\",\n \"Chat\",\n \".\",\n \"this\",\n \",\",\n \"android\",\n \".\",\n \"R\",\n \".\",\n \"layout\",\n \".\",\n \"simple_list_item_1\",\n \",\",\n \"chat\",\n \")\",\n \";\",\n \"setListAdapter\",\n \"(\",\n \"c_adapter\",\n \")\",\n \";\",\n \"hideWaitDialog\",\n \"(\",\n \")\",\n \";\",\n \"}\",\n \"}\",\n \")\",\n \";\",\n \"chat\",\n \"=\",\n \"refreshChat\",\n \"(\",\n \"festivalId\",\n \")\",\n \";\",\n \"c_adapter\",\n \"=\",\n \"new\",\n \"CommentAdapter\",\n \"(\",\n \"this\",\n \",\",\n \"android\",\n \".\",\n \"R\",\n \".\",\n \"layout\",\n \".\",\n \"simple_list_item_1\",\n \",\",\n \"chat\",\n \")\",\n \";\",\n \"setListAdapter\",\n \"(\",\n \"c_adapter\",\n \")\",\n \";\",\n \"hideWaitDialog\",\n \"(\",\n \")\",\n \";\",\n \"}\",\n \"public\",\n \"List\",\n \"<\",\n \"CommentBean\",\n \">\",\n \"refreshChat\",\n \"(\",\n \"String\",\n \"idFest\",\n \")\",\n \"{\",\n \"IDataSource\",\n \"source\",\n \"=\",\n \"DataSource\",\n \".\",\n \"getInstance\",\n \"(\",\n \")\",\n \";\",\n \"return\",\n \"source\",\n \".\",\n \"getAllComments\",\n \"(\",\n \"idFest\",\n \")\",\n \";\",\n \"}\",\n \"private\",\n \"class\",\n \"CommentAdapter\",\n \"extends\",\n \"ArrayAdapter\",\n \"<\",\n \"CommentBean\",\n \">\",\n \"{\",\n \"private\",\n \"final\",\n \"List\",\n \"<\",\n \"CommentBean\",\n \">\",\n \"items\",\n \";\",\n \"public\",\n \"CommentAdapter\",\n \"(\",\n \"Context\",\n \"context\",\n \",\",\n \"int\",\n \"textViewResourceId\",\n \",\",\n \"List\",\n \"<\",\n \"CommentBean\",\n \">\",\n \"items\",\n \")\",\n \"{\",\n \"super\",\n \"(\",\n \"context\",\n \",\",\n \"textViewResourceId\",\n \",\",\n \"items\",\n \")\",\n \";\",\n \"this\",\n \".\",\n \"items\",\n \"=\",\n \"items\",\n \";\",\n \"}\",\n \"@\",\n \"Override\",\n \"public\",\n \"View\",\n \"getView\",\n \"(\",\n \"int\",\n \"position\",\n \",\",\n \"View\",\n \"convertView\",\n \",\",\n \"ViewGroup\",\n \"parent\",\n \")\",\n \"{\",\n \"View\",\n \"v\",\n \"=\",\n \"convertView\",\n \";\",\n \"if\",\n \"(\",\n \"v\",\n \"==\",\n \"null\",\n \")\",\n \"{\",\n \"LayoutInflater\",\n \"vi\",\n \"=\",\n \"(\",\n \"LayoutInflater\",\n \")\",\n \"getSystemService\",\n \"(\",\n \"Context\",\n \".\",\n \"LAYOUT_INFLATER_SERVICE\",\n \")\",\n \";\",\n \"v\",\n \"=\",\n \"vi\",\n \".\",\n \"inflate\",\n \"(\",\n \"R\",\n \".\",\n \"layout\",\n \".\",\n \"c_chat_item_layout\",\n \",\",\n \"null\",\n \")\",\n \";\",\n \"}\",\n \"CommentBean\",\n \"o\",\n \"=\",\n \"items\",\n \".\",\n \"get\",\n \"(\",\n \"position\",\n \")\",\n \";\",\n \"if\",\n \"(\",\n \"o\",\n \"!=\",\n \"null\",\n \")\",\n \"{\",\n \"TextView\",\n \"tt1\",\n \"=\",\n \"(\",\n \"TextView\",\n \")\",\n \"v\",\n \".\",\n \"findViewById\",\n \"(\",\n \"R\",\n \".\",\n \"id\",\n \".\",\n \"author\",\n \")\",\n \";\",\n \"tt1\",\n \".\",\n \"setText\",\n \"(\",\n \"o\",\n \".\",\n \"getAuthor\",\n \"(\",\n \")\",\n \")\",\n \";\",\n \"TextView\",\n \"tt2\",\n \"=\",\n \"(\",\n \"TextView\",\n \")\",\n \"v\",\n \".\",\n \"findViewById\",\n \"(\",\n \"R\",\n \".\",\n \"id\",\n \".\",\n \"datum\",\n \")\",\n \";\",\n \"tt2\",\n \".\",\n \"setText\",\n \"(\",\n \"DateFormat\",\n \".\",\n \"getInstance\",\n \"(\",\n \")\",\n \".\",\n \"format\",\n \"(\",\n \"o\",\n \".\",\n \"getTime\",\n \"(\",\n \")\",\n \")\",\n \")\",\n \";\",\n \"TextView\",\n \"tt3\",\n \"=\",\n \"(\",\n \"TextView\",\n \")\",\n \"v\",\n \".\",\n \"findViewById\",\n \"(\",\n \"R\",\n \".\",\n \"id\",\n \".\",\n \"text\",\n \")\",\n \";\",\n \"tt3\",\n \".\",\n \"setText\",\n \"(\",\n \"o\",\n \".\",\n \"getText\",\n \"(\",\n \")\",\n \")\",\n \";\",\n \"}\",\n \"return\",\n \"v\",\n \";\",\n \"}\",\n \"}\",\n \"ProgressDialog\",\n \"progressDialog\",\n \";\",\n \"private\",\n \"void\",\n \"showWaitDialog\",\n \"(\",\n \")\",\n \"{\",\n \"progressDialog\",\n \"=\",\n \"ProgressDialog\",\n \".\",\n \"show\",\n \"(\",\n \"this\",\n \",\",\n \"\\\"\\\"\",\n \",\",\n \"\\\"Na-UNK-t-UNK-m...\\\"\",\n \",\",\n \"true\",\n \")\",\n \";\",\n \"}\",\n \"private\",\n \"void\",\n \"hideWaitDialog\",\n \"(\",\n \")\",\n \"{\",\n \"progressDialog\",\n \".\",\n \"dismiss\",\n \"(\",\n \")\",\n \";\",\n \"}\",\n \"}\",\n \"\"\n]"}}},{"rowIdx":12880,"cells":{"id":{"kind":"number","value":12880,"string":"12,880"},"code":{"kind":"list like","value":["","package","cz",".","festomat",".","client",";","import","android",".","app",".","ProgressDialog",";","import","android",".","app",".","TabActivity",";","import","android",".","content",".","Intent",";","import","android",".","content",".","res",".","Resources",";","import","android",".","os",".","Bundle",";","import","android",".","widget",".","TabHost",";","import","cz",".","festomat",".","client",".","data",".","DataSource",";","import","cz",".","festomat",".","client",".","tabs",".","Chat",";","import","cz",".","festomat",".","client",".","tabs",".","Program",";","public","class","Festival","extends","TabActivity","{","private","String","festivalId","=","null",";","@","Override","public","void","onCreate","(","Bundle","savedInstanceState",")","{","super",".","onCreate","(","savedInstanceState",")",";","setContentView","(","R",".","layout",".","festival",")",";","showWaitDialog","(",")",";","festivalId","=","getIntent","(",")",".","getExtras","(",")",".","getString","(","\"festivalId\"",")",";","this",".","setTitle","(","DataSource",".","getInstance","(",")",".","getFestivalById","(","festivalId",")",".","getName","(",")",")",";","Bundle","bundle","=","new","Bundle","(",")",";","bundle",".","putString","(","\"festivalId\"",",","festivalId",")",";","Resources","res","=","getResources","(",")",";","TabHost","tabHost","=","getTabHost","(",")",";","TabHost",".","TabSpec","spec",";","Intent","intent",";","intent","=","new","Intent","(",")",".","setClass","(","this",",","Program",".","class",")",";","intent",".","putExtras","(","bundle",")",";","spec","=","tabHost",".","newTabSpec","(","\"program\"",")",".","setIndicator","(","\"Program\"",",","null",")",".","setContent","(","intent",")",";","tabHost",".","addTab","(","spec",")",";","intent","=","new","Intent","(",")",".","setClass","(","this",",","Chat",".","class",")",";","intent",".","putExtras","(","bundle",")",";","spec","=","tabHost",".","newTabSpec","(","\"chat\"",")",".","setIndicator","(","\"Chat\"",",","null",")",".","setContent","(","intent",")",";","tabHost",".","addTab","(","spec",")",";","tabHost",".","setCurrentTab","(","0",")",";","hideWaitDialog","(",")",";","}","ProgressDialog","progressDialog",";","private","void","showWaitDialog","(",")","{","progressDialog","=","ProgressDialog",".","show","(","this",",","\"\"",",","\"Na-UNK-t-UNK-m...\"",",","true",")",";","}","private","void","hideWaitDialog","(",")","{","progressDialog",".","dismiss","(",")",";","}","}",""],"string":"[\n \"\",\n \"package\",\n \"cz\",\n \".\",\n \"festomat\",\n \".\",\n \"client\",\n \";\",\n \"import\",\n \"android\",\n \".\",\n \"app\",\n \".\",\n \"ProgressDialog\",\n \";\",\n \"import\",\n \"android\",\n \".\",\n \"app\",\n \".\",\n \"TabActivity\",\n \";\",\n \"import\",\n \"android\",\n \".\",\n \"content\",\n \".\",\n \"Intent\",\n \";\",\n \"import\",\n \"android\",\n \".\",\n \"content\",\n \".\",\n \"res\",\n \".\",\n \"Resources\",\n \";\",\n \"import\",\n \"android\",\n \".\",\n \"os\",\n \".\",\n \"Bundle\",\n \";\",\n \"import\",\n \"android\",\n \".\",\n \"widget\",\n \".\",\n \"TabHost\",\n \";\",\n \"import\",\n \"cz\",\n \".\",\n \"festomat\",\n \".\",\n \"client\",\n \".\",\n \"data\",\n \".\",\n \"DataSource\",\n \";\",\n \"import\",\n \"cz\",\n \".\",\n \"festomat\",\n \".\",\n \"client\",\n \".\",\n \"tabs\",\n \".\",\n \"Chat\",\n \";\",\n \"import\",\n \"cz\",\n \".\",\n \"festomat\",\n \".\",\n \"client\",\n \".\",\n \"tabs\",\n \".\",\n \"Program\",\n \";\",\n \"public\",\n \"class\",\n \"Festival\",\n \"extends\",\n \"TabActivity\",\n \"{\",\n \"private\",\n \"String\",\n \"festivalId\",\n \"=\",\n \"null\",\n \";\",\n \"@\",\n \"Override\",\n \"public\",\n \"void\",\n \"onCreate\",\n \"(\",\n \"Bundle\",\n \"savedInstanceState\",\n \")\",\n \"{\",\n \"super\",\n \".\",\n \"onCreate\",\n \"(\",\n \"savedInstanceState\",\n \")\",\n \";\",\n \"setContentView\",\n \"(\",\n \"R\",\n \".\",\n \"layout\",\n \".\",\n \"festival\",\n \")\",\n \";\",\n \"showWaitDialog\",\n \"(\",\n \")\",\n \";\",\n \"festivalId\",\n \"=\",\n \"getIntent\",\n \"(\",\n \")\",\n \".\",\n \"getExtras\",\n \"(\",\n \")\",\n \".\",\n \"getString\",\n \"(\",\n \"\\\"festivalId\\\"\",\n \")\",\n \";\",\n \"this\",\n \".\",\n \"setTitle\",\n \"(\",\n \"DataSource\",\n \".\",\n \"getInstance\",\n \"(\",\n \")\",\n \".\",\n \"getFestivalById\",\n \"(\",\n \"festivalId\",\n \")\",\n \".\",\n \"getName\",\n \"(\",\n \")\",\n \")\",\n \";\",\n \"Bundle\",\n \"bundle\",\n \"=\",\n \"new\",\n \"Bundle\",\n \"(\",\n \")\",\n \";\",\n \"bundle\",\n \".\",\n \"putString\",\n \"(\",\n \"\\\"festivalId\\\"\",\n \",\",\n \"festivalId\",\n \")\",\n \";\",\n \"Resources\",\n \"res\",\n \"=\",\n \"getResources\",\n \"(\",\n \")\",\n \";\",\n \"TabHost\",\n \"tabHost\",\n \"=\",\n \"getTabHost\",\n \"(\",\n \")\",\n \";\",\n \"TabHost\",\n \".\",\n \"TabSpec\",\n \"spec\",\n \";\",\n \"Intent\",\n \"intent\",\n \";\",\n \"intent\",\n \"=\",\n \"new\",\n \"Intent\",\n \"(\",\n \")\",\n \".\",\n \"setClass\",\n \"(\",\n \"this\",\n \",\",\n \"Program\",\n \".\",\n \"class\",\n \")\",\n \";\",\n \"intent\",\n \".\",\n \"putExtras\",\n \"(\",\n \"bundle\",\n \")\",\n \";\",\n \"spec\",\n \"=\",\n \"tabHost\",\n \".\",\n \"newTabSpec\",\n \"(\",\n \"\\\"program\\\"\",\n \")\",\n \".\",\n \"setIndicator\",\n \"(\",\n \"\\\"Program\\\"\",\n \",\",\n \"null\",\n \")\",\n \".\",\n \"setContent\",\n \"(\",\n \"intent\",\n \")\",\n \";\",\n \"tabHost\",\n \".\",\n \"addTab\",\n \"(\",\n \"spec\",\n \")\",\n \";\",\n \"intent\",\n \"=\",\n \"new\",\n \"Intent\",\n \"(\",\n \")\",\n \".\",\n \"setClass\",\n \"(\",\n \"this\",\n \",\",\n \"Chat\",\n \".\",\n \"class\",\n \")\",\n \";\",\n \"intent\",\n \".\",\n \"putExtras\",\n \"(\",\n \"bundle\",\n \")\",\n \";\",\n \"spec\",\n \"=\",\n \"tabHost\",\n \".\",\n \"newTabSpec\",\n \"(\",\n \"\\\"chat\\\"\",\n \")\",\n \".\",\n \"setIndicator\",\n \"(\",\n \"\\\"Chat\\\"\",\n \",\",\n \"null\",\n \")\",\n \".\",\n \"setContent\",\n \"(\",\n \"intent\",\n \")\",\n \";\",\n \"tabHost\",\n \".\",\n \"addTab\",\n \"(\",\n \"spec\",\n \")\",\n \";\",\n \"tabHost\",\n \".\",\n \"setCurrentTab\",\n \"(\",\n \"0\",\n \")\",\n \";\",\n \"hideWaitDialog\",\n \"(\",\n \")\",\n \";\",\n \"}\",\n \"ProgressDialog\",\n \"progressDialog\",\n \";\",\n \"private\",\n \"void\",\n \"showWaitDialog\",\n \"(\",\n \")\",\n \"{\",\n \"progressDialog\",\n \"=\",\n \"ProgressDialog\",\n \".\",\n \"show\",\n \"(\",\n \"this\",\n \",\",\n \"\\\"\\\"\",\n \",\",\n \"\\\"Na-UNK-t-UNK-m...\\\"\",\n \",\",\n \"true\",\n \")\",\n \";\",\n \"}\",\n \"private\",\n \"void\",\n \"hideWaitDialog\",\n \"(\",\n \")\",\n \"{\",\n \"progressDialog\",\n \".\",\n \"dismiss\",\n \"(\",\n \")\",\n \";\",\n \"}\",\n \"}\",\n \"\"\n]"}}},{"rowIdx":12881,"cells":{"id":{"kind":"number","value":12881,"string":"12,881"},"code":{"kind":"list like","value":["","package","cz",".","festomat",".","client",";","import","android",".","app",".","TabActivity",";","import","android",".","content",".","Intent",";","import","android",".","content",".","res",".","Resources",";","import","android",".","os",".","Bundle",";","import","android",".","widget",".","TabHost",";","import","cz",".","festomat",".","client",".","tabs",".","FestivalList",";","import","cz",".","festomat",".","client",".","tabs",".","FestivalMap",";","public","class","FestivalSelect","extends","TabActivity","{","@","Override","public","void","onCreate","(","Bundle","savedInstanceState",")","{","super",".","onCreate","(","savedInstanceState",")",";","setContentView","(","R",".","layout",".","festival",")",";","Resources","res","=","getResources","(",")",";","TabHost","tabHost","=","getTabHost","(",")",";","TabHost",".","TabSpec","spec",";","Intent","intent",";","intent","=","new","Intent","(",")",".","setClass","(","this",",","FestivalList",".","class",")",";","spec","=","tabHost",".","newTabSpec","(","\"list\"",")",".","setIndicator","(","\"Seznam\"",",","null",")",".","setContent","(","intent",")",";","tabHost",".","addTab","(","spec",")",";","intent","=","new","Intent","(",")",".","setClass","(","this",",","FestivalMap",".","class",")",";","spec","=","tabHost",".","newTabSpec","(","\"map\"",")",".","setIndicator","(","\"Maps\"",",","null",")",".","setContent","(","intent",")",";","tabHost",".","addTab","(","spec",")",";","tabHost",".","setCurrentTab","(","0",")",";","}","}",""],"string":"[\n \"\",\n \"package\",\n \"cz\",\n \".\",\n \"festomat\",\n \".\",\n \"client\",\n \";\",\n \"import\",\n \"android\",\n \".\",\n \"app\",\n \".\",\n \"TabActivity\",\n \";\",\n \"import\",\n \"android\",\n \".\",\n \"content\",\n \".\",\n \"Intent\",\n \";\",\n \"import\",\n \"android\",\n \".\",\n \"content\",\n \".\",\n \"res\",\n \".\",\n \"Resources\",\n \";\",\n \"import\",\n \"android\",\n \".\",\n \"os\",\n \".\",\n \"Bundle\",\n \";\",\n \"import\",\n \"android\",\n \".\",\n \"widget\",\n \".\",\n \"TabHost\",\n \";\",\n \"import\",\n \"cz\",\n \".\",\n \"festomat\",\n \".\",\n \"client\",\n \".\",\n \"tabs\",\n \".\",\n \"FestivalList\",\n \";\",\n \"import\",\n \"cz\",\n \".\",\n \"festomat\",\n \".\",\n \"client\",\n \".\",\n \"tabs\",\n \".\",\n \"FestivalMap\",\n \";\",\n \"public\",\n \"class\",\n \"FestivalSelect\",\n \"extends\",\n \"TabActivity\",\n \"{\",\n \"@\",\n \"Override\",\n \"public\",\n \"void\",\n \"onCreate\",\n \"(\",\n \"Bundle\",\n \"savedInstanceState\",\n \")\",\n \"{\",\n \"super\",\n \".\",\n \"onCreate\",\n \"(\",\n \"savedInstanceState\",\n \")\",\n \";\",\n \"setContentView\",\n \"(\",\n \"R\",\n \".\",\n \"layout\",\n \".\",\n \"festival\",\n \")\",\n \";\",\n \"Resources\",\n \"res\",\n \"=\",\n \"getResources\",\n \"(\",\n \")\",\n \";\",\n \"TabHost\",\n \"tabHost\",\n \"=\",\n \"getTabHost\",\n \"(\",\n \")\",\n \";\",\n \"TabHost\",\n \".\",\n \"TabSpec\",\n \"spec\",\n \";\",\n \"Intent\",\n \"intent\",\n \";\",\n \"intent\",\n \"=\",\n \"new\",\n \"Intent\",\n \"(\",\n \")\",\n \".\",\n \"setClass\",\n \"(\",\n \"this\",\n \",\",\n \"FestivalList\",\n \".\",\n \"class\",\n \")\",\n \";\",\n \"spec\",\n \"=\",\n \"tabHost\",\n \".\",\n \"newTabSpec\",\n \"(\",\n \"\\\"list\\\"\",\n \")\",\n \".\",\n \"setIndicator\",\n \"(\",\n \"\\\"Seznam\\\"\",\n \",\",\n \"null\",\n \")\",\n \".\",\n \"setContent\",\n \"(\",\n \"intent\",\n \")\",\n \";\",\n \"tabHost\",\n \".\",\n \"addTab\",\n \"(\",\n \"spec\",\n \")\",\n \";\",\n \"intent\",\n \"=\",\n \"new\",\n \"Intent\",\n \"(\",\n \")\",\n \".\",\n \"setClass\",\n \"(\",\n \"this\",\n \",\",\n \"FestivalMap\",\n \".\",\n \"class\",\n \")\",\n \";\",\n \"spec\",\n \"=\",\n \"tabHost\",\n \".\",\n \"newTabSpec\",\n \"(\",\n \"\\\"map\\\"\",\n \")\",\n \".\",\n \"setIndicator\",\n \"(\",\n \"\\\"Maps\\\"\",\n \",\",\n \"null\",\n \")\",\n \".\",\n \"setContent\",\n \"(\",\n \"intent\",\n \")\",\n \";\",\n \"tabHost\",\n \".\",\n \"addTab\",\n \"(\",\n \"spec\",\n \")\",\n \";\",\n \"tabHost\",\n \".\",\n \"setCurrentTab\",\n \"(\",\n \"0\",\n \")\",\n \";\",\n \"}\",\n \"}\",\n \"\"\n]"}}},{"rowIdx":12882,"cells":{"id":{"kind":"number","value":12882,"string":"12,882"},"code":{"kind":"list like","value":["","package","cz",".","festomat",".","client",".","data",".","beans",";","import","java",".","util",".","Date",";","public","class","CommentBean","{","private","String","author",";","private","Date","time",";","private","String","text",";","public","CommentBean","(","String","author",",","Date","time",",","String","text",")","{","super","(",")",";","this",".","author","=","author",";","this",".","time","=","time",";","this",".","text","=","text",";","}","public","String","getAuthor","(",")","{","return","author",";","}","public","void","setAuthor","(","String","author",")","{","this",".","author","=","author",";","}","public","Date","getTime","(",")","{","return","time",";","}","public","void","setTime","(","Date","time",")","{","this",".","time","=","time",";","}","public","String","getText","(",")","{","return","text",";","}","public","void","setText","(","String","text",")","{","this",".","text","=","text",";","}","}",""],"string":"[\n \"\",\n \"package\",\n \"cz\",\n \".\",\n \"festomat\",\n \".\",\n \"client\",\n \".\",\n \"data\",\n \".\",\n \"beans\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"util\",\n \".\",\n \"Date\",\n \";\",\n \"public\",\n \"class\",\n \"CommentBean\",\n \"{\",\n \"private\",\n \"String\",\n \"author\",\n \";\",\n \"private\",\n \"Date\",\n \"time\",\n \";\",\n \"private\",\n \"String\",\n \"text\",\n \";\",\n \"public\",\n \"CommentBean\",\n \"(\",\n \"String\",\n \"author\",\n \",\",\n \"Date\",\n \"time\",\n \",\",\n \"String\",\n \"text\",\n \")\",\n \"{\",\n \"super\",\n \"(\",\n \")\",\n \";\",\n \"this\",\n \".\",\n \"author\",\n \"=\",\n \"author\",\n \";\",\n \"this\",\n \".\",\n \"time\",\n \"=\",\n \"time\",\n \";\",\n \"this\",\n \".\",\n \"text\",\n \"=\",\n \"text\",\n \";\",\n \"}\",\n \"public\",\n \"String\",\n \"getAuthor\",\n \"(\",\n \")\",\n \"{\",\n \"return\",\n \"author\",\n \";\",\n \"}\",\n \"public\",\n \"void\",\n \"setAuthor\",\n \"(\",\n \"String\",\n \"author\",\n \")\",\n \"{\",\n \"this\",\n \".\",\n \"author\",\n \"=\",\n \"author\",\n \";\",\n \"}\",\n \"public\",\n \"Date\",\n \"getTime\",\n \"(\",\n \")\",\n \"{\",\n \"return\",\n \"time\",\n \";\",\n \"}\",\n \"public\",\n \"void\",\n \"setTime\",\n \"(\",\n \"Date\",\n \"time\",\n \")\",\n \"{\",\n \"this\",\n \".\",\n \"time\",\n \"=\",\n \"time\",\n \";\",\n \"}\",\n \"public\",\n \"String\",\n \"getText\",\n \"(\",\n \")\",\n \"{\",\n \"return\",\n \"text\",\n \";\",\n \"}\",\n \"public\",\n \"void\",\n \"setText\",\n \"(\",\n \"String\",\n \"text\",\n \")\",\n \"{\",\n \"this\",\n \".\",\n \"text\",\n \"=\",\n \"text\",\n \";\",\n \"}\",\n \"}\",\n \"\"\n]"}}},{"rowIdx":12883,"cells":{"id":{"kind":"number","value":12883,"string":"12,883"},"code":{"kind":"list like","value":["","package","cz",".","festomat",".","client",".","data",".","beans",";","import","java",".","util",".","Date",";","public","class","FestivalBean","{","public","FestivalBean","(","String","id",",","String","address",",","String","name",",","String","lng",",","String","lat",",","Date","start",",","Date","end",",","String","description",")","{","super","(",")",";","this",".","id","=","id",";","this",".","address","=","address",";","this",".","name","=","name",";","this",".","lng","=","lng",";","this",".","lat","=","lat",";","this",".","start","=","start",";","this",".","end","=","end",";","this",".","description","=","description",";","}","public","FestivalBean","(",")","{","super","(",")",";","}","private","String","id",";","private","String","address",";","private","String","name",";","private","String","lng",";","private","String","lat",";","private","Date","start",";","private","Date","end",";","private","String","description",";","public","String","getId","(",")","{","return","id",";","}","public","void","setId","(","String","id",")","{","this",".","id","=","id",";","}","public","String","getAddress","(",")","{","return","address",";","}","public","void","setAddress","(","String","address",")","{","this",".","address","=","address",";","}","public","String","getName","(",")","{","return","name",";","}","public","void","setName","(","String","name",")","{","this",".","name","=","name",";","}","public","String","getLng","(",")","{","return","lng",";","}","public","void","setLng","(","String","lng",")","{","this",".","lng","=","lng",";","}","public","String","getLat","(",")","{","return","lat",";","}","public","void","setLat","(","String","lat",")","{","this",".","lat","=","lat",";","}","public","Date","getStart","(",")","{","return","start",";","}","public","void","setStart","(","Date","start",")","{","this",".","start","=","start",";","}","public","Date","getEnd","(",")","{","return","end",";","}","public","void","setEnd","(","Date","end",")","{","this",".","end","=","end",";","}","public","String","getDescription","(",")","{","return","description",";","}","public","void","setDescription","(","String","description",")","{","this",".","description","=","description",";","}","}",""],"string":"[\n \"\",\n \"package\",\n \"cz\",\n \".\",\n \"festomat\",\n \".\",\n \"client\",\n \".\",\n \"data\",\n \".\",\n \"beans\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"util\",\n \".\",\n \"Date\",\n \";\",\n \"public\",\n \"class\",\n \"FestivalBean\",\n \"{\",\n \"public\",\n \"FestivalBean\",\n \"(\",\n \"String\",\n \"id\",\n \",\",\n \"String\",\n \"address\",\n \",\",\n \"String\",\n \"name\",\n \",\",\n \"String\",\n \"lng\",\n \",\",\n \"String\",\n \"lat\",\n \",\",\n \"Date\",\n \"start\",\n \",\",\n \"Date\",\n \"end\",\n \",\",\n \"String\",\n \"description\",\n \")\",\n \"{\",\n \"super\",\n \"(\",\n \")\",\n \";\",\n \"this\",\n \".\",\n \"id\",\n \"=\",\n \"id\",\n \";\",\n \"this\",\n \".\",\n \"address\",\n \"=\",\n \"address\",\n \";\",\n \"this\",\n \".\",\n \"name\",\n \"=\",\n \"name\",\n \";\",\n \"this\",\n \".\",\n \"lng\",\n \"=\",\n \"lng\",\n \";\",\n \"this\",\n \".\",\n \"lat\",\n \"=\",\n \"lat\",\n \";\",\n \"this\",\n \".\",\n \"start\",\n \"=\",\n \"start\",\n \";\",\n \"this\",\n \".\",\n \"end\",\n \"=\",\n \"end\",\n \";\",\n \"this\",\n \".\",\n \"description\",\n \"=\",\n \"description\",\n \";\",\n \"}\",\n \"public\",\n \"FestivalBean\",\n \"(\",\n \")\",\n \"{\",\n \"super\",\n \"(\",\n \")\",\n \";\",\n \"}\",\n \"private\",\n \"String\",\n \"id\",\n \";\",\n \"private\",\n \"String\",\n \"address\",\n \";\",\n \"private\",\n \"String\",\n \"name\",\n \";\",\n \"private\",\n \"String\",\n \"lng\",\n \";\",\n \"private\",\n \"String\",\n \"lat\",\n \";\",\n \"private\",\n \"Date\",\n \"start\",\n \";\",\n \"private\",\n \"Date\",\n \"end\",\n \";\",\n \"private\",\n \"String\",\n \"description\",\n \";\",\n \"public\",\n \"String\",\n \"getId\",\n \"(\",\n \")\",\n \"{\",\n \"return\",\n \"id\",\n \";\",\n \"}\",\n \"public\",\n \"void\",\n \"setId\",\n \"(\",\n \"String\",\n \"id\",\n \")\",\n \"{\",\n \"this\",\n \".\",\n \"id\",\n \"=\",\n \"id\",\n \";\",\n \"}\",\n \"public\",\n \"String\",\n \"getAddress\",\n \"(\",\n \")\",\n \"{\",\n \"return\",\n \"address\",\n \";\",\n \"}\",\n \"public\",\n \"void\",\n \"setAddress\",\n \"(\",\n \"String\",\n \"address\",\n \")\",\n \"{\",\n \"this\",\n \".\",\n \"address\",\n \"=\",\n \"address\",\n \";\",\n \"}\",\n \"public\",\n \"String\",\n \"getName\",\n \"(\",\n \")\",\n \"{\",\n \"return\",\n \"name\",\n \";\",\n \"}\",\n \"public\",\n \"void\",\n \"setName\",\n \"(\",\n \"String\",\n \"name\",\n \")\",\n \"{\",\n \"this\",\n \".\",\n \"name\",\n \"=\",\n \"name\",\n \";\",\n \"}\",\n \"public\",\n \"String\",\n \"getLng\",\n \"(\",\n \")\",\n \"{\",\n \"return\",\n \"lng\",\n \";\",\n \"}\",\n \"public\",\n \"void\",\n \"setLng\",\n \"(\",\n \"String\",\n \"lng\",\n \")\",\n \"{\",\n \"this\",\n \".\",\n \"lng\",\n \"=\",\n \"lng\",\n \";\",\n \"}\",\n \"public\",\n \"String\",\n \"getLat\",\n \"(\",\n \")\",\n \"{\",\n \"return\",\n \"lat\",\n \";\",\n \"}\",\n \"public\",\n \"void\",\n \"setLat\",\n \"(\",\n \"String\",\n \"lat\",\n \")\",\n \"{\",\n \"this\",\n \".\",\n \"lat\",\n \"=\",\n \"lat\",\n \";\",\n \"}\",\n \"public\",\n \"Date\",\n \"getStart\",\n \"(\",\n \")\",\n \"{\",\n \"return\",\n \"start\",\n \";\",\n \"}\",\n \"public\",\n \"void\",\n \"setStart\",\n \"(\",\n \"Date\",\n \"start\",\n \")\",\n \"{\",\n \"this\",\n \".\",\n \"start\",\n \"=\",\n \"start\",\n \";\",\n \"}\",\n \"public\",\n \"Date\",\n \"getEnd\",\n \"(\",\n \")\",\n \"{\",\n \"return\",\n \"end\",\n \";\",\n \"}\",\n \"public\",\n \"void\",\n \"setEnd\",\n \"(\",\n \"Date\",\n \"end\",\n \")\",\n \"{\",\n \"this\",\n \".\",\n \"end\",\n \"=\",\n \"end\",\n \";\",\n \"}\",\n \"public\",\n \"String\",\n \"getDescription\",\n \"(\",\n \")\",\n \"{\",\n \"return\",\n \"description\",\n \";\",\n \"}\",\n \"public\",\n \"void\",\n \"setDescription\",\n \"(\",\n \"String\",\n \"description\",\n \")\",\n \"{\",\n \"this\",\n \".\",\n \"description\",\n \"=\",\n \"description\",\n \";\",\n \"}\",\n \"}\",\n \"\"\n]"}}},{"rowIdx":12884,"cells":{"id":{"kind":"number","value":12884,"string":"12,884"},"code":{"kind":"list like","value":["","package","cz",".","festomat",".","client",".","data",".","beans",";","import","java",".","util",".","Date",";","public","class","FestivalListBean","{","private","String","id",";","private","String","name",";","private","String","lng",",","lat",";","private","Date","start",";","public","FestivalListBean","(","String","id",",","String","name",",","String","lng",",","String","lat",",","Date","start",")","{","super","(",")",";","this",".","id","=","id",";","this",".","name","=","name",";","this",".","lng","=","lng",";","this",".","lat","=","lat",";","this",".","start","=","start",";","}","public","FestivalListBean","(",")","{","}","public","String","getId","(",")","{","return","id",";","}","public","void","setId","(","String","id",")","{","this",".","id","=","id",";","}","public","String","getName","(",")","{","return","name",";","}","public","void","setName","(","String","name",")","{","this",".","name","=","name",";","}","public","String","getLng","(",")","{","return","lng",";","}","public","void","setLng","(","String","lng",")","{","this",".","lng","=","lng",";","}","public","String","getLat","(",")","{","return","lat",";","}","public","void","setLat","(","String","lat",")","{","this",".","lat","=","lat",";","}","public","Date","getStart","(",")","{","return","start",";","}","public","void","setStart","(","Date","start",")","{","this",".","start","=","start",";","}","}",""],"string":"[\n \"\",\n \"package\",\n \"cz\",\n \".\",\n \"festomat\",\n \".\",\n \"client\",\n \".\",\n \"data\",\n \".\",\n \"beans\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"util\",\n \".\",\n \"Date\",\n \";\",\n \"public\",\n \"class\",\n \"FestivalListBean\",\n \"{\",\n \"private\",\n \"String\",\n \"id\",\n \";\",\n \"private\",\n \"String\",\n \"name\",\n \";\",\n \"private\",\n \"String\",\n \"lng\",\n \",\",\n \"lat\",\n \";\",\n \"private\",\n \"Date\",\n \"start\",\n \";\",\n \"public\",\n \"FestivalListBean\",\n \"(\",\n \"String\",\n \"id\",\n \",\",\n \"String\",\n \"name\",\n \",\",\n \"String\",\n \"lng\",\n \",\",\n \"String\",\n \"lat\",\n \",\",\n \"Date\",\n \"start\",\n \")\",\n \"{\",\n \"super\",\n \"(\",\n \")\",\n \";\",\n \"this\",\n \".\",\n \"id\",\n \"=\",\n \"id\",\n \";\",\n \"this\",\n \".\",\n \"name\",\n \"=\",\n \"name\",\n \";\",\n \"this\",\n \".\",\n \"lng\",\n \"=\",\n \"lng\",\n \";\",\n \"this\",\n \".\",\n \"lat\",\n \"=\",\n \"lat\",\n \";\",\n \"this\",\n \".\",\n \"start\",\n \"=\",\n \"start\",\n \";\",\n \"}\",\n \"public\",\n \"FestivalListBean\",\n \"(\",\n \")\",\n \"{\",\n \"}\",\n \"public\",\n \"String\",\n \"getId\",\n \"(\",\n \")\",\n \"{\",\n \"return\",\n \"id\",\n \";\",\n \"}\",\n \"public\",\n \"void\",\n \"setId\",\n \"(\",\n \"String\",\n \"id\",\n \")\",\n \"{\",\n \"this\",\n \".\",\n \"id\",\n \"=\",\n \"id\",\n \";\",\n \"}\",\n \"public\",\n \"String\",\n \"getName\",\n \"(\",\n \")\",\n \"{\",\n \"return\",\n \"name\",\n \";\",\n \"}\",\n \"public\",\n \"void\",\n \"setName\",\n \"(\",\n \"String\",\n \"name\",\n \")\",\n \"{\",\n \"this\",\n \".\",\n \"name\",\n \"=\",\n \"name\",\n \";\",\n \"}\",\n \"public\",\n \"String\",\n \"getLng\",\n \"(\",\n \")\",\n \"{\",\n \"return\",\n \"lng\",\n \";\",\n \"}\",\n \"public\",\n \"void\",\n \"setLng\",\n \"(\",\n \"String\",\n \"lng\",\n \")\",\n \"{\",\n \"this\",\n \".\",\n \"lng\",\n \"=\",\n \"lng\",\n \";\",\n \"}\",\n \"public\",\n \"String\",\n \"getLat\",\n \"(\",\n \")\",\n \"{\",\n \"return\",\n \"lat\",\n \";\",\n \"}\",\n \"public\",\n \"void\",\n \"setLat\",\n \"(\",\n \"String\",\n \"lat\",\n \")\",\n \"{\",\n \"this\",\n \".\",\n \"lat\",\n \"=\",\n \"lat\",\n \";\",\n \"}\",\n \"public\",\n \"Date\",\n \"getStart\",\n \"(\",\n \")\",\n \"{\",\n \"return\",\n \"start\",\n \";\",\n \"}\",\n \"public\",\n \"void\",\n \"setStart\",\n \"(\",\n \"Date\",\n \"start\",\n \")\",\n \"{\",\n \"this\",\n \".\",\n \"start\",\n \"=\",\n \"start\",\n \";\",\n \"}\",\n \"}\",\n \"\"\n]"}}},{"rowIdx":12885,"cells":{"id":{"kind":"number","value":12885,"string":"12,885"},"code":{"kind":"list like","value":["","package","cz",".","festomat",".","client",".","data",";","import","java",".","io",".","IOException",";","import","java",".","util",".","ArrayList",";","import","java",".","util",".","Collections",";","import","java",".","util",".","HashMap",";","import","java",".","util",".","List",";","import","java",".","util",".","Map",";","import","org",".","apache",".","http",".","HttpResponse",";","import","org",".","apache",".","http",".","NameValuePair",";","import","org",".","apache",".","http",".","client",".","ClientProtocolException",";","import","org",".","apache",".","http",".","client",".","HttpClient",";","import","org",".","apache",".","http",".","client",".","entity",".","UrlEncodedFormEntity",";","import","org",".","apache",".","http",".","client",".","methods",".","HttpPost",";","import","org",".","apache",".","http",".","impl",".","client",".","DefaultHttpClient",";","import","org",".","apache",".","http",".","message",".","BasicNameValuePair",";","import","com",".","google",".","gson",".","Gson",";","import","com",".","google",".","gson",".","reflect",".","TypeToken",";","import","cz",".","festomat",".","client",".","data",".","beans",".","CommentBean",";","import","cz",".","festomat",".","client",".","data",".","beans",".","FestivalBean",";","import","cz",".","festomat",".","client",".","data",".","beans",".","FestivalListBean",";","public","class","DataSourceImpl","implements","IDataSource","{","RestClient","rc",";","public","DataSourceImpl","(",")","{","rc","=","new","RestClient","(",")",";","}","@","Override","public","List","<","FestivalListBean",">","getAllFestivalls","(",")","{","return","(","List","<","FestivalListBean",">",")","rc",".","getData","(","\"list\"",",","new","TypeToken","<","List","<","FestivalListBean",">",">","(",")","{","}",".","getType","(",")",")",";","}","Map","<","String",",","FestivalBean",">","festivals","=","new","HashMap","<","String",",","FestivalBean",">","(",")",";","@","Override","public","FestivalBean","getFestivalById","(","String","id",")","{","if","(","!","festivals",".","containsKey","(","id",")",")","{","FestivalBean","fb","=","(","FestivalBean",")","rc",".","getData","(","id",",","new","TypeToken","<","FestivalBean",">","(",")","{","}",".","getType","(",")",")",";","festivals",".","put","(","id",",","fb",")",";","}","return","festivals",".","get","(","id",")",";","}","@","Override","public","List","<","CommentBean",">","getAllComments","(","String","festivalId",")","{","List","<","CommentBean",">","list","=","(","List","<","CommentBean",">",")","rc",".","getData","(","festivalId","+","\"/comments\"",",","new","TypeToken","<","List","<","CommentBean",">",">","(",")","{","}",".","getType","(",")",")",";","if","(","list","==","null",")","{","list","=","Collections",".","EMPTY_LIST",";","}","return","list",";","}","@","Override","public","List","<","CommentBean",">","getFilteredComments","(","String","festivalId",",","String","needle",")","{","List","<","CommentBean",">","list","=","(","List","<","CommentBean",">",")","rc",".","getData","(","festivalId","+","\"\"","+","needle",",","new","TypeToken","<","List","<","CommentBean",">",">","(",")","{","}",".","getType","(",")",")",";","if","(","list","==","null",")","{","list","=","Collections",".","EMPTY_LIST",";","}","return","list",";","}","@","Override","public","void","sendComment","(","String","festivalId",",","CommentBean","comment",")","{","HttpClient","httpclient","=","new","DefaultHttpClient","(",")",";","HttpPost","httppost","=","new","HttpPost","(","RestClient",".","BASEURL","+","festivalId","+","\"/comments\"",")",";","try","{","Gson","gson","=","new","Gson","(",")",";","List","<","NameValuePair",">","nameValuePairs","=","new","ArrayList","<","NameValuePair",">","(","2",")",";","nameValuePairs",".","add","(","new","BasicNameValuePair","(","\"comment\"",",","gson",".","toJson","(","comment",")",")",")",";","httppost",".","setEntity","(","new","UrlEncodedFormEntity","(","nameValuePairs",")",")",";","HttpResponse","response","=","httpclient",".","execute","(","httppost",")",";","}","catch","(","ClientProtocolException","e",")","{","}","catch","(","IOException","e",")","{","}","}","}",""],"string":"[\n \"\",\n \"package\",\n \"cz\",\n \".\",\n \"festomat\",\n \".\",\n \"client\",\n \".\",\n \"data\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"io\",\n \".\",\n \"IOException\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"util\",\n \".\",\n \"ArrayList\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"util\",\n \".\",\n \"Collections\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"util\",\n \".\",\n \"HashMap\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"util\",\n \".\",\n \"List\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"util\",\n \".\",\n \"Map\",\n \";\",\n \"import\",\n \"org\",\n \".\",\n \"apache\",\n \".\",\n \"http\",\n \".\",\n \"HttpResponse\",\n \";\",\n \"import\",\n \"org\",\n \".\",\n \"apache\",\n \".\",\n \"http\",\n \".\",\n \"NameValuePair\",\n \";\",\n \"import\",\n \"org\",\n \".\",\n \"apache\",\n \".\",\n \"http\",\n \".\",\n \"client\",\n \".\",\n \"ClientProtocolException\",\n \";\",\n \"import\",\n \"org\",\n \".\",\n \"apache\",\n \".\",\n \"http\",\n \".\",\n \"client\",\n \".\",\n \"HttpClient\",\n \";\",\n \"import\",\n \"org\",\n \".\",\n \"apache\",\n \".\",\n \"http\",\n \".\",\n \"client\",\n \".\",\n \"entity\",\n \".\",\n \"UrlEncodedFormEntity\",\n \";\",\n \"import\",\n \"org\",\n \".\",\n \"apache\",\n \".\",\n \"http\",\n \".\",\n \"client\",\n \".\",\n \"methods\",\n \".\",\n \"HttpPost\",\n \";\",\n \"import\",\n \"org\",\n \".\",\n \"apache\",\n \".\",\n \"http\",\n \".\",\n \"impl\",\n \".\",\n \"client\",\n \".\",\n \"DefaultHttpClient\",\n \";\",\n \"import\",\n \"org\",\n \".\",\n \"apache\",\n \".\",\n \"http\",\n \".\",\n \"message\",\n \".\",\n \"BasicNameValuePair\",\n \";\",\n \"import\",\n \"com\",\n \".\",\n \"google\",\n \".\",\n \"gson\",\n \".\",\n \"Gson\",\n \";\",\n \"import\",\n \"com\",\n \".\",\n \"google\",\n \".\",\n \"gson\",\n \".\",\n \"reflect\",\n \".\",\n \"TypeToken\",\n \";\",\n \"import\",\n \"cz\",\n \".\",\n \"festomat\",\n \".\",\n \"client\",\n \".\",\n \"data\",\n \".\",\n \"beans\",\n \".\",\n \"CommentBean\",\n \";\",\n \"import\",\n \"cz\",\n \".\",\n \"festomat\",\n \".\",\n \"client\",\n \".\",\n \"data\",\n \".\",\n \"beans\",\n \".\",\n \"FestivalBean\",\n \";\",\n \"import\",\n \"cz\",\n \".\",\n \"festomat\",\n \".\",\n \"client\",\n \".\",\n \"data\",\n \".\",\n \"beans\",\n \".\",\n \"FestivalListBean\",\n \";\",\n \"public\",\n \"class\",\n \"DataSourceImpl\",\n \"implements\",\n \"IDataSource\",\n \"{\",\n \"RestClient\",\n \"rc\",\n \";\",\n \"public\",\n \"DataSourceImpl\",\n \"(\",\n \")\",\n \"{\",\n \"rc\",\n \"=\",\n \"new\",\n \"RestClient\",\n \"(\",\n \")\",\n \";\",\n \"}\",\n \"@\",\n \"Override\",\n \"public\",\n \"List\",\n \"<\",\n \"FestivalListBean\",\n \">\",\n \"getAllFestivalls\",\n \"(\",\n \")\",\n \"{\",\n \"return\",\n \"(\",\n \"List\",\n \"<\",\n \"FestivalListBean\",\n \">\",\n \")\",\n \"rc\",\n \".\",\n \"getData\",\n \"(\",\n \"\\\"list\\\"\",\n \",\",\n \"new\",\n \"TypeToken\",\n \"<\",\n \"List\",\n \"<\",\n \"FestivalListBean\",\n \">\",\n \">\",\n \"(\",\n \")\",\n \"{\",\n \"}\",\n \".\",\n \"getType\",\n \"(\",\n \")\",\n \")\",\n \";\",\n \"}\",\n \"Map\",\n \"<\",\n \"String\",\n \",\",\n \"FestivalBean\",\n \">\",\n \"festivals\",\n \"=\",\n \"new\",\n \"HashMap\",\n \"<\",\n \"String\",\n \",\",\n \"FestivalBean\",\n \">\",\n \"(\",\n \")\",\n \";\",\n \"@\",\n \"Override\",\n \"public\",\n \"FestivalBean\",\n \"getFestivalById\",\n \"(\",\n \"String\",\n \"id\",\n \")\",\n \"{\",\n \"if\",\n \"(\",\n \"!\",\n \"festivals\",\n \".\",\n \"containsKey\",\n \"(\",\n \"id\",\n \")\",\n \")\",\n \"{\",\n \"FestivalBean\",\n \"fb\",\n \"=\",\n \"(\",\n \"FestivalBean\",\n \")\",\n \"rc\",\n \".\",\n \"getData\",\n \"(\",\n \"id\",\n \",\",\n \"new\",\n \"TypeToken\",\n \"<\",\n \"FestivalBean\",\n \">\",\n \"(\",\n \")\",\n \"{\",\n \"}\",\n \".\",\n \"getType\",\n \"(\",\n \")\",\n \")\",\n \";\",\n \"festivals\",\n \".\",\n \"put\",\n \"(\",\n \"id\",\n \",\",\n \"fb\",\n \")\",\n \";\",\n \"}\",\n \"return\",\n \"festivals\",\n \".\",\n \"get\",\n \"(\",\n \"id\",\n \")\",\n \";\",\n \"}\",\n \"@\",\n \"Override\",\n \"public\",\n \"List\",\n \"<\",\n \"CommentBean\",\n \">\",\n \"getAllComments\",\n \"(\",\n \"String\",\n \"festivalId\",\n \")\",\n \"{\",\n \"List\",\n \"<\",\n \"CommentBean\",\n \">\",\n \"list\",\n \"=\",\n \"(\",\n \"List\",\n \"<\",\n \"CommentBean\",\n \">\",\n \")\",\n \"rc\",\n \".\",\n \"getData\",\n \"(\",\n \"festivalId\",\n \"+\",\n \"\\\"/comments\\\"\",\n \",\",\n \"new\",\n \"TypeToken\",\n \"<\",\n \"List\",\n \"<\",\n \"CommentBean\",\n \">\",\n \">\",\n \"(\",\n \")\",\n \"{\",\n \"}\",\n \".\",\n \"getType\",\n \"(\",\n \")\",\n \")\",\n \";\",\n \"if\",\n \"(\",\n \"list\",\n \"==\",\n \"null\",\n \")\",\n \"{\",\n \"list\",\n \"=\",\n \"Collections\",\n \".\",\n \"EMPTY_LIST\",\n \";\",\n \"}\",\n \"return\",\n \"list\",\n \";\",\n \"}\",\n \"@\",\n \"Override\",\n \"public\",\n \"List\",\n \"<\",\n \"CommentBean\",\n \">\",\n \"getFilteredComments\",\n \"(\",\n \"String\",\n \"festivalId\",\n \",\",\n \"String\",\n \"needle\",\n \")\",\n \"{\",\n \"List\",\n \"<\",\n \"CommentBean\",\n \">\",\n \"list\",\n \"=\",\n \"(\",\n \"List\",\n \"<\",\n \"CommentBean\",\n \">\",\n \")\",\n \"rc\",\n \".\",\n \"getData\",\n \"(\",\n \"festivalId\",\n \"+\",\n \"\\\"\\\"\",\n \"+\",\n \"needle\",\n \",\",\n \"new\",\n \"TypeToken\",\n \"<\",\n \"List\",\n \"<\",\n \"CommentBean\",\n \">\",\n \">\",\n \"(\",\n \")\",\n \"{\",\n \"}\",\n \".\",\n \"getType\",\n \"(\",\n \")\",\n \")\",\n \";\",\n \"if\",\n \"(\",\n \"list\",\n \"==\",\n \"null\",\n \")\",\n \"{\",\n \"list\",\n \"=\",\n \"Collections\",\n \".\",\n \"EMPTY_LIST\",\n \";\",\n \"}\",\n \"return\",\n \"list\",\n \";\",\n \"}\",\n \"@\",\n \"Override\",\n \"public\",\n \"void\",\n \"sendComment\",\n \"(\",\n \"String\",\n \"festivalId\",\n \",\",\n \"CommentBean\",\n \"comment\",\n \")\",\n \"{\",\n \"HttpClient\",\n \"httpclient\",\n \"=\",\n \"new\",\n \"DefaultHttpClient\",\n \"(\",\n \")\",\n \";\",\n \"HttpPost\",\n \"httppost\",\n \"=\",\n \"new\",\n \"HttpPost\",\n \"(\",\n \"RestClient\",\n \".\",\n \"BASEURL\",\n \"+\",\n \"festivalId\",\n \"+\",\n \"\\\"/comments\\\"\",\n \")\",\n \";\",\n \"try\",\n \"{\",\n \"Gson\",\n \"gson\",\n \"=\",\n \"new\",\n \"Gson\",\n \"(\",\n \")\",\n \";\",\n \"List\",\n \"<\",\n \"NameValuePair\",\n \">\",\n \"nameValuePairs\",\n \"=\",\n \"new\",\n \"ArrayList\",\n \"<\",\n \"NameValuePair\",\n \">\",\n \"(\",\n \"2\",\n \")\",\n \";\",\n \"nameValuePairs\",\n \".\",\n \"add\",\n \"(\",\n \"new\",\n \"BasicNameValuePair\",\n \"(\",\n \"\\\"comment\\\"\",\n \",\",\n \"gson\",\n \".\",\n \"toJson\",\n \"(\",\n \"comment\",\n \")\",\n \")\",\n \")\",\n \";\",\n \"httppost\",\n \".\",\n \"setEntity\",\n \"(\",\n \"new\",\n \"UrlEncodedFormEntity\",\n \"(\",\n \"nameValuePairs\",\n \")\",\n \")\",\n \";\",\n \"HttpResponse\",\n \"response\",\n \"=\",\n \"httpclient\",\n \".\",\n \"execute\",\n \"(\",\n \"httppost\",\n \")\",\n \";\",\n \"}\",\n \"catch\",\n \"(\",\n \"ClientProtocolException\",\n \"e\",\n \")\",\n \"{\",\n \"}\",\n \"catch\",\n \"(\",\n \"IOException\",\n \"e\",\n \")\",\n \"{\",\n \"}\",\n \"}\",\n \"}\",\n \"\"\n]"}}},{"rowIdx":12886,"cells":{"id":{"kind":"number","value":12886,"string":"12,886"},"code":{"kind":"list like","value":["","package","cz",".","festomat",".","client",".","data",";","import","java",".","util",".","List",";","import","cz",".","festomat",".","client",".","data",".","beans",".","CommentBean",";","import","cz",".","festomat",".","client",".","data",".","beans",".","FestivalBean",";","import","cz",".","festomat",".","client",".","data",".","beans",".","FestivalListBean",";","public","interface","IDataSource","{","List","<","FestivalListBean",">","getAllFestivalls","(",")",";","FestivalBean","getFestivalById","(","String","id",")",";","List","<","CommentBean",">","getAllComments","(","String","festivalId",")",";","List","<","CommentBean",">","getFilteredComments","(","String","festivalId",",","String","needle",")",";","void","sendComment","(","String","festivalId",",","CommentBean","comment",")",";","}",""],"string":"[\n \"\",\n \"package\",\n \"cz\",\n \".\",\n \"festomat\",\n \".\",\n \"client\",\n \".\",\n \"data\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"util\",\n \".\",\n \"List\",\n \";\",\n \"import\",\n \"cz\",\n \".\",\n \"festomat\",\n \".\",\n \"client\",\n \".\",\n \"data\",\n \".\",\n \"beans\",\n \".\",\n \"CommentBean\",\n \";\",\n \"import\",\n \"cz\",\n \".\",\n \"festomat\",\n \".\",\n \"client\",\n \".\",\n \"data\",\n \".\",\n \"beans\",\n \".\",\n \"FestivalBean\",\n \";\",\n \"import\",\n \"cz\",\n \".\",\n \"festomat\",\n \".\",\n \"client\",\n \".\",\n \"data\",\n \".\",\n \"beans\",\n \".\",\n \"FestivalListBean\",\n \";\",\n \"public\",\n \"interface\",\n \"IDataSource\",\n \"{\",\n \"List\",\n \"<\",\n \"FestivalListBean\",\n \">\",\n \"getAllFestivalls\",\n \"(\",\n \")\",\n \";\",\n \"FestivalBean\",\n \"getFestivalById\",\n \"(\",\n \"String\",\n \"id\",\n \")\",\n \";\",\n \"List\",\n \"<\",\n \"CommentBean\",\n \">\",\n \"getAllComments\",\n \"(\",\n \"String\",\n \"festivalId\",\n \")\",\n \";\",\n \"List\",\n \"<\",\n \"CommentBean\",\n \">\",\n \"getFilteredComments\",\n \"(\",\n \"String\",\n \"festivalId\",\n \",\",\n \"String\",\n \"needle\",\n \")\",\n \";\",\n \"void\",\n \"sendComment\",\n \"(\",\n \"String\",\n \"festivalId\",\n \",\",\n \"CommentBean\",\n \"comment\",\n \")\",\n \";\",\n \"}\",\n \"\"\n]"}}},{"rowIdx":12887,"cells":{"id":{"kind":"number","value":12887,"string":"12,887"},"code":{"kind":"list like","value":["","package","cz",".","festomat",".","client",".","data",";","import","java",".","io",".","BufferedReader",";","import","java",".","io",".","IOException",";","import","java",".","io",".","InputStream",";","import","java",".","io",".","InputStreamReader",";","import","java",".","lang",".","reflect",".","Type",";","import","org",".","apache",".","http",".","HttpEntity",";","import","org",".","apache",".","http",".","HttpResponse",";","import","org",".","apache",".","http",".","client",".","HttpClient",";","import","org",".","apache",".","http",".","client",".","methods",".","HttpGet",";","import","org",".","apache",".","http",".","impl",".","client",".","DefaultHttpClient",";","import","android",".","util",".","Log",";","import","com",".","google",".","gson",".","Gson",";","public","class","RestClient","{","public","static","final","String","BASEURL","=","\"\"",";","private","String","convertStreamToString","(","InputStream","is",")","{","BufferedReader","reader","=","new","BufferedReader","(","new","InputStreamReader","(","is",")",")",";","StringBuilder","sb","=","new","StringBuilder","(",")",";","String","line","=","null",";","try","{","while","(","(","line","=","reader",".","readLine","(",")",")","!=","null",")","{","sb",".","append","(","line","+","\"n\"",")",";","}","}","catch","(","IOException","e",")","{","e",".","printStackTrace","(",")",";","}","finally","{","try","{","is",".","close","(",")",";","}","catch","(","IOException","e",")","{","e",".","printStackTrace","(",")",";","}","}","return","sb",".","toString","(",")",";","}","public","Object","getData","(","String","url",",","Type","cls",")","{","Object","data","=","null",";","HttpClient","httpclient","=","new","DefaultHttpClient","(",")",";","HttpGet","httpget","=","new","HttpGet","(","BASEURL","+","url",")",";","HttpResponse","response",";","try","{","response","=","httpclient",".","execute","(","httpget",")",";","HttpEntity","entity","=","response",".","getEntity","(",")",";","if","(","entity","!=","null",")","{","InputStream","instream","=","entity",".","getContent","(",")",";","String","json","=","convertStreamToString","(","instream",")",";","Gson","gson","=","new","Gson","(",")",";","data","=","gson",".","fromJson","(","json",",","cls",")",";","}","}","catch","(","Exception","e",")","{","Log",".","e","(","\"Praeda\"",",","e",".","getMessage","(",")",")",";","}","return","data",";","}","}",""],"string":"[\n \"\",\n \"package\",\n \"cz\",\n \".\",\n \"festomat\",\n \".\",\n \"client\",\n \".\",\n \"data\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"io\",\n \".\",\n \"BufferedReader\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"io\",\n \".\",\n \"IOException\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"io\",\n \".\",\n \"InputStream\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"io\",\n \".\",\n \"InputStreamReader\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"lang\",\n \".\",\n \"reflect\",\n \".\",\n \"Type\",\n \";\",\n \"import\",\n \"org\",\n \".\",\n \"apache\",\n \".\",\n \"http\",\n \".\",\n \"HttpEntity\",\n \";\",\n \"import\",\n \"org\",\n \".\",\n \"apache\",\n \".\",\n \"http\",\n \".\",\n \"HttpResponse\",\n \";\",\n \"import\",\n \"org\",\n \".\",\n \"apache\",\n \".\",\n \"http\",\n \".\",\n \"client\",\n \".\",\n \"HttpClient\",\n \";\",\n \"import\",\n \"org\",\n \".\",\n \"apache\",\n \".\",\n \"http\",\n \".\",\n \"client\",\n \".\",\n \"methods\",\n \".\",\n \"HttpGet\",\n \";\",\n \"import\",\n \"org\",\n \".\",\n \"apache\",\n \".\",\n \"http\",\n \".\",\n \"impl\",\n \".\",\n \"client\",\n \".\",\n \"DefaultHttpClient\",\n \";\",\n \"import\",\n \"android\",\n \".\",\n \"util\",\n \".\",\n \"Log\",\n \";\",\n \"import\",\n \"com\",\n \".\",\n \"google\",\n \".\",\n \"gson\",\n \".\",\n \"Gson\",\n \";\",\n \"public\",\n \"class\",\n \"RestClient\",\n \"{\",\n \"public\",\n \"static\",\n \"final\",\n \"String\",\n \"BASEURL\",\n \"=\",\n \"\\\"\\\"\",\n \";\",\n \"private\",\n \"String\",\n \"convertStreamToString\",\n \"(\",\n \"InputStream\",\n \"is\",\n \")\",\n \"{\",\n \"BufferedReader\",\n \"reader\",\n \"=\",\n \"new\",\n \"BufferedReader\",\n \"(\",\n \"new\",\n \"InputStreamReader\",\n \"(\",\n \"is\",\n \")\",\n \")\",\n \";\",\n \"StringBuilder\",\n \"sb\",\n \"=\",\n \"new\",\n \"StringBuilder\",\n \"(\",\n \")\",\n \";\",\n \"String\",\n \"line\",\n \"=\",\n \"null\",\n \";\",\n \"try\",\n \"{\",\n \"while\",\n \"(\",\n \"(\",\n \"line\",\n \"=\",\n \"reader\",\n \".\",\n \"readLine\",\n \"(\",\n \")\",\n \")\",\n \"!=\",\n \"null\",\n \")\",\n \"{\",\n \"sb\",\n \".\",\n \"append\",\n \"(\",\n \"line\",\n \"+\",\n \"\\\"n\\\"\",\n \")\",\n \";\",\n \"}\",\n \"}\",\n \"catch\",\n \"(\",\n \"IOException\",\n \"e\",\n \")\",\n \"{\",\n \"e\",\n \".\",\n \"printStackTrace\",\n \"(\",\n \")\",\n \";\",\n \"}\",\n \"finally\",\n \"{\",\n \"try\",\n \"{\",\n \"is\",\n \".\",\n \"close\",\n \"(\",\n \")\",\n \";\",\n \"}\",\n \"catch\",\n \"(\",\n \"IOException\",\n \"e\",\n \")\",\n \"{\",\n \"e\",\n \".\",\n \"printStackTrace\",\n \"(\",\n \")\",\n \";\",\n \"}\",\n \"}\",\n \"return\",\n \"sb\",\n \".\",\n \"toString\",\n \"(\",\n \")\",\n \";\",\n \"}\",\n \"public\",\n \"Object\",\n \"getData\",\n \"(\",\n \"String\",\n \"url\",\n \",\",\n \"Type\",\n \"cls\",\n \")\",\n \"{\",\n \"Object\",\n \"data\",\n \"=\",\n \"null\",\n \";\",\n \"HttpClient\",\n \"httpclient\",\n \"=\",\n \"new\",\n \"DefaultHttpClient\",\n \"(\",\n \")\",\n \";\",\n \"HttpGet\",\n \"httpget\",\n \"=\",\n \"new\",\n \"HttpGet\",\n \"(\",\n \"BASEURL\",\n \"+\",\n \"url\",\n \")\",\n \";\",\n \"HttpResponse\",\n \"response\",\n \";\",\n \"try\",\n \"{\",\n \"response\",\n \"=\",\n \"httpclient\",\n \".\",\n \"execute\",\n \"(\",\n \"httpget\",\n \")\",\n \";\",\n \"HttpEntity\",\n \"entity\",\n \"=\",\n \"response\",\n \".\",\n \"getEntity\",\n \"(\",\n \")\",\n \";\",\n \"if\",\n \"(\",\n \"entity\",\n \"!=\",\n \"null\",\n \")\",\n \"{\",\n \"InputStream\",\n \"instream\",\n \"=\",\n \"entity\",\n \".\",\n \"getContent\",\n \"(\",\n \")\",\n \";\",\n \"String\",\n \"json\",\n \"=\",\n \"convertStreamToString\",\n \"(\",\n \"instream\",\n \")\",\n \";\",\n \"Gson\",\n \"gson\",\n \"=\",\n \"new\",\n \"Gson\",\n \"(\",\n \")\",\n \";\",\n \"data\",\n \"=\",\n \"gson\",\n \".\",\n \"fromJson\",\n \"(\",\n \"json\",\n \",\",\n \"cls\",\n \")\",\n \";\",\n \"}\",\n \"}\",\n \"catch\",\n \"(\",\n \"Exception\",\n \"e\",\n \")\",\n \"{\",\n \"Log\",\n \".\",\n \"e\",\n \"(\",\n \"\\\"Praeda\\\"\",\n \",\",\n \"e\",\n \".\",\n \"getMessage\",\n \"(\",\n \")\",\n \")\",\n \";\",\n \"}\",\n \"return\",\n \"data\",\n \";\",\n \"}\",\n \"}\",\n \"\"\n]"}}},{"rowIdx":12888,"cells":{"id":{"kind":"number","value":12888,"string":"12,888"},"code":{"kind":"list like","value":["","package","cz",".","festomat",".","client",".","data",";","public","class","DataSource","{","private","static","IDataSource","instance","=","null",";","private","DataSource","(",")","{","}","public","static","IDataSource","getInstance","(",")","{","if","(","instance","==","null",")","{","instance","=","new","DataSourceImpl","(",")",";","}","return","instance",";","}","}",""],"string":"[\n \"\",\n \"package\",\n \"cz\",\n \".\",\n \"festomat\",\n \".\",\n \"client\",\n \".\",\n \"data\",\n \";\",\n \"public\",\n \"class\",\n \"DataSource\",\n \"{\",\n \"private\",\n \"static\",\n \"IDataSource\",\n \"instance\",\n \"=\",\n \"null\",\n \";\",\n \"private\",\n \"DataSource\",\n \"(\",\n \")\",\n \"{\",\n \"}\",\n \"public\",\n \"static\",\n \"IDataSource\",\n \"getInstance\",\n \"(\",\n \")\",\n \"{\",\n \"if\",\n \"(\",\n \"instance\",\n \"==\",\n \"null\",\n \")\",\n \"{\",\n \"instance\",\n \"=\",\n \"new\",\n \"DataSourceImpl\",\n \"(\",\n \")\",\n \";\",\n \"}\",\n \"return\",\n \"instance\",\n \";\",\n \"}\",\n \"}\",\n \"\"\n]"}}},{"rowIdx":12889,"cells":{"id":{"kind":"number","value":12889,"string":"12,889"},"code":{"kind":"list like","value":["","package","cz",".","festomat",".","client",".","data",";","import","java",".","util",".","ArrayList",";","import","java",".","util",".","Collections",";","import","java",".","util",".","Date",";","import","java",".","util",".","HashMap",";","import","java",".","util",".","List",";","import","java",".","util",".","Map",";","import","android",".","util",".","Log",";","import","cz",".","festomat",".","client",".","data",".","beans",".","CommentBean",";","import","cz",".","festomat",".","client",".","data",".","beans",".","FestivalBean",";","import","cz",".","festomat",".","client",".","data",".","beans",".","FestivalListBean",";","public","class","DataSourceImplTest","implements","IDataSource","{","private","final","Map","<","String",",","FestivalBean",">","festivals",";","private","final","Map","<","String",",","String",">","all",";","private","final","List","<","CommentBean",">","comments",";","public","DataSourceImplTest","(",")","{","festivals","=","new","HashMap","<","String",",","FestivalBean",">","(",")",";","FestivalBean","fb1","=","new","FestivalBean","(","\"ASFHGF1\"",",","\"Adresa","1\"",",","\"Ceske","Hrady\"",",","\"50:4:50.251\"",",","\"14:26:32.166\"",",","new","Date","(","2011",",","5",",","25",")",",","new","Date","(","2011",",","5",",","27",")",",","\"\"",")",";","FestivalBean","fb2","=","new","FestivalBean","(","\"ASFHGF2\"",",","\"Adresa","2\"",",","\"\"",",","\"50:4:50.251\"",",","\"14:26:32.166\"",",","new","Date","(","2011",",","6",",","25",")",",","new","Date","(","2011",",","6",",","27",")",",","\"\"",")",";","FestivalBean","fb3","=","new","FestivalBean","(","\"ASFHGF3\"",",","\"Adresa","3\"",",","\"\"",",","\"50:4:50.251\"",",","\"14:26:32.166\"",",","new","Date","(","2011",",","7",",","25",")",",","new","Date","(","2011",",","7",",","27",")",",","\"\"",")",";","festivals",".","put","(","\"ASFHGF1\"",",","fb1",")",";","festivals",".","put","(","\"ASFHGF2\"",",","fb2",")",";","festivals",".","put","(","\"ASFHGF3\"",",","fb3",")",";","all","=","new","HashMap","<","String",",","String",">","(",")",";","FestivalBean","bean",";","for","(","String","key",":","festivals",".","keySet","(",")",")","{","bean","=","festivals",".","get","(","key",")",";","all",".","put","(","bean",".","getId","(",")",",","bean",".","getName","(",")",")",";","}","comments","=","new","ArrayList","<","CommentBean",">","(",")",";","CommentBean","cb1","=","new","CommentBean","(","\"@petr\"",",","new","Date","(",")",",","\"\"",")",";","CommentBean","cb2","=","new","CommentBean","(","\"@lubos\"",",","new","Date","(",")",",","\"\"",")",";","CommentBean","cb3","=","new","CommentBean","(","\"@pepa\"",",","new","Date","(",")",",","\"prosim!\"",")",";","comments",".","add","(","cb1",")",";","comments",".","add","(","cb2",")",";","comments",".","add","(","cb3",")",";","}","@","Override","public","List","<","FestivalListBean",">","getAllFestivalls","(",")","{","return","Collections",".","EMPTY_LIST",";","}","@","Override","public","FestivalBean","getFestivalById","(","String","id",")","{","return","festivals",".","get","(","id",")",";","}","@","Override","public","List","<","CommentBean",">","getAllComments","(","String","festivalId",")","{","return","comments",";","}","@","Override","public","void","sendComment","(","String","festivalId",",","CommentBean","comment",")","{","Log",".","i","(","\"DATA\"",",","\"\"","+","comment",".","getText","(",")",")",";","}","@","Override","public","List","<","CommentBean",">","getFilteredComments","(","String","festivalId",",","String","needle",")","{","return","Collections",".","EMPTY_LIST",";","}","}",""],"string":"[\n \"\",\n \"package\",\n \"cz\",\n \".\",\n \"festomat\",\n \".\",\n \"client\",\n \".\",\n \"data\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"util\",\n \".\",\n \"ArrayList\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"util\",\n \".\",\n \"Collections\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"util\",\n \".\",\n \"Date\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"util\",\n \".\",\n \"HashMap\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"util\",\n \".\",\n \"List\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"util\",\n \".\",\n \"Map\",\n \";\",\n \"import\",\n \"android\",\n \".\",\n \"util\",\n \".\",\n \"Log\",\n \";\",\n \"import\",\n \"cz\",\n \".\",\n \"festomat\",\n \".\",\n \"client\",\n \".\",\n \"data\",\n \".\",\n \"beans\",\n \".\",\n \"CommentBean\",\n \";\",\n \"import\",\n \"cz\",\n \".\",\n \"festomat\",\n \".\",\n \"client\",\n \".\",\n \"data\",\n \".\",\n \"beans\",\n \".\",\n \"FestivalBean\",\n \";\",\n \"import\",\n \"cz\",\n \".\",\n \"festomat\",\n \".\",\n \"client\",\n \".\",\n \"data\",\n \".\",\n \"beans\",\n \".\",\n \"FestivalListBean\",\n \";\",\n \"public\",\n \"class\",\n \"DataSourceImplTest\",\n \"implements\",\n \"IDataSource\",\n \"{\",\n \"private\",\n \"final\",\n \"Map\",\n \"<\",\n \"String\",\n \",\",\n \"FestivalBean\",\n \">\",\n \"festivals\",\n \";\",\n \"private\",\n \"final\",\n \"Map\",\n \"<\",\n \"String\",\n \",\",\n \"String\",\n \">\",\n \"all\",\n \";\",\n \"private\",\n \"final\",\n \"List\",\n \"<\",\n \"CommentBean\",\n \">\",\n \"comments\",\n \";\",\n \"public\",\n \"DataSourceImplTest\",\n \"(\",\n \")\",\n \"{\",\n \"festivals\",\n \"=\",\n \"new\",\n \"HashMap\",\n \"<\",\n \"String\",\n \",\",\n \"FestivalBean\",\n \">\",\n \"(\",\n \")\",\n \";\",\n \"FestivalBean\",\n \"fb1\",\n \"=\",\n \"new\",\n \"FestivalBean\",\n \"(\",\n \"\\\"ASFHGF1\\\"\",\n \",\",\n \"\\\"Adresa\",\n \"1\\\"\",\n \",\",\n \"\\\"Ceske\",\n \"Hrady\\\"\",\n \",\",\n \"\\\"50:4:50.251\\\"\",\n \",\",\n \"\\\"14:26:32.166\\\"\",\n \",\",\n \"new\",\n \"Date\",\n \"(\",\n \"2011\",\n \",\",\n \"5\",\n \",\",\n \"25\",\n \")\",\n \",\",\n \"new\",\n \"Date\",\n \"(\",\n \"2011\",\n \",\",\n \"5\",\n \",\",\n \"27\",\n \")\",\n \",\",\n \"\\\"\\\"\",\n \")\",\n \";\",\n \"FestivalBean\",\n \"fb2\",\n \"=\",\n \"new\",\n \"FestivalBean\",\n \"(\",\n \"\\\"ASFHGF2\\\"\",\n \",\",\n \"\\\"Adresa\",\n \"2\\\"\",\n \",\",\n \"\\\"\\\"\",\n \",\",\n \"\\\"50:4:50.251\\\"\",\n \",\",\n \"\\\"14:26:32.166\\\"\",\n \",\",\n \"new\",\n \"Date\",\n \"(\",\n \"2011\",\n \",\",\n \"6\",\n \",\",\n \"25\",\n \")\",\n \",\",\n \"new\",\n \"Date\",\n \"(\",\n \"2011\",\n \",\",\n \"6\",\n \",\",\n \"27\",\n \")\",\n \",\",\n \"\\\"\\\"\",\n \")\",\n \";\",\n \"FestivalBean\",\n \"fb3\",\n \"=\",\n \"new\",\n \"FestivalBean\",\n \"(\",\n \"\\\"ASFHGF3\\\"\",\n \",\",\n \"\\\"Adresa\",\n \"3\\\"\",\n \",\",\n \"\\\"\\\"\",\n \",\",\n \"\\\"50:4:50.251\\\"\",\n \",\",\n \"\\\"14:26:32.166\\\"\",\n \",\",\n \"new\",\n \"Date\",\n \"(\",\n \"2011\",\n \",\",\n \"7\",\n \",\",\n \"25\",\n \")\",\n \",\",\n \"new\",\n \"Date\",\n \"(\",\n \"2011\",\n \",\",\n \"7\",\n \",\",\n \"27\",\n \")\",\n \",\",\n \"\\\"\\\"\",\n \")\",\n \";\",\n \"festivals\",\n \".\",\n \"put\",\n \"(\",\n \"\\\"ASFHGF1\\\"\",\n \",\",\n \"fb1\",\n \")\",\n \";\",\n \"festivals\",\n \".\",\n \"put\",\n \"(\",\n \"\\\"ASFHGF2\\\"\",\n \",\",\n \"fb2\",\n \")\",\n \";\",\n \"festivals\",\n \".\",\n \"put\",\n \"(\",\n \"\\\"ASFHGF3\\\"\",\n \",\",\n \"fb3\",\n \")\",\n \";\",\n \"all\",\n \"=\",\n \"new\",\n \"HashMap\",\n \"<\",\n \"String\",\n \",\",\n \"String\",\n \">\",\n \"(\",\n \")\",\n \";\",\n \"FestivalBean\",\n \"bean\",\n \";\",\n \"for\",\n \"(\",\n \"String\",\n \"key\",\n \":\",\n \"festivals\",\n \".\",\n \"keySet\",\n \"(\",\n \")\",\n \")\",\n \"{\",\n \"bean\",\n \"=\",\n \"festivals\",\n \".\",\n \"get\",\n \"(\",\n \"key\",\n \")\",\n \";\",\n \"all\",\n \".\",\n \"put\",\n \"(\",\n \"bean\",\n \".\",\n \"getId\",\n \"(\",\n \")\",\n \",\",\n \"bean\",\n \".\",\n \"getName\",\n \"(\",\n \")\",\n \")\",\n \";\",\n \"}\",\n \"comments\",\n \"=\",\n \"new\",\n \"ArrayList\",\n \"<\",\n \"CommentBean\",\n \">\",\n \"(\",\n \")\",\n \";\",\n \"CommentBean\",\n \"cb1\",\n \"=\",\n \"new\",\n \"CommentBean\",\n \"(\",\n \"\\\"@petr\\\"\",\n \",\",\n \"new\",\n \"Date\",\n \"(\",\n \")\",\n \",\",\n \"\\\"\\\"\",\n \")\",\n \";\",\n \"CommentBean\",\n \"cb2\",\n \"=\",\n \"new\",\n \"CommentBean\",\n \"(\",\n \"\\\"@lubos\\\"\",\n \",\",\n \"new\",\n \"Date\",\n \"(\",\n \")\",\n \",\",\n \"\\\"\\\"\",\n \")\",\n \";\",\n \"CommentBean\",\n \"cb3\",\n \"=\",\n \"new\",\n \"CommentBean\",\n \"(\",\n \"\\\"@pepa\\\"\",\n \",\",\n \"new\",\n \"Date\",\n \"(\",\n \")\",\n \",\",\n \"\\\"prosim!\\\"\",\n \")\",\n \";\",\n \"comments\",\n \".\",\n \"add\",\n \"(\",\n \"cb1\",\n \")\",\n \";\",\n \"comments\",\n \".\",\n \"add\",\n \"(\",\n \"cb2\",\n \")\",\n \";\",\n \"comments\",\n \".\",\n \"add\",\n \"(\",\n \"cb3\",\n \")\",\n \";\",\n \"}\",\n \"@\",\n \"Override\",\n \"public\",\n \"List\",\n \"<\",\n \"FestivalListBean\",\n \">\",\n \"getAllFestivalls\",\n \"(\",\n \")\",\n \"{\",\n \"return\",\n \"Collections\",\n \".\",\n \"EMPTY_LIST\",\n \";\",\n \"}\",\n \"@\",\n \"Override\",\n \"public\",\n \"FestivalBean\",\n \"getFestivalById\",\n \"(\",\n \"String\",\n \"id\",\n \")\",\n \"{\",\n \"return\",\n \"festivals\",\n \".\",\n \"get\",\n \"(\",\n \"id\",\n \")\",\n \";\",\n \"}\",\n \"@\",\n \"Override\",\n \"public\",\n \"List\",\n \"<\",\n \"CommentBean\",\n \">\",\n \"getAllComments\",\n \"(\",\n \"String\",\n \"festivalId\",\n \")\",\n \"{\",\n \"return\",\n \"comments\",\n \";\",\n \"}\",\n \"@\",\n \"Override\",\n \"public\",\n \"void\",\n \"sendComment\",\n \"(\",\n \"String\",\n \"festivalId\",\n \",\",\n \"CommentBean\",\n \"comment\",\n \")\",\n \"{\",\n \"Log\",\n \".\",\n \"i\",\n \"(\",\n \"\\\"DATA\\\"\",\n \",\",\n \"\\\"\\\"\",\n \"+\",\n \"comment\",\n \".\",\n \"getText\",\n \"(\",\n \")\",\n \")\",\n \";\",\n \"}\",\n \"@\",\n \"Override\",\n \"public\",\n \"List\",\n \"<\",\n \"CommentBean\",\n \">\",\n \"getFilteredComments\",\n \"(\",\n \"String\",\n \"festivalId\",\n \",\",\n \"String\",\n \"needle\",\n \")\",\n \"{\",\n \"return\",\n \"Collections\",\n \".\",\n \"EMPTY_LIST\",\n \";\",\n \"}\",\n \"}\",\n \"\"\n]"}}},{"rowIdx":12890,"cells":{"id":{"kind":"number","value":12890,"string":"12,890"},"code":{"kind":"list like","value":["","package","birthday",";","import","java",".","util",".","Date",";","import","java",".","util",".","List",";","public","class","BirthdayRing","{","private","final","BirthdayDatabase","bdb",";","private","final","NumberLookup","nlu",";","private","final","PhoneDailer","phd",";","public","BirthdayRing","(","BirthdayDatabase","bdb",",","NumberLookup","nlu",",","PhoneDailer","phd",")","{","this",".","bdb","=","bdb",";","this",".","nlu","=","nlu",";","this",".","phd","=","phd",";","}","public","void","run","(",")","{","Date","now","=","new","Date","(",")",";","List","<","String",">","names","=","bdb",".","findBirthdays","(","now",")",";","for","(","String","name",":","names",")","{","String","number","=","nlu",".","getNumber","(","name",")",";","phd",".","dialNumber","(","number",")",";","}","}","}",""],"string":"[\n \"\",\n \"package\",\n \"birthday\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"util\",\n \".\",\n \"Date\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"util\",\n \".\",\n \"List\",\n \";\",\n \"public\",\n \"class\",\n \"BirthdayRing\",\n \"{\",\n \"private\",\n \"final\",\n \"BirthdayDatabase\",\n \"bdb\",\n \";\",\n \"private\",\n \"final\",\n \"NumberLookup\",\n \"nlu\",\n \";\",\n \"private\",\n \"final\",\n \"PhoneDailer\",\n \"phd\",\n \";\",\n \"public\",\n \"BirthdayRing\",\n \"(\",\n \"BirthdayDatabase\",\n \"bdb\",\n \",\",\n \"NumberLookup\",\n \"nlu\",\n \",\",\n \"PhoneDailer\",\n \"phd\",\n \")\",\n \"{\",\n \"this\",\n \".\",\n \"bdb\",\n \"=\",\n \"bdb\",\n \";\",\n \"this\",\n \".\",\n \"nlu\",\n \"=\",\n \"nlu\",\n \";\",\n \"this\",\n \".\",\n \"phd\",\n \"=\",\n \"phd\",\n \";\",\n \"}\",\n \"public\",\n \"void\",\n \"run\",\n \"(\",\n \")\",\n \"{\",\n \"Date\",\n \"now\",\n \"=\",\n \"new\",\n \"Date\",\n \"(\",\n \")\",\n \";\",\n \"List\",\n \"<\",\n \"String\",\n \">\",\n \"names\",\n \"=\",\n \"bdb\",\n \".\",\n \"findBirthdays\",\n \"(\",\n \"now\",\n \")\",\n \";\",\n \"for\",\n \"(\",\n \"String\",\n \"name\",\n \":\",\n \"names\",\n \")\",\n \"{\",\n \"String\",\n \"number\",\n \"=\",\n \"nlu\",\n \".\",\n \"getNumber\",\n \"(\",\n \"name\",\n \")\",\n \";\",\n \"phd\",\n \".\",\n \"dialNumber\",\n \"(\",\n \"number\",\n \")\",\n \";\",\n \"}\",\n \"}\",\n \"}\",\n \"\"\n]"}}},{"rowIdx":12891,"cells":{"id":{"kind":"number","value":12891,"string":"12,891"},"code":{"kind":"list like","value":["","package","birthday",";","public","interface","NumberLookup","{","String","getNumber","(","String","name",")",";","}",""],"string":"[\n \"\",\n \"package\",\n \"birthday\",\n \";\",\n \"public\",\n \"interface\",\n \"NumberLookup\",\n \"{\",\n \"String\",\n \"getNumber\",\n \"(\",\n \"String\",\n \"name\",\n \")\",\n \";\",\n \"}\",\n \"\"\n]"}}},{"rowIdx":12892,"cells":{"id":{"kind":"number","value":12892,"string":"12,892"},"code":{"kind":"list like","value":["","package","birthday",";","import","static","org",".","mockito",".","Matchers",".","isA",";","import","static","org",".","mockito",".","Mockito",".","mock",";","import","static","org",".","mockito",".","Mockito",".","verify",";","import","static","org",".","mockito",".","Mockito",".","when",";","import","static","org",".","mockito",".","Mockito",".","doNothing",";","import","java",".","util",".","ArrayList",";","import","java",".","util",".","Date",";","import","java",".","util",".","List",";","import","org",".","junit",".","Before",";","import","org",".","junit",".","Test",";","public","class","BirthdayRingTest","{","private","BirthdayDatabase","bdb",";","private","BirthdayRing","birthdayRing",";","private","NumberLookup","nlu",";","private","PhoneDailer","phd",";","@","Before","public","void","setUp","(",")","{","bdb","=","mock","(","BirthdayDatabase",".","class",")",";","nlu","=","mock","(","NumberLookup",".","class",")",";","phd","=","mock","(","PhoneDailer",".","class",")",";","birthdayRing","=","new","BirthdayRing","(","bdb",",","nlu",",","phd",")",";","}","@","Test","public","void","callsBirthdayDatabase","(",")","throws","Exception","{","List","<","String",">","birthdays","=","new","ArrayList","<","String",">","(",")",";","when","(","bdb",".","findBirthdays","(","isA","(","Date",".","class",")",")",")",".","thenReturn","(","birthdays",")",";","birthdayRing",".","run","(",")",";","verify","(","bdb",")",".","findBirthdays","(","isA","(","Date",".","class",")",")",";","}","@","Test","public","void","callsNumberLookup","(",")","throws","Exception","{","List","<","String",">","birthdays","=","new","ArrayList","<","String",">","(",")",";","String","name","=","\"John\"",";","birthdays",".","add","(","name",")",";","when","(","bdb",".","findBirthdays","(","isA","(","Date",".","class",")",")",")",".","thenReturn","(","birthdays",")",";","when","(","nlu",".","getNumber","(","name",")",")",".","thenReturn","(","null",")",";","birthdayRing",".","run","(",")",";","verify","(","nlu",")",".","getNumber","(","name",")",";","}","@","Test","public","void","callsPhoneDailer","(",")","throws","Exception","{","List","<","String",">","birthdays","=","new","ArrayList","<","String",">","(",")",";","String","name","=","\"John\"",";","birthdays",".","add","(","name",")",";","when","(","bdb",".","findBirthdays","(","isA","(","Date",".","class",")",")",")",".","thenReturn","(","birthdays",")",";","String","number","=","\"555-5555\"",";","when","(","nlu",".","getNumber","(","name",")",")",".","thenReturn","(","number",")",";","birthdayRing",".","run","(",")",";","verify","(","phd",")",".","dialNumber","(","number",")",";","}","}",""],"string":"[\n \"\",\n \"package\",\n \"birthday\",\n \";\",\n \"import\",\n \"static\",\n \"org\",\n \".\",\n \"mockito\",\n \".\",\n \"Matchers\",\n \".\",\n \"isA\",\n \";\",\n \"import\",\n \"static\",\n \"org\",\n \".\",\n \"mockito\",\n \".\",\n \"Mockito\",\n \".\",\n \"mock\",\n \";\",\n \"import\",\n \"static\",\n \"org\",\n \".\",\n \"mockito\",\n \".\",\n \"Mockito\",\n \".\",\n \"verify\",\n \";\",\n \"import\",\n \"static\",\n \"org\",\n \".\",\n \"mockito\",\n \".\",\n \"Mockito\",\n \".\",\n \"when\",\n \";\",\n \"import\",\n \"static\",\n \"org\",\n \".\",\n \"mockito\",\n \".\",\n \"Mockito\",\n \".\",\n \"doNothing\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"util\",\n \".\",\n \"ArrayList\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"util\",\n \".\",\n \"Date\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"util\",\n \".\",\n \"List\",\n \";\",\n \"import\",\n \"org\",\n \".\",\n \"junit\",\n \".\",\n \"Before\",\n \";\",\n \"import\",\n \"org\",\n \".\",\n \"junit\",\n \".\",\n \"Test\",\n \";\",\n \"public\",\n \"class\",\n \"BirthdayRingTest\",\n \"{\",\n \"private\",\n \"BirthdayDatabase\",\n \"bdb\",\n \";\",\n \"private\",\n \"BirthdayRing\",\n \"birthdayRing\",\n \";\",\n \"private\",\n \"NumberLookup\",\n \"nlu\",\n \";\",\n \"private\",\n \"PhoneDailer\",\n \"phd\",\n \";\",\n \"@\",\n \"Before\",\n \"public\",\n \"void\",\n \"setUp\",\n \"(\",\n \")\",\n \"{\",\n \"bdb\",\n \"=\",\n \"mock\",\n \"(\",\n \"BirthdayDatabase\",\n \".\",\n \"class\",\n \")\",\n \";\",\n \"nlu\",\n \"=\",\n \"mock\",\n \"(\",\n \"NumberLookup\",\n \".\",\n \"class\",\n \")\",\n \";\",\n \"phd\",\n \"=\",\n \"mock\",\n \"(\",\n \"PhoneDailer\",\n \".\",\n \"class\",\n \")\",\n \";\",\n \"birthdayRing\",\n \"=\",\n \"new\",\n \"BirthdayRing\",\n \"(\",\n \"bdb\",\n \",\",\n \"nlu\",\n \",\",\n \"phd\",\n \")\",\n \";\",\n \"}\",\n \"@\",\n \"Test\",\n \"public\",\n \"void\",\n \"callsBirthdayDatabase\",\n \"(\",\n \")\",\n \"throws\",\n \"Exception\",\n \"{\",\n \"List\",\n \"<\",\n \"String\",\n \">\",\n \"birthdays\",\n \"=\",\n \"new\",\n \"ArrayList\",\n \"<\",\n \"String\",\n \">\",\n \"(\",\n \")\",\n \";\",\n \"when\",\n \"(\",\n \"bdb\",\n \".\",\n \"findBirthdays\",\n \"(\",\n \"isA\",\n \"(\",\n \"Date\",\n \".\",\n \"class\",\n \")\",\n \")\",\n \")\",\n \".\",\n \"thenReturn\",\n \"(\",\n \"birthdays\",\n \")\",\n \";\",\n \"birthdayRing\",\n \".\",\n \"run\",\n \"(\",\n \")\",\n \";\",\n \"verify\",\n \"(\",\n \"bdb\",\n \")\",\n \".\",\n \"findBirthdays\",\n \"(\",\n \"isA\",\n \"(\",\n \"Date\",\n \".\",\n \"class\",\n \")\",\n \")\",\n \";\",\n \"}\",\n \"@\",\n \"Test\",\n \"public\",\n \"void\",\n \"callsNumberLookup\",\n \"(\",\n \")\",\n \"throws\",\n \"Exception\",\n \"{\",\n \"List\",\n \"<\",\n \"String\",\n \">\",\n \"birthdays\",\n \"=\",\n \"new\",\n \"ArrayList\",\n \"<\",\n \"String\",\n \">\",\n \"(\",\n \")\",\n \";\",\n \"String\",\n \"name\",\n \"=\",\n \"\\\"John\\\"\",\n \";\",\n \"birthdays\",\n \".\",\n \"add\",\n \"(\",\n \"name\",\n \")\",\n \";\",\n \"when\",\n \"(\",\n \"bdb\",\n \".\",\n \"findBirthdays\",\n \"(\",\n \"isA\",\n \"(\",\n \"Date\",\n \".\",\n \"class\",\n \")\",\n \")\",\n \")\",\n \".\",\n \"thenReturn\",\n \"(\",\n \"birthdays\",\n \")\",\n \";\",\n \"when\",\n \"(\",\n \"nlu\",\n \".\",\n \"getNumber\",\n \"(\",\n \"name\",\n \")\",\n \")\",\n \".\",\n \"thenReturn\",\n \"(\",\n \"null\",\n \")\",\n \";\",\n \"birthdayRing\",\n \".\",\n \"run\",\n \"(\",\n \")\",\n \";\",\n \"verify\",\n \"(\",\n \"nlu\",\n \")\",\n \".\",\n \"getNumber\",\n \"(\",\n \"name\",\n \")\",\n \";\",\n \"}\",\n \"@\",\n \"Test\",\n \"public\",\n \"void\",\n \"callsPhoneDailer\",\n \"(\",\n \")\",\n \"throws\",\n \"Exception\",\n \"{\",\n \"List\",\n \"<\",\n \"String\",\n \">\",\n \"birthdays\",\n \"=\",\n \"new\",\n \"ArrayList\",\n \"<\",\n \"String\",\n \">\",\n \"(\",\n \")\",\n \";\",\n \"String\",\n \"name\",\n \"=\",\n \"\\\"John\\\"\",\n \";\",\n \"birthdays\",\n \".\",\n \"add\",\n \"(\",\n \"name\",\n \")\",\n \";\",\n \"when\",\n \"(\",\n \"bdb\",\n \".\",\n \"findBirthdays\",\n \"(\",\n \"isA\",\n \"(\",\n \"Date\",\n \".\",\n \"class\",\n \")\",\n \")\",\n \")\",\n \".\",\n \"thenReturn\",\n \"(\",\n \"birthdays\",\n \")\",\n \";\",\n \"String\",\n \"number\",\n \"=\",\n \"\\\"555-5555\\\"\",\n \";\",\n \"when\",\n \"(\",\n \"nlu\",\n \".\",\n \"getNumber\",\n \"(\",\n \"name\",\n \")\",\n \")\",\n \".\",\n \"thenReturn\",\n \"(\",\n \"number\",\n \")\",\n \";\",\n \"birthdayRing\",\n \".\",\n \"run\",\n \"(\",\n \")\",\n \";\",\n \"verify\",\n \"(\",\n \"phd\",\n \")\",\n \".\",\n \"dialNumber\",\n \"(\",\n \"number\",\n \")\",\n \";\",\n \"}\",\n \"}\",\n \"\"\n]"}}},{"rowIdx":12893,"cells":{"id":{"kind":"number","value":12893,"string":"12,893"},"code":{"kind":"list like","value":["","package","birthday",";","public","interface","PhoneDailer","{","void","dialNumber","(","String","number",")",";","}",""],"string":"[\n \"\",\n \"package\",\n \"birthday\",\n \";\",\n \"public\",\n \"interface\",\n \"PhoneDailer\",\n \"{\",\n \"void\",\n \"dialNumber\",\n \"(\",\n \"String\",\n \"number\",\n \")\",\n \";\",\n \"}\",\n \"\"\n]"}}},{"rowIdx":12894,"cells":{"id":{"kind":"number","value":12894,"string":"12,894"},"code":{"kind":"list like","value":["","package","birthday",";","import","java",".","util",".","Date",";","import","java",".","util",".","List",";","public","interface","BirthdayDatabase","{","List","<","String",">","findBirthdays","(","Date","date",")",";","}",""],"string":"[\n \"\",\n \"package\",\n \"birthday\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"util\",\n \".\",\n \"Date\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"util\",\n \".\",\n \"List\",\n \";\",\n \"public\",\n \"interface\",\n \"BirthdayDatabase\",\n \"{\",\n \"List\",\n \"<\",\n \"String\",\n \">\",\n \"findBirthdays\",\n \"(\",\n \"Date\",\n \"date\",\n \")\",\n \";\",\n \"}\",\n \"\"\n]"}}},{"rowIdx":12895,"cells":{"id":{"kind":"number","value":12895,"string":"12,895"},"code":{"kind":"list like","value":["","package","org",".","sonatype",".","plugins",".","portallocator",";","import","org",".","apache",".","maven",".","plugin",".","MojoFailureException",";","public","class","PortUnavailableException","extends","MojoFailureException","{","private","static","final","long","serialVersionUID","=","-","7410759462209491374L",";","public","PortUnavailableException","(","String","message",",","Exception","cause",")","{","super","(","message",")",";","initCause","(","cause",")",";","}","}",""],"string":"[\n \"\",\n \"package\",\n \"org\",\n \".\",\n \"sonatype\",\n \".\",\n \"plugins\",\n \".\",\n \"portallocator\",\n \";\",\n \"import\",\n \"org\",\n \".\",\n \"apache\",\n \".\",\n \"maven\",\n \".\",\n \"plugin\",\n \".\",\n \"MojoFailureException\",\n \";\",\n \"public\",\n \"class\",\n \"PortUnavailableException\",\n \"extends\",\n \"MojoFailureException\",\n \"{\",\n \"private\",\n \"static\",\n \"final\",\n \"long\",\n \"serialVersionUID\",\n \"=\",\n \"-\",\n \"7410759462209491374L\",\n \";\",\n \"public\",\n \"PortUnavailableException\",\n \"(\",\n \"String\",\n \"message\",\n \",\",\n \"Exception\",\n \"cause\",\n \")\",\n \"{\",\n \"super\",\n \"(\",\n \"message\",\n \")\",\n \";\",\n \"initCause\",\n \"(\",\n \"cause\",\n \")\",\n \";\",\n \"}\",\n \"}\",\n \"\"\n]"}}},{"rowIdx":12896,"cells":{"id":{"kind":"number","value":12896,"string":"12,896"},"code":{"kind":"list like","value":["","package","org",".","sonatype",".","plugins",".","portallocator",";","import","java",".","io",".","IOException",";","import","java",".","net",".","ServerSocket",";","import","org",".","apache",".","maven",".","plugin",".","AbstractMojo",";","import","org",".","apache",".","maven",".","plugin",".","MojoExecutionException",";","import","org",".","apache",".","maven",".","plugin",".","MojoFailureException",";","import","org",".","apache",".","maven",".","project",".","MavenProject",";","public","class","PortAllocatorMojo","extends","AbstractMojo","{","private","Port","[","]","ports",";","private","MavenProject","project",";","public","void","execute","(",")","throws","MojoExecutionException",",","MojoFailureException","{","for","(","Port","port",":","ports",")","{","String","name","=","port",".","getName","(",")",";","if","(","name","==","null",")","{","getLog","(",")",".","warn","(","\"\"",")",";","continue",";","}","String","type","=","port",".","getType","(",")",";","int","portNumber",";","if","(","Port",".","DEFAULT",".","equals","(","type",")",")","{","portNumber","=","handleDefaultPort","(","port",")",";","}","else","{","throw","new","MojoFailureException","(","\"\"","+","type","+","\"'","for","'\"","+","port",".","getName","(",")","+","\"'\"",")",";","}","getLog","(",")",".","info","(","\"\"","+","portNumber","+","\"\"","+","name","+","\"'\"",")",";","project",".","getProperties","(",")",".","put","(","name",",","String",".","valueOf","(","portNumber",")",")",";","}","}","private","int","handleDefaultPort","(","Port","port",")","throws","MojoFailureException",",","MojoExecutionException","{","try","{","return","allocate","(","port",".","getPortNumber","(",")",")",";","}","catch","(","PortUnavailableException","e",")","{","if","(","port",".","getFailIfOccupied","(",")",")","{","throw","e",";","}","else","{","return","allocate","(","0",")",";","}","}","}","private","int","allocate","(","int","portNumber",")","throws","PortUnavailableException",",","MojoFailureException",",","MojoExecutionException","{","ServerSocket","server",";","try","{","server","=","new","ServerSocket","(","portNumber",")",";","}","catch","(","IOException","e",")","{","throw","new","PortUnavailableException","(","e",".","getLocalizedMessage","(",")",",","e",")",";","}","portNumber","=","server",".","getLocalPort","(",")",";","try","{","server",".","close","(",")",";","}","catch","(","IOException","e",")","{","throw","new","MojoExecutionException","(","\"\"","+","portNumber",",","e",")",";","}","return","portNumber",";","}","public","void","setProject","(","MavenProject","project",")","{","this",".","project","=","project",";","}","public","void","setPorts","(","Port","[","]","ports",")","{","this",".","ports","=","ports",";","}","}",""],"string":"[\n \"\",\n \"package\",\n \"org\",\n \".\",\n \"sonatype\",\n \".\",\n \"plugins\",\n \".\",\n \"portallocator\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"io\",\n \".\",\n \"IOException\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"net\",\n \".\",\n \"ServerSocket\",\n \";\",\n \"import\",\n \"org\",\n \".\",\n \"apache\",\n \".\",\n \"maven\",\n \".\",\n \"plugin\",\n \".\",\n \"AbstractMojo\",\n \";\",\n \"import\",\n \"org\",\n \".\",\n \"apache\",\n \".\",\n \"maven\",\n \".\",\n \"plugin\",\n \".\",\n \"MojoExecutionException\",\n \";\",\n \"import\",\n \"org\",\n \".\",\n \"apache\",\n \".\",\n \"maven\",\n \".\",\n \"plugin\",\n \".\",\n \"MojoFailureException\",\n \";\",\n \"import\",\n \"org\",\n \".\",\n \"apache\",\n \".\",\n \"maven\",\n \".\",\n \"project\",\n \".\",\n \"MavenProject\",\n \";\",\n \"public\",\n \"class\",\n \"PortAllocatorMojo\",\n \"extends\",\n \"AbstractMojo\",\n \"{\",\n \"private\",\n \"Port\",\n \"[\",\n \"]\",\n \"ports\",\n \";\",\n \"private\",\n \"MavenProject\",\n \"project\",\n \";\",\n \"public\",\n \"void\",\n \"execute\",\n \"(\",\n \")\",\n \"throws\",\n \"MojoExecutionException\",\n \",\",\n \"MojoFailureException\",\n \"{\",\n \"for\",\n \"(\",\n \"Port\",\n \"port\",\n \":\",\n \"ports\",\n \")\",\n \"{\",\n \"String\",\n \"name\",\n \"=\",\n \"port\",\n \".\",\n \"getName\",\n \"(\",\n \")\",\n \";\",\n \"if\",\n \"(\",\n \"name\",\n \"==\",\n \"null\",\n \")\",\n \"{\",\n \"getLog\",\n \"(\",\n \")\",\n \".\",\n \"warn\",\n \"(\",\n \"\\\"\\\"\",\n \")\",\n \";\",\n \"continue\",\n \";\",\n \"}\",\n \"String\",\n \"type\",\n \"=\",\n \"port\",\n \".\",\n \"getType\",\n \"(\",\n \")\",\n \";\",\n \"int\",\n \"portNumber\",\n \";\",\n \"if\",\n \"(\",\n \"Port\",\n \".\",\n \"DEFAULT\",\n \".\",\n \"equals\",\n \"(\",\n \"type\",\n \")\",\n \")\",\n \"{\",\n \"portNumber\",\n \"=\",\n \"handleDefaultPort\",\n \"(\",\n \"port\",\n \")\",\n \";\",\n \"}\",\n \"else\",\n \"{\",\n \"throw\",\n \"new\",\n \"MojoFailureException\",\n \"(\",\n \"\\\"\\\"\",\n \"+\",\n \"type\",\n \"+\",\n \"\\\"'\",\n \"for\",\n \"'\\\"\",\n \"+\",\n \"port\",\n \".\",\n \"getName\",\n \"(\",\n \")\",\n \"+\",\n \"\\\"'\\\"\",\n \")\",\n \";\",\n \"}\",\n \"getLog\",\n \"(\",\n \")\",\n \".\",\n \"info\",\n \"(\",\n \"\\\"\\\"\",\n \"+\",\n \"portNumber\",\n \"+\",\n \"\\\"\\\"\",\n \"+\",\n \"name\",\n \"+\",\n \"\\\"'\\\"\",\n \")\",\n \";\",\n \"project\",\n \".\",\n \"getProperties\",\n \"(\",\n \")\",\n \".\",\n \"put\",\n \"(\",\n \"name\",\n \",\",\n \"String\",\n \".\",\n \"valueOf\",\n \"(\",\n \"portNumber\",\n \")\",\n \")\",\n \";\",\n \"}\",\n \"}\",\n \"private\",\n \"int\",\n \"handleDefaultPort\",\n \"(\",\n \"Port\",\n \"port\",\n \")\",\n \"throws\",\n \"MojoFailureException\",\n \",\",\n \"MojoExecutionException\",\n \"{\",\n \"try\",\n \"{\",\n \"return\",\n \"allocate\",\n \"(\",\n \"port\",\n \".\",\n \"getPortNumber\",\n \"(\",\n \")\",\n \")\",\n \";\",\n \"}\",\n \"catch\",\n \"(\",\n \"PortUnavailableException\",\n \"e\",\n \")\",\n \"{\",\n \"if\",\n \"(\",\n \"port\",\n \".\",\n \"getFailIfOccupied\",\n \"(\",\n \")\",\n \")\",\n \"{\",\n \"throw\",\n \"e\",\n \";\",\n \"}\",\n \"else\",\n \"{\",\n \"return\",\n \"allocate\",\n \"(\",\n \"0\",\n \")\",\n \";\",\n \"}\",\n \"}\",\n \"}\",\n \"private\",\n \"int\",\n \"allocate\",\n \"(\",\n \"int\",\n \"portNumber\",\n \")\",\n \"throws\",\n \"PortUnavailableException\",\n \",\",\n \"MojoFailureException\",\n \",\",\n \"MojoExecutionException\",\n \"{\",\n \"ServerSocket\",\n \"server\",\n \";\",\n \"try\",\n \"{\",\n \"server\",\n \"=\",\n \"new\",\n \"ServerSocket\",\n \"(\",\n \"portNumber\",\n \")\",\n \";\",\n \"}\",\n \"catch\",\n \"(\",\n \"IOException\",\n \"e\",\n \")\",\n \"{\",\n \"throw\",\n \"new\",\n \"PortUnavailableException\",\n \"(\",\n \"e\",\n \".\",\n \"getLocalizedMessage\",\n \"(\",\n \")\",\n \",\",\n \"e\",\n \")\",\n \";\",\n \"}\",\n \"portNumber\",\n \"=\",\n \"server\",\n \".\",\n \"getLocalPort\",\n \"(\",\n \")\",\n \";\",\n \"try\",\n \"{\",\n \"server\",\n \".\",\n \"close\",\n \"(\",\n \")\",\n \";\",\n \"}\",\n \"catch\",\n \"(\",\n \"IOException\",\n \"e\",\n \")\",\n \"{\",\n \"throw\",\n \"new\",\n \"MojoExecutionException\",\n \"(\",\n \"\\\"\\\"\",\n \"+\",\n \"portNumber\",\n \",\",\n \"e\",\n \")\",\n \";\",\n \"}\",\n \"return\",\n \"portNumber\",\n \";\",\n \"}\",\n \"public\",\n \"void\",\n \"setProject\",\n \"(\",\n \"MavenProject\",\n \"project\",\n \")\",\n \"{\",\n \"this\",\n \".\",\n \"project\",\n \"=\",\n \"project\",\n \";\",\n \"}\",\n \"public\",\n \"void\",\n \"setPorts\",\n \"(\",\n \"Port\",\n \"[\",\n \"]\",\n \"ports\",\n \")\",\n \"{\",\n \"this\",\n \".\",\n \"ports\",\n \"=\",\n \"ports\",\n \";\",\n \"}\",\n \"}\",\n \"\"\n]"}}},{"rowIdx":12897,"cells":{"id":{"kind":"number","value":12897,"string":"12,897"},"code":{"kind":"list like","value":["","package","org",".","sonatype",".","plugins",".","portallocator",";","public","class","Port","{","public","static","final","String","DEFAULT","=","\"default\"",";","private","boolean","failIfOccupied",";","private","String","name",";","private","int","portNumber",";","private","String","type","=","DEFAULT",";","public","Port","(",")","{","super","(",")",";","}","public","Port","(","String","name",")","{","super","(",")",";","this",".","name","=","name",";","}","public","boolean","getFailIfOccupied","(",")","{","return","failIfOccupied",";","}","public","String","getName","(",")","{","return","name",";","}","public","int","getPortNumber","(",")","{","return","portNumber",";","}","public","String","getType","(",")","{","return","type",";","}","public","void","setFailIfOccupied","(","boolean","failIfOccupied",")","{","this",".","failIfOccupied","=","failIfOccupied",";","}","public","void","setName","(","String","name",")","{","this",".","name","=","name",";","}","public","void","setPortNumber","(","int","portNumber",")","{","this",".","portNumber","=","portNumber",";","}","public","void","setType","(","String","type",")","{","this",".","type","=","type",";","}","}",""],"string":"[\n \"\",\n \"package\",\n \"org\",\n \".\",\n \"sonatype\",\n \".\",\n \"plugins\",\n \".\",\n \"portallocator\",\n \";\",\n \"public\",\n \"class\",\n \"Port\",\n \"{\",\n \"public\",\n \"static\",\n \"final\",\n \"String\",\n \"DEFAULT\",\n \"=\",\n \"\\\"default\\\"\",\n \";\",\n \"private\",\n \"boolean\",\n \"failIfOccupied\",\n \";\",\n \"private\",\n \"String\",\n \"name\",\n \";\",\n \"private\",\n \"int\",\n \"portNumber\",\n \";\",\n \"private\",\n \"String\",\n \"type\",\n \"=\",\n \"DEFAULT\",\n \";\",\n \"public\",\n \"Port\",\n \"(\",\n \")\",\n \"{\",\n \"super\",\n \"(\",\n \")\",\n \";\",\n \"}\",\n \"public\",\n \"Port\",\n \"(\",\n \"String\",\n \"name\",\n \")\",\n \"{\",\n \"super\",\n \"(\",\n \")\",\n \";\",\n \"this\",\n \".\",\n \"name\",\n \"=\",\n \"name\",\n \";\",\n \"}\",\n \"public\",\n \"boolean\",\n \"getFailIfOccupied\",\n \"(\",\n \")\",\n \"{\",\n \"return\",\n \"failIfOccupied\",\n \";\",\n \"}\",\n \"public\",\n \"String\",\n \"getName\",\n \"(\",\n \")\",\n \"{\",\n \"return\",\n \"name\",\n \";\",\n \"}\",\n \"public\",\n \"int\",\n \"getPortNumber\",\n \"(\",\n \")\",\n \"{\",\n \"return\",\n \"portNumber\",\n \";\",\n \"}\",\n \"public\",\n \"String\",\n \"getType\",\n \"(\",\n \")\",\n \"{\",\n \"return\",\n \"type\",\n \";\",\n \"}\",\n \"public\",\n \"void\",\n \"setFailIfOccupied\",\n \"(\",\n \"boolean\",\n \"failIfOccupied\",\n \")\",\n \"{\",\n \"this\",\n \".\",\n \"failIfOccupied\",\n \"=\",\n \"failIfOccupied\",\n \";\",\n \"}\",\n \"public\",\n \"void\",\n \"setName\",\n \"(\",\n \"String\",\n \"name\",\n \")\",\n \"{\",\n \"this\",\n \".\",\n \"name\",\n \"=\",\n \"name\",\n \";\",\n \"}\",\n \"public\",\n \"void\",\n \"setPortNumber\",\n \"(\",\n \"int\",\n \"portNumber\",\n \")\",\n \"{\",\n \"this\",\n \".\",\n \"portNumber\",\n \"=\",\n \"portNumber\",\n \";\",\n \"}\",\n \"public\",\n \"void\",\n \"setType\",\n \"(\",\n \"String\",\n \"type\",\n \")\",\n \"{\",\n \"this\",\n \".\",\n \"type\",\n \"=\",\n \"type\",\n \";\",\n \"}\",\n \"}\",\n \"\"\n]"}}},{"rowIdx":12898,"cells":{"id":{"kind":"number","value":12898,"string":"12,898"},"code":{"kind":"list like","value":["","package","com",".","nfe",".","guardian",".","client",".","model",";","import","java",".","io",".","File",";","import","java",".","io",".","FileInputStream",";","import","java",".","io",".","FileWriter",";","import","java",".","io",".","IOException",";","import","java",".","util",".","Properties",";","import","javax",".","swing",".","UIManager",";","public","class","SystemConfiguration","{","private","final","String","configFile","=","System",".","getProperty","(","\"user.home\"",")","+","\"\"",";","private","Properties","configProperties",";","private","String","username",";","private","String","password",";","private","String","nfePath",";","private","String","visual",";","private","String","wsURL",";","public","static","final","int","VALID","=","1",";","public","static","final","int","INVALID","=","2",";","public","SystemConfiguration","(",")","throws","IOException","{","load","(",")",";","}","private","void","load","(",")","throws","IOException","{","File","file","=","new","File","(","configFile",")",";","configProperties","=","new","Properties","(",")",";","if","(","file",".","exists","(",")",")","{","configProperties",".","load","(","new","FileInputStream","(","file",")",")",";","setFields","(",")",";","}","else","{","setDefaults","(",")",";","}","}","public","void","store","(",")","throws","IOException","{","configProperties",".","store","(","new","FileWriter","(","new","File","(","configFile",")",")",",","\"\"",")",";","}","private","void","setDefaults","(",")","{","setUsername","(","\"\"",")",";","setPassword","(","\"\"",")",";","setNfePath","(","\"\"",")",";","setVisual","(","UIManager",".","getSystemLookAndFeelClassName","(",")",")",";","}","private","void","setFields","(",")","{","nfePath","=","configProperties",".","getProperty","(","\"nfe.path\"",")",";","username","=","configProperties",".","getProperty","(","\"user.name\"",")",";","password","=","configProperties",".","getProperty","(","\"\"",")",";","visual","=","configProperties",".","getProperty","(","\"app.visual\"",")",";","wsURL","=","configProperties",".","getProperty","(","\"ws.url\"",")",";","}","public","String","getNfePath","(",")","{","return","nfePath",";","}","public","void","setNfePath","(","String","nfePath",")","{","configProperties",".","setProperty","(","\"nfe.path\"",",","nfePath",")",";","this",".","nfePath","=","nfePath",";","}","public","String","getPassword","(",")","{","return","password",";","}","public","void","setPassword","(","String","password",")","{","configProperties",".","setProperty","(","\"\"",",","password",")",";","this",".","password","=","password",";","}","public","String","getUsername","(",")","{","return","username",";","}","public","void","setUsername","(","String","username",")","{","configProperties",".","setProperty","(","\"user.name\"",",","username",")",";","this",".","username","=","username",";","}","public","String","getVisual","(",")","{","return","visual",";","}","public","void","setVisual","(","String","visual",")","{","configProperties",".","setProperty","(","\"app.visual\"",",","visual",")",";","this",".","visual","=","visual",";","}","public","String","getWsURL","(",")","{","return","wsURL",";","}","public","void","setWsURL","(","String","wsURL",")","{","configProperties",".","setProperty","(","\"ws.url\"",",","wsURL",")",";","this",".","wsURL","=","wsURL",";","}","public","int","validate","(",")","{","if","(","isEmpty","(","username",")",")","return","INVALID",";","if","(","isEmpty","(","password",")",")","return","INVALID",";","if","(","isEmpty","(","nfePath",")",")","return","INVALID",";","if","(","isEmpty","(","wsURL",")",")","return","INVALID",";","return","VALID",";","}","private","boolean","isEmpty","(","String","value",")","{","return","(","value","==","null","||","value",".","isEmpty","(",")",")",";","}","}",""],"string":"[\n \"\",\n \"package\",\n \"com\",\n \".\",\n \"nfe\",\n \".\",\n \"guardian\",\n \".\",\n \"client\",\n \".\",\n \"model\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"io\",\n \".\",\n \"File\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"io\",\n \".\",\n \"FileInputStream\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"io\",\n \".\",\n \"FileWriter\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"io\",\n \".\",\n \"IOException\",\n \";\",\n \"import\",\n \"java\",\n \".\",\n \"util\",\n \".\",\n \"Properties\",\n \";\",\n \"import\",\n \"javax\",\n \".\",\n \"swing\",\n \".\",\n \"UIManager\",\n \";\",\n \"public\",\n \"class\",\n \"SystemConfiguration\",\n \"{\",\n \"private\",\n \"final\",\n \"String\",\n \"configFile\",\n \"=\",\n \"System\",\n \".\",\n \"getProperty\",\n \"(\",\n \"\\\"user.home\\\"\",\n \")\",\n \"+\",\n \"\\\"\\\"\",\n \";\",\n \"private\",\n \"Properties\",\n \"configProperties\",\n \";\",\n \"private\",\n \"String\",\n \"username\",\n \";\",\n \"private\",\n \"String\",\n \"password\",\n \";\",\n \"private\",\n \"String\",\n \"nfePath\",\n \";\",\n \"private\",\n \"String\",\n \"visual\",\n \";\",\n \"private\",\n \"String\",\n \"wsURL\",\n \";\",\n \"public\",\n \"static\",\n \"final\",\n \"int\",\n \"VALID\",\n \"=\",\n \"1\",\n \";\",\n \"public\",\n \"static\",\n \"final\",\n \"int\",\n \"INVALID\",\n \"=\",\n \"2\",\n \";\",\n \"public\",\n \"SystemConfiguration\",\n \"(\",\n \")\",\n \"throws\",\n \"IOException\",\n \"{\",\n \"load\",\n \"(\",\n \")\",\n \";\",\n \"}\",\n \"private\",\n \"void\",\n \"load\",\n \"(\",\n \")\",\n \"throws\",\n \"IOException\",\n \"{\",\n \"File\",\n \"file\",\n \"=\",\n \"new\",\n \"File\",\n \"(\",\n \"configFile\",\n \")\",\n \";\",\n \"configProperties\",\n \"=\",\n \"new\",\n \"Properties\",\n \"(\",\n \")\",\n \";\",\n \"if\",\n \"(\",\n \"file\",\n \".\",\n \"exists\",\n \"(\",\n \")\",\n \")\",\n \"{\",\n \"configProperties\",\n \".\",\n \"load\",\n \"(\",\n \"new\",\n \"FileInputStream\",\n \"(\",\n \"file\",\n \")\",\n \")\",\n \";\",\n \"setFields\",\n \"(\",\n \")\",\n \";\",\n \"}\",\n \"else\",\n \"{\",\n \"setDefaults\",\n \"(\",\n \")\",\n \";\",\n \"}\",\n \"}\",\n \"public\",\n \"void\",\n \"store\",\n \"(\",\n \")\",\n \"throws\",\n \"IOException\",\n \"{\",\n \"configProperties\",\n \".\",\n \"store\",\n \"(\",\n \"new\",\n \"FileWriter\",\n \"(\",\n \"new\",\n \"File\",\n \"(\",\n \"configFile\",\n \")\",\n \")\",\n \",\",\n \"\\\"\\\"\",\n \")\",\n \";\",\n \"}\",\n \"private\",\n \"void\",\n \"setDefaults\",\n \"(\",\n \")\",\n \"{\",\n \"setUsername\",\n \"(\",\n \"\\\"\\\"\",\n \")\",\n \";\",\n \"setPassword\",\n \"(\",\n \"\\\"\\\"\",\n \")\",\n \";\",\n \"setNfePath\",\n \"(\",\n \"\\\"\\\"\",\n \")\",\n \";\",\n \"setVisual\",\n \"(\",\n \"UIManager\",\n \".\",\n \"getSystemLookAndFeelClassName\",\n \"(\",\n \")\",\n \")\",\n \";\",\n \"}\",\n \"private\",\n \"void\",\n \"setFields\",\n \"(\",\n \")\",\n \"{\",\n \"nfePath\",\n \"=\",\n \"configProperties\",\n \".\",\n \"getProperty\",\n \"(\",\n \"\\\"nfe.path\\\"\",\n \")\",\n \";\",\n \"username\",\n \"=\",\n \"configProperties\",\n \".\",\n \"getProperty\",\n \"(\",\n \"\\\"user.name\\\"\",\n \")\",\n \";\",\n \"password\",\n \"=\",\n \"configProperties\",\n \".\",\n \"getProperty\",\n \"(\",\n \"\\\"\\\"\",\n \")\",\n \";\",\n \"visual\",\n \"=\",\n \"configProperties\",\n \".\",\n \"getProperty\",\n \"(\",\n \"\\\"app.visual\\\"\",\n \")\",\n \";\",\n \"wsURL\",\n \"=\",\n \"configProperties\",\n \".\",\n \"getProperty\",\n \"(\",\n \"\\\"ws.url\\\"\",\n \")\",\n \";\",\n \"}\",\n \"public\",\n \"String\",\n \"getNfePath\",\n \"(\",\n \")\",\n \"{\",\n \"return\",\n \"nfePath\",\n \";\",\n \"}\",\n \"public\",\n \"void\",\n \"setNfePath\",\n \"(\",\n \"String\",\n \"nfePath\",\n \")\",\n \"{\",\n \"configProperties\",\n \".\",\n \"setProperty\",\n \"(\",\n \"\\\"nfe.path\\\"\",\n \",\",\n \"nfePath\",\n \")\",\n \";\",\n \"this\",\n \".\",\n \"nfePath\",\n \"=\",\n \"nfePath\",\n \";\",\n \"}\",\n \"public\",\n \"String\",\n \"getPassword\",\n \"(\",\n \")\",\n \"{\",\n \"return\",\n \"password\",\n \";\",\n \"}\",\n \"public\",\n \"void\",\n \"setPassword\",\n \"(\",\n \"String\",\n \"password\",\n \")\",\n \"{\",\n \"configProperties\",\n \".\",\n \"setProperty\",\n \"(\",\n \"\\\"\\\"\",\n \",\",\n \"password\",\n \")\",\n \";\",\n \"this\",\n \".\",\n \"password\",\n \"=\",\n \"password\",\n \";\",\n \"}\",\n \"public\",\n \"String\",\n \"getUsername\",\n \"(\",\n \")\",\n \"{\",\n \"return\",\n \"username\",\n \";\",\n \"}\",\n \"public\",\n \"void\",\n \"setUsername\",\n \"(\",\n \"String\",\n \"username\",\n \")\",\n \"{\",\n \"configProperties\",\n \".\",\n \"setProperty\",\n \"(\",\n \"\\\"user.name\\\"\",\n \",\",\n \"username\",\n \")\",\n \";\",\n \"this\",\n \".\",\n \"username\",\n \"=\",\n \"username\",\n \";\",\n \"}\",\n \"public\",\n \"String\",\n \"getVisual\",\n \"(\",\n \")\",\n \"{\",\n \"return\",\n \"visual\",\n \";\",\n \"}\",\n \"public\",\n \"void\",\n \"setVisual\",\n \"(\",\n \"String\",\n \"visual\",\n \")\",\n \"{\",\n \"configProperties\",\n \".\",\n \"setProperty\",\n \"(\",\n \"\\\"app.visual\\\"\",\n \",\",\n \"visual\",\n \")\",\n \";\",\n \"this\",\n \".\",\n \"visual\",\n \"=\",\n \"visual\",\n \";\",\n \"}\",\n \"public\",\n \"String\",\n \"getWsURL\",\n \"(\",\n \")\",\n \"{\",\n \"return\",\n \"wsURL\",\n \";\",\n \"}\",\n \"public\",\n \"void\",\n \"setWsURL\",\n \"(\",\n \"String\",\n \"wsURL\",\n \")\",\n \"{\",\n \"configProperties\",\n \".\",\n \"setProperty\",\n \"(\",\n \"\\\"ws.url\\\"\",\n \",\",\n \"wsURL\",\n \")\",\n \";\",\n \"this\",\n \".\",\n \"wsURL\",\n \"=\",\n \"wsURL\",\n \";\",\n \"}\",\n \"public\",\n \"int\",\n \"validate\",\n \"(\",\n \")\",\n \"{\",\n \"if\",\n \"(\",\n \"isEmpty\",\n \"(\",\n \"username\",\n \")\",\n \")\",\n \"return\",\n \"INVALID\",\n \";\",\n \"if\",\n \"(\",\n \"isEmpty\",\n \"(\",\n \"password\",\n \")\",\n \")\",\n \"return\",\n \"INVALID\",\n \";\",\n \"if\",\n \"(\",\n \"isEmpty\",\n \"(\",\n \"nfePath\",\n \")\",\n \")\",\n \"return\",\n \"INVALID\",\n \";\",\n \"if\",\n \"(\",\n \"isEmpty\",\n \"(\",\n \"wsURL\",\n \")\",\n \")\",\n \"return\",\n \"INVALID\",\n \";\",\n \"return\",\n \"VALID\",\n \";\",\n \"}\",\n \"private\",\n \"boolean\",\n \"isEmpty\",\n \"(\",\n \"String\",\n \"value\",\n \")\",\n \"{\",\n \"return\",\n \"(\",\n \"value\",\n \"==\",\n \"null\",\n \"||\",\n \"value\",\n \".\",\n \"isEmpty\",\n \"(\",\n \")\",\n \")\",\n \";\",\n \"}\",\n \"}\",\n \"\"\n]"}}},{"rowIdx":12899,"cells":{"id":{"kind":"number","value":12899,"string":"12,899"},"code":{"kind":"list like","value":["","package","com",".","nfe",".","guardian",".","client",".","model",";","import","com",".","nfe",".","guardian",".","shared",".","model",".","resources",".","NFEGuardianError",";","import","com",".","tiago",".","tablemodel",".","annotations",".","CollumnModel",";","public","class","NFeErrorWrapper","{","@","CollumnModel","(","headerName","=","\"Cod.","Erro\"",")","private","int","errorCode",";","@","CollumnModel","(","headerName","=","\"Arquivo","XML\"",")","private","String","fileName",";","@","CollumnModel","(","headerName","=","\"Descri-UNK-o\"",")","private","String","message",";","public","NFeErrorWrapper","(","String","fileName",",","NFEGuardianError","error",")","{","this",".","fileName","=","fileName",";","errorCode","=","error",".","getHttpErrorCode","(",")",";","message","=","error",".","getMessage","(",")",";","}","public","int","getErrorCode","(",")","{","return","errorCode",";","}","public","String","getFileName","(",")","{","return","fileName",";","}","public","String","getMessage","(",")","{","return","message",";","}","}",""],"string":"[\n \"\",\n \"package\",\n \"com\",\n \".\",\n \"nfe\",\n \".\",\n \"guardian\",\n \".\",\n \"client\",\n \".\",\n \"model\",\n \";\",\n \"import\",\n \"com\",\n \".\",\n \"nfe\",\n \".\",\n \"guardian\",\n \".\",\n \"shared\",\n \".\",\n \"model\",\n \".\",\n \"resources\",\n \".\",\n \"NFEGuardianError\",\n \";\",\n \"import\",\n \"com\",\n \".\",\n \"tiago\",\n \".\",\n \"tablemodel\",\n \".\",\n \"annotations\",\n \".\",\n \"CollumnModel\",\n \";\",\n \"public\",\n \"class\",\n \"NFeErrorWrapper\",\n \"{\",\n \"@\",\n \"CollumnModel\",\n \"(\",\n \"headerName\",\n \"=\",\n \"\\\"Cod.\",\n \"Erro\\\"\",\n \")\",\n \"private\",\n \"int\",\n \"errorCode\",\n \";\",\n \"@\",\n \"CollumnModel\",\n \"(\",\n \"headerName\",\n \"=\",\n \"\\\"Arquivo\",\n \"XML\\\"\",\n \")\",\n \"private\",\n \"String\",\n \"fileName\",\n \";\",\n \"@\",\n \"CollumnModel\",\n \"(\",\n \"headerName\",\n \"=\",\n \"\\\"Descri-UNK-o\\\"\",\n \")\",\n \"private\",\n \"String\",\n \"message\",\n \";\",\n \"public\",\n \"NFeErrorWrapper\",\n \"(\",\n \"String\",\n \"fileName\",\n \",\",\n \"NFEGuardianError\",\n \"error\",\n \")\",\n \"{\",\n \"this\",\n \".\",\n \"fileName\",\n \"=\",\n \"fileName\",\n \";\",\n \"errorCode\",\n \"=\",\n \"error\",\n \".\",\n \"getHttpErrorCode\",\n \"(\",\n \")\",\n \";\",\n \"message\",\n \"=\",\n \"error\",\n \".\",\n \"getMessage\",\n \"(\",\n \")\",\n \";\",\n \"}\",\n \"public\",\n \"int\",\n \"getErrorCode\",\n \"(\",\n \")\",\n \"{\",\n \"return\",\n \"errorCode\",\n \";\",\n \"}\",\n \"public\",\n \"String\",\n \"getFileName\",\n \"(\",\n \")\",\n \"{\",\n \"return\",\n \"fileName\",\n \";\",\n \"}\",\n \"public\",\n \"String\",\n \"getMessage\",\n \"(\",\n \")\",\n \"{\",\n \"return\",\n \"message\",\n \";\",\n \"}\",\n \"}\",\n \"\"\n]"}}}],"truncated":false,"partial":false},"paginationData":{"pageIndex":128,"numItemsPerPage":100,"numTotalItems":12934,"offset":12800,"length":100}},"jwt":"eyJhbGciOiJFZERTQSJ9.eyJyZWFkIjp0cnVlLCJwZXJtaXNzaW9ucyI6eyJyZXBvLmNvbnRlbnQucmVhZCI6dHJ1ZX0sImlhdCI6MTc1NTg4ODY0Nywic3ViIjoiL2RhdGFzZXRzL2dvb2dsZS9jb2RlX3hfZ2x1ZV9jY19jb2RlX2NvbXBsZXRpb25fdG9rZW4iLCJleHAiOjE3NTU4OTIyNDcsImlzcyI6Imh0dHBzOi8vaHVnZ2luZ2ZhY2UuY28ifQ.dNioUur8MblAJ8JjDTEasMFizdwUJaVSeYP_7NogxX1npQRvIgMAy-araozli1rtuHKxXAcxUQXisjDxgIAdAw","displayUrls":true},"discussionsStats":{"closed":7,"open":1,"total":8},"fullWidth":true,"hasGatedAccess":true,"hasFullAccess":true,"isEmbedded":false,"savedQueries":{"community":[],"user":[]}}">
id
int32
0
12.9k
code
listlengths
2
264k
12,800
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "Map", ";", "public", "class", "LetHandlerFactory", "{", "private", "static", "Map", "<", "String", ",", "LetHandler", ">", "strategies", "=", "new", "HashMap", "<", "String", ",", "LetHandler", ">", "(", ")", ";", "static", "{", "strategies", ".", "put", "(", "\"header\"", ",", "new", "LetHeaderHandler", "(", ")", ")", ";", "strategies", ".", "put", "(", "\"body\"", ",", "new", "LetBodyHandler", "(", ")", ")", ";", "strategies", ".", "put", "(", "\"body:xml\"", ",", "new", "LetBodyXmlHandler", "(", ")", ")", ";", "strategies", ".", "put", "(", "\"js\"", ",", "new", "LetBodyJsHandler", "(", ")", ")", ";", "}", "private", "LetHandlerFactory", "(", ")", "{", "}", "public", "static", "LetHandler", "getHandlerFor", "(", "String", "part", ")", "{", "return", "strategies", ".", "get", "(", "part", ")", ";", "}", "}", "</s>" ]
12,801
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "Map", ";", "public", "final", "class", "Config", "{", "public", "static", "final", "String", "DEFAULT_CONFIG_NAME", "=", "\"default\"", ";", "private", "static", "final", "Map", "<", "String", ",", "Config", ">", "CONFIGURATIONS", "=", "new", "HashMap", "<", "String", ",", "Config", ">", "(", ")", ";", "public", "static", "Config", "getConfig", "(", ")", "{", "return", "getConfig", "(", "DEFAULT_CONFIG_NAME", ")", ";", "}", "public", "static", "Config", "getConfig", "(", "String", "name", ")", "{", "if", "(", "name", "==", "null", ")", "{", "name", "=", "DEFAULT_CONFIG_NAME", ";", "}", "Config", "namedConfig", "=", "CONFIGURATIONS", ".", "get", "(", "name", ")", ";", "if", "(", "namedConfig", "==", "null", ")", "{", "namedConfig", "=", "new", "Config", "(", "name", ")", ";", "CONFIGURATIONS", ".", "put", "(", "name", ",", "namedConfig", ")", ";", "}", "return", "namedConfig", ";", "}", "private", "final", "String", "name", ";", "private", "Map", "<", "String", ",", "String", ">", "data", ";", "private", "Config", "(", "final", "String", "name", ")", "{", "this", ".", "name", "=", "name", ";", "this", ".", "data", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "}", "public", "String", "getName", "(", ")", "{", "return", "name", ";", "}", "public", "void", "add", "(", "String", "key", ",", "String", "value", ")", "{", "data", ".", "put", "(", "key", ",", "value", ")", ";", "}", "public", "String", "get", "(", "String", "key", ")", "{", "return", "data", ".", "get", "(", "key", ")", ";", "}", "public", "String", "get", "(", "String", "key", ",", "String", "def", ")", "{", "String", "v", "=", "get", "(", "key", ")", ";", "if", "(", "v", "==", "null", ")", "{", "v", "=", "def", ";", "}", "return", "v", ";", "}", "public", "Long", "getAsLong", "(", "String", "key", ",", "Long", "def", ")", "{", "String", "val", "=", "get", "(", "key", ")", ";", "try", "{", "return", "Long", ".", "parseLong", "(", "val", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "return", "def", ";", "}", "}", "public", "Boolean", "getAsBoolean", "(", "String", "key", ",", "Boolean", "def", ")", "{", "String", "val", "=", "get", "(", "key", ")", ";", "if", "(", "val", "==", "null", ")", "{", "return", "def", ";", "}", "return", "Boolean", ".", "parseBoolean", "(", "val", ")", ";", "}", "public", "Integer", "getAsInteger", "(", "String", "key", ",", "Integer", "def", ")", "{", "String", "val", "=", "get", "(", "key", ")", ";", "try", "{", "return", "Integer", ".", "parseInt", "(", "val", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "return", "def", ";", "}", "}", "public", "Map", "<", "String", ",", "String", ">", "getAsMap", "(", "String", "key", ",", "Map", "<", "String", ",", "String", ">", "def", ")", "{", "String", "val", "=", "get", "(", "key", ")", ";", "try", "{", "return", "Tools", ".", "convertStringToMap", "(", "val", ",", "\"n\"", ",", "\"=\"", ",", "true", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "return", "def", ";", "}", "}", "public", "void", "clear", "(", ")", "{", "data", ".", "clear", "(", ")", ";", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "return", "\"[name=\"", "+", "getName", "(", ")", "+", "\"]", "\"", "+", "data", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
12,802
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "import", "javax", ".", "xml", ".", "xpath", ".", "XPathConstants", ";", "import", "org", ".", "w3c", ".", "dom", ".", "NodeList", ";", "public", "class", "XPathBodyTypeAdapter", "extends", "BodyTypeAdapter", "{", "public", "XPathBodyTypeAdapter", "(", ")", "{", "}", "@", "Override", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "boolean", "equals", "(", "final", "Object", "expected", ",", "final", "Object", "actual", ")", "{", "if", "(", "checkNoBody", "(", "expected", ")", ")", "{", "return", "checkNoBody", "(", "actual", ")", ";", "}", "if", "(", "checkNoBody", "(", "actual", ")", ")", "{", "return", "checkNoBody", "(", "expected", ")", ";", "}", "List", "<", "String", ">", "expressions", "=", "(", "List", "<", "String", ">", ")", "expected", ";", "for", "(", "String", "expr", ":", "expressions", ")", "{", "try", "{", "boolean", "b", "=", "eval", "(", "expr", ",", "actual", ".", "toString", "(", ")", ")", ";", "if", "(", "!", "b", ")", "{", "addError", "(", "\"not", "found:", "'\"", "+", "expr", "+", "\"'\"", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", "+", "expr", "+", "\"\"", "+", "actual", ".", "toString", "(", ")", ",", "e", ")", ";", "}", "}", "return", "getErrors", "(", ")", ".", "size", "(", ")", "==", "0", ";", "}", "protected", "boolean", "eval", "(", "String", "expr", ",", "String", "content", ")", "{", "Boolean", "b", ";", "try", "{", "NodeList", "ret", "=", "Tools", ".", "extractXPath", "(", "getContext", "(", ")", ",", "expr", ",", "content", ",", "getCharset", "(", ")", ")", ";", "return", "!", "(", "ret", "==", "null", "||", "ret", ".", "getLength", "(", ")", "==", "0", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "b", "=", "(", "Boolean", ")", "Tools", ".", "extractXPath", "(", "getContext", "(", ")", ",", "expr", ",", "content", ",", "XPathConstants", ".", "BOOLEAN", ",", "getCharset", "(", ")", ")", ";", "}", "return", "b", ";", "}", "@", "Override", "public", "Object", "parse", "(", "String", "expectedListOfXpathsAsString", ")", "throws", "Exception", "{", "List", "<", "String", ">", "expectedXPathAsList", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "if", "(", "expectedListOfXpathsAsString", "==", "null", ")", "{", "return", "expectedXPathAsList", ";", "}", "String", "expStr", "=", "expectedListOfXpathsAsString", ".", "trim", "(", ")", ";", "if", "(", "\"no-body\"", ".", "equals", "(", "expStr", ".", "trim", "(", ")", ")", ")", "{", "return", "expectedXPathAsList", ";", "}", "if", "(", "\"\"", ".", "equals", "(", "expectedListOfXpathsAsString", ".", "trim", "(", ")", ")", ")", "{", "return", "expectedXPathAsList", ";", "}", "expStr", "=", "Tools", ".", "fromHtml", "(", "expStr", ")", ";", "String", "[", "]", "nvpArray", "=", "expStr", ".", "split", "(", "\"n\"", ")", ";", "for", "(", "String", "nvp", ":", "nvpArray", ")", "{", "if", "(", "!", "\"\"", ".", "equals", "(", "nvp", ".", "trim", "(", ")", ")", ")", "{", "expectedXPathAsList", ".", "add", "(", "nvp", ".", "trim", "(", ")", ")", ";", "}", "}", "return", "expectedXPathAsList", ";", "}", "@", "Override", "public", "String", "toXmlString", "(", "String", "content", ")", "{", "return", "content", ";", "}", "}", "</s>" ]
12,803
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "w3c", ".", "dom", ".", "NodeList", ";", "import", "smartrics", ".", "rest", ".", "client", ".", "RestResponse", ";", "public", "class", "LetBodyXmlHandler", "implements", "LetHandler", "{", "@", "Override", "public", "String", "handle", "(", "RestResponse", "response", ",", "Object", "expressionContext", ",", "String", "expression", ")", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "Map", "<", "String", ",", "String", ">", "namespaceContext", "=", "(", "Map", "<", "String", ",", "String", ">", ")", "expressionContext", ";", "NodeList", "list", "=", "Tools", ".", "extractXPath", "(", "namespaceContext", ",", "expression", ",", "response", ".", "getBody", "(", ")", ")", ";", "String", "val", "=", "Tools", ".", "xPathResultToXmlString", "(", "list", ")", ";", "int", "pos", "=", "val", ".", "indexOf", "(", "\"?>\"", ")", ";", "if", "(", "pos", ">=", "0", ")", "{", "val", "=", "val", ".", "substring", "(", "pos", "+", "2", ")", ";", "}", "return", "val", ";", "}", "}", "</s>" ]
12,804
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ";", "public", "interface", "CellFormatter", "<", "E", ">", "{", "void", "exception", "(", "CellWrapper", "<", "E", ">", "cellWrapper", ",", "Throwable", "exception", ")", ";", "void", "exception", "(", "CellWrapper", "<", "E", ">", "cellWrapper", ",", "String", "exceptionMessage", ")", ";", "void", "check", "(", "CellWrapper", "<", "E", ">", "valueCell", ",", "RestDataTypeAdapter", "adapter", ")", ";", "String", "label", "(", "String", "string", ")", ";", "void", "wrong", "(", "CellWrapper", "<", "E", ">", "expected", ",", "RestDataTypeAdapter", "typeAdapter", ")", ";", "void", "right", "(", "CellWrapper", "<", "E", ">", "expected", ",", "RestDataTypeAdapter", "typeAdapter", ")", ";", "String", "gray", "(", "String", "string", ")", ";", "void", "asLink", "(", "CellWrapper", "<", "E", ">", "cell", ",", "String", "link", ",", "String", "text", ")", ";", "void", "setDisplayActual", "(", "boolean", "displayActual", ")", ";", "void", "setMinLenghtForToggleCollapse", "(", "int", "minLen", ")", ";", "boolean", "isDisplayActual", "(", ")", ";", "String", "fromRaw", "(", "String", "text", ")", ";", "}", "</s>" ]
12,805
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "java", ".", "util", ".", "Map", ".", "Entry", ";", "import", "java", ".", "util", ".", "regex", ".", "Matcher", ";", "import", "java", ".", "util", ".", "regex", ".", "Pattern", ";", "import", "fit", ".", "Fixture", ";", "public", "class", "Variables", "{", "public", "static", "final", "Pattern", "VARIABLES_PATTERN", "=", "Pattern", ".", "compile", "(", "\"\"", ")", ";", "private", "static", "final", "String", "FIT_NULL_VALUE", "=", "fitSymbolForNull", "(", ")", ";", "private", "String", "nullValue", "=", "\"null\"", ";", "public", "Variables", "(", ")", "{", "this", "(", "Config", ".", "getConfig", "(", ")", ")", ";", "}", "public", "Variables", "(", "Config", "c", ")", "{", "if", "(", "c", "!=", "null", ")", "{", "this", ".", "nullValue", "=", "c", ".", "get", "(", "\"\"", ",", "\"null\"", ")", ";", "}", "}", "public", "void", "put", "(", "String", "label", ",", "String", "val", ")", "{", "String", "l", "=", "fromFitNesseSymbol", "(", "label", ")", ";", "Fixture", ".", "setSymbol", "(", "l", ",", "val", ")", ";", "}", "public", "String", "get", "(", "String", "label", ")", "{", "String", "l", "=", "fromFitNesseSymbol", "(", "label", ")", ";", "if", "(", "Fixture", ".", "hasSymbol", "(", "l", ")", ")", "{", "return", "Fixture", ".", "getSymbol", "(", "l", ")", ".", "toString", "(", ")", ";", "}", "return", "null", ";", "}", "public", "void", "clearAll", "(", ")", "{", "Fixture", ".", "ClearSymbols", "(", ")", ";", "}", "public", "String", "substitute", "(", "String", "text", ")", "{", "if", "(", "text", "==", "null", ")", "{", "return", "null", ";", "}", "Matcher", "m", "=", "VARIABLES_PATTERN", ".", "matcher", "(", "text", ")", ";", "Map", "<", "String", ",", "String", ">", "replacements", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "while", "(", "m", ".", "find", "(", ")", ")", "{", "int", "gc", "=", "m", ".", "groupCount", "(", ")", ";", "if", "(", "gc", "==", "1", ")", "{", "String", "g0", "=", "m", ".", "group", "(", "0", ")", ";", "String", "g1", "=", "m", ".", "group", "(", "1", ")", ";", "String", "value", "=", "get", "(", "g1", ")", ";", "if", "(", "FIT_NULL_VALUE", ".", "equals", "(", "value", ")", ")", "{", "value", "=", "nullValue", ";", "}", "replacements", ".", "put", "(", "g0", ",", "value", ")", ";", "}", "}", "String", "newText", "=", "text", ";", "for", "(", "Entry", "<", "String", ",", "String", ">", "en", ":", "replacements", ".", "entrySet", "(", ")", ")", "{", "String", "k", "=", "en", ".", "getKey", "(", ")", ";", "String", "replacement", "=", "replacements", ".", "get", "(", "k", ")", ";", "if", "(", "replacement", "!=", "null", ")", "{", "newText", "=", "newText", ".", "replaceAll", "(", "k", ",", "replacement", ")", ";", "}", "}", "return", "newText", ";", "}", "private", "String", "fromFitNesseSymbol", "(", "String", "label", ")", "{", "String", "l", "=", "label", ";", "if", "(", "l", ".", "startsWith", "(", "\"$\"", ")", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "label", "+", "\")\"", ")", ";", "l", "=", "l", ".", "substring", "(", "1", ")", ";", "}", "return", "l", ";", "}", "private", "static", "String", "fitSymbolForNull", "(", ")", "{", "final", "String", "k", "=", "\"\"", ";", "Fixture", ".", "setSymbol", "(", "k", ",", "null", ")", ";", "return", "Fixture", ".", "getSymbol", "(", "k", ")", ".", "toString", "(", ")", ";", "}", "public", "String", "replaceNull", "(", "String", "s", ")", "{", "if", "(", "s", "==", "null", ")", "{", "return", "nullValue", ";", "}", "return", "s", ";", "}", "}", "</s>" ]
12,806
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ";", "import", "smartrics", ".", "rest", ".", "client", ".", "RestResponse", ";", "public", "class", "LetBodyJsHandler", "implements", "LetHandler", "{", "@", "Override", "public", "String", "handle", "(", "RestResponse", "response", ",", "Object", "expressionContext", ",", "String", "expression", ")", "{", "JavascriptWrapper", "js", "=", "new", "JavascriptWrapper", "(", ")", ";", "Object", "result", "=", "js", ".", "evaluateExpression", "(", "response", ",", "expression", ")", ";", "if", "(", "result", "==", "null", ")", "{", "return", "null", ";", "}", "return", "result", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
12,807
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "regex", ".", "Matcher", ";", "import", "java", ".", "util", ".", "regex", ".", "Pattern", ";", "import", "smartrics", ".", "rest", ".", "client", ".", "RestData", ".", "Header", ";", "import", "smartrics", ".", "rest", ".", "client", ".", "RestResponse", ";", "public", "class", "LetHeaderHandler", "implements", "LetHandler", "{", "public", "LetHeaderHandler", "(", ")", "{", "}", "public", "String", "handle", "(", "RestResponse", "response", ",", "Object", "expressionContext", ",", "String", "expression", ")", "{", "List", "<", "String", ">", "content", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "if", "(", "response", "!=", "null", ")", "{", "for", "(", "Header", "e", ":", "response", ".", "getHeaders", "(", ")", ")", "{", "String", "string", "=", "Tools", ".", "convertEntryToString", "(", "e", ".", "getName", "(", ")", ",", "e", ".", "getValue", "(", ")", ",", "\":\"", ")", ";", "content", ".", "add", "(", "string", ")", ";", "}", "}", "String", "value", "=", "null", ";", "if", "(", "content", ".", "size", "(", ")", ">", "0", ")", "{", "Pattern", "p", "=", "Pattern", ".", "compile", "(", "expression", ")", ";", "for", "(", "String", "c", ":", "content", ")", "{", "Matcher", "m", "=", "p", ".", "matcher", "(", "c", ")", ";", "if", "(", "m", ".", "find", "(", ")", ")", "{", "int", "cc", "=", "m", ".", "groupCount", "(", ")", ";", "value", "=", "m", ".", "group", "(", "cc", ")", ";", "break", ";", "}", "}", "}", "return", "value", ";", "}", "}", "</s>" ]
12,808
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ";", "import", "fit", ".", "Parse", ";", "public", "class", "StatusCodeTypeAdapter", "extends", "RestDataTypeAdapter", "{", "@", "Override", "public", "boolean", "equals", "(", "Object", "r1", ",", "Object", "r2", ")", "{", "if", "(", "r1", "==", "null", "||", "r2", "==", "null", ")", "{", "return", "false", ";", "}", "String", "expected", "=", "r1", ".", "toString", "(", ")", ";", "if", "(", "r1", "instanceof", "Parse", ")", "{", "expected", "=", "(", "(", "Parse", ")", "r1", ")", ".", "text", "(", ")", ";", "}", "String", "actual", "=", "(", "String", ")", "r2", ";", "if", "(", "!", "Tools", ".", "regex", "(", "actual", ",", "expected", ")", ")", "{", "addError", "(", "\"not", "match:", "\"", "+", "expected", ")", ";", "}", "return", "getErrors", "(", ")", ".", "size", "(", ")", "==", "0", ";", "}", "@", "Override", "public", "Object", "parse", "(", "String", "s", ")", "{", "if", "(", "s", "==", "null", ")", "{", "return", "\"null\"", ";", "}", "return", "s", ".", "trim", "(", ")", ";", "}", "@", "Override", "public", "String", "toString", "(", "Object", "obj", ")", "{", "if", "(", "obj", "==", "null", ")", "{", "return", "\"null\"", ";", "}", "if", "(", "obj", ".", "toString", "(", ")", ".", "trim", "(", ")", ".", "equals", "(", "\"\"", ")", ")", "{", "return", "\"blank\"", ";", "}", "return", "obj", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
12,809
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ";", "import", "smartrics", ".", "rest", ".", "client", ".", "RestResponse", ";", "public", "interface", "LetHandler", "{", "String", "handle", "(", "RestResponse", "response", ",", "Object", "expressionContext", ",", "String", "expression", ")", ";", "}", "</s>" ]
12,810
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ";", "import", "java", ".", "nio", ".", "charset", ".", "Charset", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "smartrics", ".", "rest", ".", "client", ".", "RestData", ".", "Header", ";", "public", "enum", "ContentType", "{", "XML", ",", "JSON", ",", "TEXT", ",", "JS", ";", "private", "static", "Map", "<", "String", ",", "ContentType", ">", "contentTypeToEnum", "=", "new", "HashMap", "<", "String", ",", "ContentType", ">", "(", ")", ";", "private", "static", "String", "defaultCharset", ";", "static", "{", "resetDefaultMapping", "(", ")", ";", "}", "public", "List", "<", "String", ">", "toMime", "(", ")", "{", "List", "<", "String", ">", "types", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "ContentType", ">", "e", ":", "contentTypeToEnum", ".", "entrySet", "(", ")", ")", "{", "if", "(", "e", ".", "getValue", "(", ")", ".", "equals", "(", "this", ")", ")", "{", "types", ".", "add", "(", "e", ".", "getKey", "(", ")", ")", ";", "}", "}", "return", "types", ";", "}", "public", "static", "ContentType", "typeFor", "(", "String", "t", ")", "{", "ContentType", "r", "=", "contentTypeToEnum", ".", "get", "(", "t", ")", ";", "if", "(", "r", "==", "null", ")", "{", "r", "=", "contentTypeToEnum", ".", "get", "(", "\"default\"", ")", ";", "}", "return", "r", ";", "}", "public", "static", "void", "config", "(", "Config", "config", ")", "{", "defaultCharset", "=", "config", ".", "get", "(", "\"\"", ",", "Charset", ".", "defaultCharset", "(", ")", ".", "name", "(", ")", ")", ";", "String", "htmlConfig", "=", "config", ".", "get", "(", "\"\"", ",", "\"\"", ")", ";", "String", "configStr", "=", "Tools", ".", "fromHtml", "(", "htmlConfig", ")", ";", "Map", "<", "String", ",", "String", ">", "map", "=", "Tools", ".", "convertStringToMap", "(", "configStr", ",", "\"=\"", ",", "\"n\"", ",", "true", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "e", ":", "map", ".", "entrySet", "(", ")", ")", "{", "String", "value", "=", "e", ".", "getValue", "(", ")", ";", "String", "enumName", "=", "value", ".", "toUpperCase", "(", ")", ";", "ContentType", "ct", "=", "ContentType", ".", "valueOf", "(", "enumName", ")", ";", "if", "(", "null", "==", "ct", ")", "{", "ContentType", "[", "]", "values", "=", "ContentType", ".", "values", "(", ")", ";", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "sb", ".", "append", "(", "\"[\"", ")", ";", "for", "(", "ContentType", "cType", ":", "values", ")", "{", "sb", ".", "append", "(", "\"'\"", ")", ".", "append", "(", "cType", ".", "toString", "(", ")", ")", ".", "append", "(", "\"'", "\"", ")", ";", "}", "sb", ".", "append", "(", "\"]\"", ")", ";", "throw", "new", "IllegalArgumentException", "(", "\"\"", "+", "value", "+", "\"\"", "+", "values", ")", ";", "}", "contentTypeToEnum", ".", "put", "(", "e", ".", "getKey", "(", ")", ",", "ct", ")", ";", "}", "}", "public", "static", "String", "parseCharset", "(", "List", "<", "Header", ">", "contentTypeHeaders", ")", "{", "if", "(", "contentTypeHeaders", ".", "size", "(", ")", "!=", "1", "||", "!", "\"Content-Type\"", ".", "equalsIgnoreCase", "(", "contentTypeHeaders", ".", "get", "(", "0", ")", ".", "getName", "(", ")", ")", ")", "{", "return", "defaultCharset", ";", "}", "String", "val", "=", "contentTypeHeaders", ".", "get", "(", "0", ")", ".", "getValue", "(", ")", ";", "String", "[", "]", "vals", "=", "val", ".", "split", "(", "\";\"", ")", ";", "if", "(", "vals", ".", "length", "==", "2", ")", "{", "String", "s", "=", "vals", "[", "1", "]", ".", "trim", "(", ")", ";", "if", "(", "s", ".", "length", "(", ")", ">", "0", ")", "{", "try", "{", "int", "pos", "=", "s", ".", "indexOf", "(", "\"charset=\"", ")", ";", "if", "(", "pos", ">=", "0", ")", "{", "s", "=", "s", ".", "substring", "(", "pos", "+", "\"charset=\"", ".", "length", "(", ")", ")", ";", "return", "Charset", ".", "forName", "(", "s", ")", ".", "name", "(", ")", ";", "}", "}", "catch", "(", "RuntimeException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", "+", "s", ")", ";", "}", "}", "}", "return", "defaultCharset", ";", "}", "public", "static", "void", "resetDefaultMapping", "(", ")", "{", "contentTypeToEnum", ".", "clear", "(", ")", ";", "contentTypeToEnum", ".", "put", "(", "\"default\"", ",", "ContentType", ".", "XML", ")", ";", "contentTypeToEnum", ".", "put", "(", "\"\"", ",", "ContentType", ".", "XML", ")", ";", "contentTypeToEnum", ".", "put", "(", "\"\"", ",", "ContentType", ".", "JSON", ")", ";", "contentTypeToEnum", ".", "put", "(", "\"text/plain\"", ",", "ContentType", ".", "TEXT", ")", ";", "contentTypeToEnum", ".", "put", "(", "\"\"", ",", "ContentType", ".", "JS", ")", ";", "}", "public", "static", "ContentType", "parse", "(", "List", "<", "Header", ">", "contentTypeHeaders", ")", "{", "if", "(", "contentTypeHeaders", ".", "size", "(", ")", "!=", "1", "||", "!", "\"Content-Type\"", ".", "equalsIgnoreCase", "(", "contentTypeHeaders", ".", "get", "(", "0", ")", ".", "getName", "(", ")", ")", ")", "{", "return", "contentTypeToEnum", ".", "get", "(", "\"default\"", ")", ";", "}", "String", "typeString", "=", "contentTypeHeaders", ".", "get", "(", "0", ")", ".", "getValue", "(", ")", ";", "typeString", "=", "typeString", ".", "split", "(", "\";\"", ")", "[", "0", "]", ".", "trim", "(", ")", ";", "ContentType", "ret", "=", "contentTypeToEnum", ".", "get", "(", "typeString", ")", ";", "if", "(", "ret", "==", "null", ")", "{", "return", "contentTypeToEnum", ".", "get", "(", "\"default\"", ")", ";", "}", "return", "ret", ";", "}", "}", "</s>" ]
12,811
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "javax", ".", "xml", ".", "xpath", ".", "XPathConstants", ";", "import", "org", ".", "w3c", ".", "dom", ".", "Node", ";", "import", "org", ".", "w3c", ".", "dom", ".", "NodeList", ";", "import", "smartrics", ".", "rest", ".", "client", ".", "RestData", ".", "Header", ";", "import", "smartrics", ".", "rest", ".", "client", ".", "RestResponse", ";", "public", "class", "LetBodyHandler", "implements", "LetHandler", "{", "@", "Override", "public", "String", "handle", "(", "RestResponse", "response", ",", "Object", "expressionContext", ",", "String", "expression", ")", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "Map", "<", "String", ",", "String", ">", "namespaceContext", "=", "(", "Map", "<", "String", ",", "String", ">", ")", "expressionContext", ";", "List", "<", "Header", ">", "h", "=", "response", ".", "getHeader", "(", "\"Content-Type\"", ")", ";", "ContentType", "contentType", "=", "ContentType", ".", "parse", "(", "h", ")", ";", "String", "charset", "=", "ContentType", ".", "parseCharset", "(", "h", ")", ";", "BodyTypeAdapter", "bodyTypeAdapter", "=", "BodyTypeAdapterFactory", ".", "getBodyTypeAdapter", "(", "contentType", ",", "charset", ")", ";", "String", "body", "=", "bodyTypeAdapter", ".", "toXmlString", "(", "response", ".", "getBody", "(", ")", ")", ";", "if", "(", "body", "==", "null", ")", "{", "return", "null", ";", "}", "String", "val", "=", "null", ";", "try", "{", "NodeList", "list", "=", "Tools", ".", "extractXPath", "(", "namespaceContext", ",", "expression", ",", "body", ")", ";", "Node", "item", "=", "list", ".", "item", "(", "0", ")", ";", "if", "(", "item", "!=", "null", ")", "{", "val", "=", "item", ".", "getTextContent", "(", ")", ";", "}", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "val", "=", "(", "String", ")", "Tools", ".", "extractXPath", "(", "namespaceContext", ",", "expression", ",", "body", ",", "XPathConstants", ".", "STRING", ",", "charset", ")", ";", "}", "if", "(", "val", "!=", "null", ")", "{", "val", "=", "val", ".", "trim", "(", ")", ";", "}", "return", "val", ";", "}", "}", "</s>" ]
12,812
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ";", "import", "java", ".", "net", ".", "MalformedURLException", ";", "import", "java", ".", "net", ".", "URL", ";", "public", "class", "Url", "{", "private", "URL", "baseUrl", ";", "public", "Url", "(", "String", "url", ")", "{", "try", "{", "if", "(", "url", "==", "null", "||", "\"\"", ".", "equals", "(", "url", ".", "trim", "(", ")", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", "+", "url", ")", ";", "}", "String", "u", "=", "url", ";", "if", "(", "url", ".", "endsWith", "(", "\"/\"", ")", ")", "{", "u", "=", "url", ".", "substring", "(", "0", ",", "u", ".", "length", "(", ")", "-", "1", ")", ";", "}", "baseUrl", "=", "new", "URL", "(", "u", ")", ";", "if", "(", "\"\"", ".", "equals", "(", "baseUrl", ".", "getHost", "(", ")", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", "+", "url", ")", ";", "}", "}", "catch", "(", "MalformedURLException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", "+", "url", ",", "e", ")", ";", "}", "}", "public", "URL", "getUrl", "(", ")", "{", "return", "baseUrl", ";", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "return", "getUrl", "(", ")", ".", "toExternalForm", "(", ")", ";", "}", "public", "String", "getResource", "(", ")", "{", "String", "res", "=", "getUrl", "(", ")", ".", "getPath", "(", ")", ".", "trim", "(", ")", ";", "if", "(", "res", ".", "isEmpty", "(", ")", ")", "{", "return", "\"/\"", ";", "}", "return", "res", ";", "}", "public", "String", "getBaseUrl", "(", ")", "{", "String", "path", "=", "getResource", "(", ")", ".", "trim", "(", ")", ";", "if", "(", "path", ".", "length", "(", ")", "==", "0", "||", "path", ".", "equals", "(", "\"/\"", ")", ")", "{", "return", "toString", "(", ")", ";", "}", "int", "index", "=", "toString", "(", ")", ".", "indexOf", "(", "getResource", "(", ")", ")", ";", "if", "(", "index", ">=", "0", ")", "{", "return", "toString", "(", ")", ".", "substring", "(", "0", ",", "index", ")", ";", "}", "else", "{", "throw", "new", "IllegalStateException", "(", "\"Invalid", "URL\"", ")", ";", "}", "}", "public", "URL", "buildURL", "(", "String", "file", ")", "{", "try", "{", "return", "new", "URL", "(", "baseUrl", ",", "file", ")", ";", "}", "catch", "(", "MalformedURLException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", "+", "file", ")", ";", "}", "}", "}", "</s>" ]
12,813
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ";", "public", "interface", "CellWrapper", "<", "E", ">", "{", "E", "getWrapped", "(", ")", ";", "String", "text", "(", ")", ";", "void", "body", "(", "String", "string", ")", ";", "String", "body", "(", ")", ";", "void", "addToBody", "(", "String", "string", ")", ";", "}", "</s>" ]
12,814
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ";", "import", "java", ".", "util", ".", "List", ";", "public", "class", "JSONBodyTypeAdapter", "extends", "XPathBodyTypeAdapter", "{", "private", "boolean", "forceJsEvaluation", "=", "false", ";", "private", "JavascriptWrapper", "wrapper", "=", "new", "JavascriptWrapper", "(", ")", ";", "public", "JSONBodyTypeAdapter", "(", ")", "{", "}", "@", "Override", "protected", "boolean", "eval", "(", "String", "expr", ",", "String", "json", ")", "{", "if", "(", "!", "forceJsEvaluation", "&&", "Tools", ".", "isValidXPath", "(", "getContext", "(", ")", ",", "expr", ")", "&&", "!", "wrapper", ".", "looksLikeAJsExpression", "(", "expr", ")", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "String", "xml", "=", "Tools", ".", "fromJSONtoXML", "(", "json", ")", ";", "return", "super", ".", "eval", "(", "expr", ",", "xml", ")", ";", "}", "Object", "exprResult", "=", "wrapper", ".", "evaluateExpression", "(", "json", ",", "expr", ")", ";", "if", "(", "exprResult", "==", "null", ")", "{", "return", "false", ";", "}", "return", "Boolean", ".", "parseBoolean", "(", "exprResult", ".", "toString", "(", ")", ")", ";", "}", "@", "Override", "public", "Object", "parse", "(", "String", "possibleJsContent", ")", "throws", "Exception", "{", "if", "(", "possibleJsContent", "==", "null", "||", "possibleJsContent", ".", "trim", "(", ")", ".", "indexOf", "(", "\"\"", ")", "<", "0", ")", "{", "forceJsEvaluation", "=", "false", ";", "return", "super", ".", "parse", "(", "possibleJsContent", ")", ";", "}", "forceJsEvaluation", "=", "true", ";", "String", "content", "=", "Tools", ".", "fromHtml", "(", "possibleJsContent", ".", "trim", "(", ")", ")", ";", "return", "content", ";", "}", "@", "Override", "public", "boolean", "equals", "(", "Object", "expected", ",", "Object", "actual", ")", "{", "if", "(", "checkNoBody", "(", "expected", ")", ")", "{", "return", "checkNoBody", "(", "actual", ")", ";", "}", "if", "(", "checkNoBody", "(", "actual", ")", ")", "{", "return", "checkNoBody", "(", "expected", ")", ";", "}", "if", "(", "expected", "instanceof", "List", "<", "?", ">", ")", "{", "return", "super", ".", "equals", "(", "expected", ",", "actual", ")", ";", "}", "boolean", "result", "=", "false", ";", "if", "(", "expected", "instanceof", "String", ")", "{", "result", "=", "eval", "(", "expected", ".", "toString", "(", ")", ",", "actual", ".", "toString", "(", ")", ")", ";", "if", "(", "!", "result", ")", "{", "addError", "(", "\"not", "found:", "'\"", "+", "expected", ".", "toString", "(", ")", "+", "\"'\"", ")", ";", "}", "}", "return", "result", ";", "}", "@", "Override", "public", "String", "toString", "(", "Object", "obj", ")", "{", "if", "(", "obj", "==", "null", "||", "obj", ".", "toString", "(", ")", ".", "trim", "(", ")", ".", "equals", "(", "\"\"", ")", ")", "{", "return", "\"no-body\"", ";", "}", "return", "obj", ".", "toString", "(", ")", ";", "}", "@", "Override", "public", "String", "toXmlString", "(", "String", "content", ")", "{", "return", "Tools", ".", "fromJSONtoXML", "(", "content", ")", ";", "}", "}", "</s>" ]
12,815
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "CellWrapper", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "RowWrapper", ";", "import", "fit", ".", "Parse", ";", "public", "class", "FitRow", "implements", "RowWrapper", "<", "Parse", ">", "{", "private", "final", "Parse", "cells", ";", "private", "final", "List", "<", "CellWrapper", "<", "Parse", ">", ">", "row", ";", "public", "FitRow", "(", "Parse", "parse", ")", "{", "this", ".", "cells", "=", "parse", ";", "Parse", "next", "=", "cells", ";", "row", "=", "new", "ArrayList", "<", "CellWrapper", "<", "Parse", ">", ">", "(", ")", ";", "while", "(", "next", "!=", "null", ")", "{", "row", ".", "add", "(", "new", "FitCell", "(", "next", ")", ")", ";", "next", "=", "next", ".", "more", ";", "}", "}", "public", "int", "size", "(", ")", "{", "if", "(", "row", "!=", "null", ")", "{", "return", "row", ".", "size", "(", ")", ";", "}", "return", "0", ";", "}", "public", "CellWrapper", "<", "Parse", ">", "getCell", "(", "int", "c", ")", "{", "if", "(", "c", "<", "row", ".", "size", "(", ")", ")", "{", "return", "row", ".", "get", "(", "c", ")", ";", "}", "return", "null", ";", "}", "public", "CellWrapper", "<", "Parse", ">", "removeCell", "(", "int", "c", ")", "{", "if", "(", "c", "<", "row", ".", "size", "(", ")", ")", "{", "return", "row", ".", "remove", "(", "c", ")", ";", "}", "return", "null", ";", "}", "}", "</s>" ]
12,816
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ";", "import", "java", ".", "lang", ".", "reflect", ".", "InvocationTargetException", ";", "import", "java", ".", "lang", ".", "reflect", ".", "Method", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "java", ".", "util", ".", "Vector", ";", "import", "org", ".", "slf4j", ".", "Logger", ";", "import", "org", ".", "slf4j", ".", "LoggerFactory", ";", "import", "smartrics", ".", "rest", ".", "client", ".", "RestClient", ";", "import", "smartrics", ".", "rest", ".", "client", ".", "RestData", ".", "Header", ";", "import", "smartrics", ".", "rest", ".", "client", ".", "RestRequest", ";", "import", "smartrics", ".", "rest", ".", "client", ".", "RestResponse", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "BodyTypeAdapter", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "CellFormatter", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "CellWrapper", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "Config", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "ContentType", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "HeadersTypeAdapter", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "JavascriptException", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "JavascriptWrapper", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "LetHandler", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "LetHandlerFactory", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "RestDataTypeAdapter", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "RowWrapper", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "StatusCodeTypeAdapter", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "StringTypeAdapter", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "Tools", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "Url", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "Variables", ";", "public", "class", "RestFixture", "{", "public", "enum", "Runner", "{", "SLIM", ",", "FIT", ",", "OTHER", ";", "}", ";", "private", "static", "final", "String", "LINE_SEPARATOR", "=", "\"n\"", ";", "private", "static", "final", "String", "FILE", "=", "\"file\"", ";", "private", "static", "final", "Logger", "LOG", "=", "LoggerFactory", ".", "getLogger", "(", "RestFixture", ".", "class", ")", ";", "protected", "Variables", "GLOBALS", ";", "private", "RestResponse", "lastResponse", ";", "private", "RestRequest", "lastRequest", ";", "protected", "String", "fileName", "=", "null", ";", "protected", "String", "multipartFileName", "=", "null", ";", "protected", "String", "multipartFileParameterName", "=", "FILE", ";", "protected", "String", "requestBody", ";", "private", "Map", "<", "String", ",", "String", ">", "requestHeaders", ";", "private", "RestClient", "restClient", ";", "private", "Config", "config", ";", "private", "boolean", "displayActualOnRight", ";", "private", "boolean", "debugMethodCall", "=", "false", ";", "private", "Map", "<", "String", ",", "String", ">", "defaultHeaders", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "private", "Map", "<", "String", ",", "String", ">", "namespaceContext", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "private", "Url", "baseUrl", ";", "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "protected", "RowWrapper", "row", ";", "private", "CellFormatter", "<", "?", ">", "formatter", ";", "private", "PartsFactory", "partsFactory", ";", "private", "String", "lastEvaluation", ";", "private", "int", "minLenForCollapseToggle", ";", "public", "RestFixture", "(", ")", "{", "super", "(", ")", ";", "this", ".", "partsFactory", "=", "new", "PartsFactory", "(", ")", ";", "this", ".", "displayActualOnRight", "=", "true", ";", "this", ".", "minLenForCollapseToggle", "=", "-", "1", ";", "}", "public", "RestFixture", "(", "String", "hostName", ")", "{", "this", "(", "hostName", ",", "Config", ".", "DEFAULT_CONFIG_NAME", ")", ";", "}", "public", "RestFixture", "(", "String", "hostName", ",", "String", "configName", ")", "{", "this", "(", "new", "PartsFactory", "(", ")", ",", "hostName", ",", "configName", ")", ";", "}", "public", "RestFixture", "(", "PartsFactory", "partsFactory", ",", "String", "hostName", ",", "String", "configName", ")", "{", "this", ".", "displayActualOnRight", "=", "true", ";", "this", ".", "minLenForCollapseToggle", "=", "-", "1", ";", "this", ".", "partsFactory", "=", "partsFactory", ";", "this", ".", "config", "=", "Config", ".", "getConfig", "(", "configName", ")", ";", "this", ".", "baseUrl", "=", "new", "Url", "(", "stripTag", "(", "hostName", ")", ")", ";", "}", "public", "Config", "getConfig", "(", ")", "{", "return", "config", ";", "}", "public", "String", "getLastEvaluation", "(", ")", "{", "return", "lastEvaluation", ";", "}", "public", "String", "getBaseUrl", "(", ")", "{", "if", "(", "baseUrl", "!=", "null", ")", "{", "return", "baseUrl", ".", "toString", "(", ")", ";", "}", "return", "null", ";", "}", "public", "void", "setBaseUrl", "(", "Url", "url", ")", "{", "this", ".", "baseUrl", "=", "url", ";", "}", "public", "Map", "<", "String", ",", "String", ">", "getDefaultHeaders", "(", ")", "{", "return", "defaultHeaders", ";", "}", "public", "CellFormatter", "<", "?", ">", "getFormatter", "(", ")", "{", "return", "formatter", ";", "}", "public", "List", "<", "List", "<", "String", ">", ">", "doTable", "(", "List", "<", "List", "<", "String", ">", ">", "rows", ")", "{", "initialize", "(", "Runner", ".", "SLIM", ")", ";", "List", "<", "List", "<", "String", ">", ">", "res", "=", "new", "Vector", "<", "List", "<", "String", ">", ">", "(", ")", ";", "getFormatter", "(", ")", ".", "setDisplayActual", "(", "displayActualOnRight", ")", ";", "getFormatter", "(", ")", ".", "setMinLenghtForToggleCollapse", "(", "minLenForCollapseToggle", ")", ";", "for", "(", "List", "<", "String", ">", "r", ":", "rows", ")", "{", "processSlimRow", "(", "res", ",", "r", ")", ";", "}", "return", "res", ";", "}", "protected", "boolean", "validateState", "(", ")", "{", "return", "baseUrl", "!=", "null", ";", "}", "protected", "void", "setConfig", "(", "Config", "c", ")", "{", "this", ".", "config", "=", "c", ";", "}", "protected", "void", "notifyInvalidState", "(", "boolean", "state", ")", "{", "if", "(", "!", "state", ")", "{", "throw", "new", "RuntimeException", "(", "\"\"", ")", ";", "}", "}", "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "public", "void", "setMultipartFileName", "(", ")", "{", "CellWrapper", "cell", "=", "row", ".", "getCell", "(", "1", ")", ";", "if", "(", "cell", "==", "null", ")", "{", "getFormatter", "(", ")", ".", "exception", "(", "row", ".", "getCell", "(", "0", ")", ",", "\"\"", ")", ";", "}", "else", "{", "multipartFileName", "=", "GLOBALS", ".", "substitute", "(", "cell", ".", "text", "(", ")", ")", ";", "renderReplacement", "(", "cell", ",", "multipartFileName", ")", ";", "}", "}", "public", "String", "getMultipartFileName", "(", ")", "{", "return", "multipartFileName", ";", "}", "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "public", "void", "setFileName", "(", ")", "{", "CellWrapper", "cell", "=", "row", ".", "getCell", "(", "1", ")", ";", "if", "(", "cell", "==", "null", ")", "{", "getFormatter", "(", ")", ".", "exception", "(", "row", ".", "getCell", "(", "0", ")", ",", "\"\"", ")", ";", "}", "else", "{", "fileName", "=", "GLOBALS", ".", "substitute", "(", "cell", ".", "text", "(", ")", ")", ";", "renderReplacement", "(", "cell", ",", "fileName", ")", ";", "}", "}", "public", "String", "getFileName", "(", ")", "{", "return", "fileName", ";", "}", "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "public", "void", "setMultipartFileParameterName", "(", ")", "{", "CellWrapper", "cell", "=", "row", ".", "getCell", "(", "1", ")", ";", "if", "(", "cell", "==", "null", ")", "{", "getFormatter", "(", ")", ".", "exception", "(", "row", ".", "getCell", "(", "0", ")", ",", "\"\"", ")", ";", "}", "else", "{", "multipartFileParameterName", "=", "GLOBALS", ".", "substitute", "(", "cell", ".", "text", "(", ")", ")", ";", "renderReplacement", "(", "cell", ",", "multipartFileParameterName", ")", ";", "}", "}", "public", "String", "getMultipartFileParameterName", "(", ")", "{", "return", "multipartFileParameterName", ";", "}", "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "public", "void", "setBody", "(", ")", "{", "CellWrapper", "cell", "=", "row", ".", "getCell", "(", "1", ")", ";", "if", "(", "cell", "==", "null", ")", "{", "getFormatter", "(", ")", ".", "exception", "(", "row", ".", "getCell", "(", "0", ")", ",", "\"\"", ")", ";", "}", "else", "{", "String", "text", "=", "getFormatter", "(", ")", ".", "fromRaw", "(", "cell", ".", "text", "(", ")", ")", ";", "requestBody", "=", "GLOBALS", ".", "substitute", "(", "text", ")", ";", "renderReplacement", "(", "cell", ",", "requestBody", ")", ";", "}", "}", "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "public", "void", "setHeader", "(", ")", "{", "CellWrapper", "cell", "=", "row", ".", "getCell", "(", "1", ")", ";", "if", "(", "cell", "==", "null", ")", "{", "getFormatter", "(", ")", ".", "exception", "(", "row", ".", "getCell", "(", "0", ")", ",", "\"\"", ")", ";", "}", "else", "{", "setHeaders", "(", "cell", ".", "text", "(", ")", ")", ";", "}", "}", "public", "void", "setHeaders", "(", ")", "{", "setHeader", "(", ")", ";", "}", "public", "void", "setHeaders", "(", "String", "headers", ")", "{", "String", "substitutedHeaders", "=", "GLOBALS", ".", "substitute", "(", "headers", ")", ";", "requestHeaders", "=", "parseHeaders", "(", "substitutedHeaders", ")", ";", "CellWrapper", "cell", "=", "row", ".", "getCell", "(", "1", ")", ";", "if", "(", "!", "substitutedHeaders", ".", "equals", "(", "headers", ")", ")", "{", "cell", ".", "body", "(", "substitutedHeaders", ")", ";", "}", "}", "public", "void", "PUT", "(", ")", "{", "debugMethodCallStart", "(", ")", ";", "doMethod", "(", "emptifyBody", "(", "requestBody", ")", ",", "\"Put\"", ")", ";", "debugMethodCallEnd", "(", ")", ";", "}", "public", "void", "GET", "(", ")", "{", "debugMethodCallStart", "(", ")", ";", "doMethod", "(", "\"Get\"", ")", ";", "debugMethodCallEnd", "(", ")", ";", "}", "public", "void", "DELETE", "(", ")", "{", "debugMethodCallStart", "(", ")", ";", "doMethod", "(", "\"Delete\"", ")", ";", "debugMethodCallEnd", "(", ")", ";", "}", "public", "void", "POST", "(", ")", "{", "debugMethodCallStart", "(", ")", ";", "doMethod", "(", "emptifyBody", "(", "requestBody", ")", ",", "\"Post\"", ")", ";", "debugMethodCallEnd", "(", ")", ";", "}", "@", "SuppressWarnings", "(", "{", "\"unchecked\"", ",", "\"rawtypes\"", "}", ")", "public", "void", "let", "(", ")", "{", "debugMethodCallStart", "(", ")", ";", "String", "label", "=", "row", ".", "getCell", "(", "1", ")", ".", "text", "(", ")", ".", "trim", "(", ")", ";", "String", "loc", "=", "row", ".", "getCell", "(", "2", ")", ".", "text", "(", ")", ";", "CellWrapper", "exprCell", "=", "row", ".", "getCell", "(", "3", ")", ";", "exprCell", ".", "body", "(", "GLOBALS", ".", "substitute", "(", "exprCell", ".", "body", "(", ")", ")", ")", ";", "String", "expr", "=", "exprCell", ".", "text", "(", ")", ";", "CellWrapper", "valueCell", "=", "row", ".", "getCell", "(", "4", ")", ";", "String", "valueCellText", "=", "valueCell", ".", "body", "(", ")", ";", "String", "valueCellTextReplaced", "=", "GLOBALS", ".", "substitute", "(", "valueCellText", ")", ";", "valueCell", ".", "body", "(", "valueCellTextReplaced", ")", ";", "String", "sValue", "=", "null", ";", "try", "{", "LetHandler", "letHandler", "=", "LetHandlerFactory", ".", "getHandlerFor", "(", "loc", ")", ";", "if", "(", "letHandler", "!=", "null", ")", "{", "StringTypeAdapter", "adapter", "=", "new", "StringTypeAdapter", "(", ")", ";", "try", "{", "LOG", ".", "info", "(", "\"\"", "+", "letHandler", ".", "getClass", "(", ")", ")", ";", "sValue", "=", "letHandler", ".", "handle", "(", "getLastResponse", "(", ")", ",", "namespaceContext", ",", "expr", ")", ";", "exprCell", ".", "body", "(", "getFormatter", "(", ")", ".", "gray", "(", "exprCell", ".", "body", "(", ")", ")", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "getFormatter", "(", ")", ".", "exception", "(", "exprCell", ",", "e", ".", "getMessage", "(", ")", ")", ";", "e", ".", "printStackTrace", "(", ")", ";", "}", "GLOBALS", ".", "put", "(", "label", ",", "sValue", ")", ";", "adapter", ".", "set", "(", "sValue", ")", ";", "getFormatter", "(", ")", ".", "check", "(", "valueCell", ",", "adapter", ")", ";", "}", "else", "{", "getFormatter", "(", ")", ".", "exception", "(", "exprCell", ",", "\"\"", "+", "loc", "+", "\"'\"", ")", ";", "}", "}", "catch", "(", "RuntimeException", "e", ")", "{", "getFormatter", "(", ")", ".", "exception", "(", "exprCell", ",", "e", ")", ";", "}", "finally", "{", "debugMethodCallEnd", "(", ")", ";", "}", "}", "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "public", "void", "comment", "(", ")", "{", "debugMethodCallStart", "(", ")", ";", "CellWrapper", "messageCell", "=", "row", ".", "getCell", "(", "1", ")", ";", "try", "{", "String", "message", "=", "messageCell", ".", "text", "(", ")", ".", "trim", "(", ")", ";", "message", "=", "GLOBALS", ".", "substitute", "(", "message", ")", ";", "messageCell", ".", "body", "(", "getFormatter", "(", ")", ".", "gray", "(", "message", ")", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "getFormatter", "(", ")", ".", "exception", "(", "messageCell", ",", "e", ")", ";", "}", "finally", "{", "debugMethodCallEnd", "(", ")", ";", "}", "}", "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "public", "void", "evalJs", "(", ")", "{", "CellWrapper", "jsCell", "=", "row", ".", "getCell", "(", "1", ")", ";", "if", "(", "jsCell", "==", "null", ")", "{", "getFormatter", "(", ")", ".", "exception", "(", "row", ".", "getCell", "(", "0", ")", ",", "\"\"", ")", ";", "return", ";", "}", "JavascriptWrapper", "wrapper", "=", "new", "JavascriptWrapper", "(", ")", ";", "Object", "result", "=", "null", ";", "try", "{", "result", "=", "wrapper", ".", "evaluateExpression", "(", "lastResponse", ",", "jsCell", ".", "body", "(", ")", ")", ";", "}", "catch", "(", "JavascriptException", "e", ")", "{", "getFormatter", "(", ")", ".", "exception", "(", "row", ".", "getCell", "(", "1", ")", ",", "e", ")", ";", "return", ";", "}", "lastEvaluation", "=", "null", ";", "if", "(", "result", "!=", "null", ")", "{", "lastEvaluation", "=", "result", ".", "toString", "(", ")", ";", "}", "StringTypeAdapter", "adapter", "=", "new", "StringTypeAdapter", "(", ")", ";", "adapter", ".", "set", "(", "lastEvaluation", ")", ";", "getFormatter", "(", ")", ".", "right", "(", "row", ".", "getCell", "(", "1", ")", ",", "adapter", ")", ";", "}", "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "public", "void", "processRow", "(", "RowWrapper", "<", "?", ">", "currentRow", ")", "{", "row", "=", "currentRow", ";", "CellWrapper", "cell0", "=", "row", ".", "getCell", "(", "0", ")", ";", "if", "(", "cell0", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"\"", ")", ";", "}", "String", "methodName", "=", "cell0", ".", "text", "(", ")", ";", "if", "(", "\"\"", ".", "equals", "(", "methodName", ")", ")", "{", "throw", "new", "RuntimeException", "(", "\"\"", ")", ";", "}", "Method", "method1", "=", "null", ";", "try", "{", "method1", "=", "getClass", "(", ")", ".", "getMethod", "(", "methodName", ")", ";", "method1", ".", "invoke", "(", "this", ")", ";", "}", "catch", "(", "SecurityException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"\"", "+", "methodName", "+", "\"\"", "+", "this", ".", "getClass", "(", ")", ".", "getSimpleName", "(", ")", ",", "e", ")", ";", "}", "catch", "(", "NoSuchMethodException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"Class", "\"", "+", "this", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\"\"", "+", "methodName", ",", "e", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"\"", "+", "methodName", "+", "\"\"", ",", "e", ")", ";", "}", "catch", "(", "IllegalAccessException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"\"", "+", "methodName", "+", "\"\"", ",", "e", ")", ";", "}", "catch", "(", "InvocationTargetException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"\"", "+", "methodName", "+", "\"\"", ",", "e", ")", ";", "}", "}", "protected", "void", "initialize", "(", "Runner", "runner", ")", "{", "boolean", "state", "=", "validateState", "(", ")", ";", "notifyInvalidState", "(", "state", ")", ";", "configFormatter", "(", "runner", ")", ";", "configFixture", "(", ")", ";", "configRestClient", "(", ")", ";", "}", "protected", "String", "emptifyBody", "(", "String", "b", ")", "{", "String", "body", "=", "b", ";", "if", "(", "body", "==", "null", ")", "{", "body", "=", "\"\"", ";", "}", "return", "body", ";", "}", "public", "Map", "<", "String", ",", "String", ">", "getHeaders", "(", ")", "{", "Map", "<", "String", ",", "String", ">", "headers", "=", "null", ";", "if", "(", "requestHeaders", "!=", "null", ")", "{", "headers", "=", "requestHeaders", ";", "}", "else", "{", "headers", "=", "defaultHeaders", ";", "}", "return", "headers", ";", "}", "protected", "String", "getRequestBody", "(", ")", "{", "return", "requestBody", ";", "}", "protected", "void", "setRequestBody", "(", "String", "text", ")", "{", "requestBody", "=", "text", ";", "}", "protected", "Map", "<", "String", ",", "String", ">", "getNamespaceContext", "(", ")", "{", "return", "namespaceContext", ";", "}", "private", "void", "doMethod", "(", "String", "m", ")", "{", "doMethod", "(", "null", ",", "m", ")", ";", "}", "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "protected", "void", "doMethod", "(", "String", "body", ",", "String", "method", ")", "{", "CellWrapper", "urlCell", "=", "row", ".", "getCell", "(", "1", ")", ";", "String", "url", "=", "stripTag", "(", "urlCell", ".", "text", "(", ")", ")", ";", "String", "resUrl", "=", "GLOBALS", ".", "substitute", "(", "url", ")", ";", "String", "rBody", "=", "GLOBALS", ".", "substitute", "(", "body", ")", ";", "try", "{", "doMethod", "(", "method", ",", "resUrl", ",", "rBody", ")", ";", "completeHttpMethodExecution", "(", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "getFormatter", "(", ")", ".", "exception", "(", "row", ".", "getCell", "(", "0", ")", ",", "\"\"", "+", "method", "+", "\"\"", "+", "e", ".", "getMessage", "(", ")", "+", "\"'\"", ")", ";", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "protected", "void", "doMethod", "(", "String", "method", ",", "String", "resUrl", ",", "String", "rBody", ")", "{", "setLastRequest", "(", "partsFactory", ".", "buildRestRequest", "(", ")", ")", ";", "getLastRequest", "(", ")", ".", "setMethod", "(", "RestRequest", ".", "Method", ".", "valueOf", "(", "method", ")", ")", ";", "getLastRequest", "(", ")", ".", "addHeaders", "(", "getHeaders", "(", ")", ")", ";", "if", "(", "fileName", "!=", "null", ")", "{", "getLastRequest", "(", ")", ".", "setFileName", "(", "fileName", ")", ";", "}", "if", "(", "multipartFileName", "!=", "null", ")", "{", "getLastRequest", "(", ")", ".", "setMultipartFileName", "(", "multipartFileName", ")", ";", "}", "getLastRequest", "(", ")", ".", "setMultipartFileParameterName", "(", "multipartFileParameterName", ")", ";", "String", "[", "]", "uri", "=", "resUrl", ".", "split", "(", "\"\\\\?\"", ")", ";", "String", "[", "]", "thisRequestUrlParts", "=", "buildThisRequestUrl", "(", "uri", "[", "0", "]", ")", ";", "getLastRequest", "(", ")", ".", "setResource", "(", "thisRequestUrlParts", "[", "1", "]", ")", ";", "if", "(", "uri", ".", "length", "==", "2", ")", "{", "getLastRequest", "(", ")", ".", "setQuery", "(", "uri", "[", "1", "]", ")", ";", "}", "if", "(", "\"Post\"", ".", "equals", "(", "method", ")", "||", "\"Put\"", ".", "equals", "(", "method", ")", ")", "{", "getLastRequest", "(", ")", ".", "setBody", "(", "rBody", ")", ";", "}", "restClient", ".", "setBaseUrl", "(", "thisRequestUrlParts", "[", "0", "]", ")", ";", "RestResponse", "response", "=", "restClient", ".", "execute", "(", "getLastRequest", "(", ")", ")", ";", "setLastResponse", "(", "response", ")", ";", "}", "private", "ContentType", "getContentTypeOfLastResponse", "(", ")", "{", "return", "ContentType", ".", "parse", "(", "getLastResponse", "(", ")", ".", "getHeader", "(", "\"Content-Type\"", ")", ")", ";", "}", "private", "String", "getCharsetOfLastResponse", "(", ")", "{", "return", "ContentType", ".", "parseCharset", "(", "getLastResponse", "(", ")", ".", "getHeader", "(", "\"Content-Type\"", ")", ")", ";", "}", "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "protected", "void", "completeHttpMethodExecution", "(", ")", "{", "String", "uri", "=", "getLastResponse", "(", ")", ".", "getResource", "(", ")", ";", "String", "query", "=", "getLastRequest", "(", ")", ".", "getQuery", "(", ")", ";", "if", "(", "query", "!=", "null", "&&", "!", "\"\"", ".", "equals", "(", "query", ".", "trim", "(", ")", ")", ")", "{", "uri", "=", "uri", "+", "\"?\"", "+", "query", ";", "}", "String", "clientBaseUri", "=", "restClient", ".", "getBaseUrl", "(", ")", ";", "String", "u", "=", "clientBaseUri", "+", "uri", ";", "CellWrapper", "uriCell", "=", "row", ".", "getCell", "(", "1", ")", ";", "getFormatter", "(", ")", ".", "asLink", "(", "uriCell", ",", "u", ",", "uri", ")", ";", "CellWrapper", "cellStatusCode", "=", "row", ".", "getCell", "(", "2", ")", ";", "if", "(", "cellStatusCode", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"\"", ")", ";", "}", "Integer", "lastStatusCode", "=", "getLastResponse", "(", ")", ".", "getStatusCode", "(", ")", ";", "process", "(", "cellStatusCode", ",", "lastStatusCode", ".", "toString", "(", ")", ",", "new", "StatusCodeTypeAdapter", "(", ")", ")", ";", "List", "<", "Header", ">", "lastHeaders", "=", "getLastResponse", "(", ")", ".", "getHeaders", "(", ")", ";", "process", "(", "row", ".", "getCell", "(", "3", ")", ",", "lastHeaders", ",", "new", "HeadersTypeAdapter", "(", ")", ")", ";", "CellWrapper", "bodyCell", "=", "row", ".", "getCell", "(", "4", ")", ";", "if", "(", "bodyCell", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"\"", ")", ";", "}", "bodyCell", ".", "body", "(", "GLOBALS", ".", "substitute", "(", "bodyCell", ".", "body", "(", ")", ")", ")", ";", "BodyTypeAdapter", "bodyTypeAdapter", "=", "createBodyTypeAdapter", "(", ")", ";", "process", "(", "bodyCell", ",", "getLastResponse", "(", ")", ".", "getBody", "(", ")", ",", "bodyTypeAdapter", ")", ";", "}", "protected", "BodyTypeAdapter", "createBodyTypeAdapter", "(", ")", "{", "return", "createBodyTypeAdapter", "(", "getContentTypeOfLastResponse", "(", ")", ")", ";", "}", "protected", "BodyTypeAdapter", "createBodyTypeAdapter", "(", "ContentType", "ct", ")", "{", "String", "charset", "=", "getCharsetOfLastResponse", "(", ")", ";", "BodyTypeAdapter", "bodyTypeAdapter", "=", "partsFactory", ".", "buildBodyTypeAdapter", "(", "ct", ",", "charset", ")", ";", "bodyTypeAdapter", ".", "setContext", "(", "namespaceContext", ")", ";", "return", "bodyTypeAdapter", ";", "}", "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "private", "void", "process", "(", "CellWrapper", "expected", ",", "Object", "actual", ",", "RestDataTypeAdapter", "ta", ")", "{", "if", "(", "expected", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"\"", ")", ";", "}", "ta", ".", "set", "(", "actual", ")", ";", "boolean", "ignore", "=", "\"\"", ".", "equals", "(", "expected", ".", "text", "(", ")", ".", "trim", "(", ")", ")", ";", "if", "(", "ignore", ")", "{", "String", "actualString", "=", "ta", ".", "toString", "(", ")", ";", "if", "(", "!", "\"\"", ".", "equals", "(", "actualString", ")", ")", "{", "expected", ".", "addToBody", "(", "getFormatter", "(", ")", ".", "gray", "(", "actualString", ")", ")", ";", "}", "}", "else", "{", "boolean", "success", "=", "false", ";", "try", "{", "String", "substitute", "=", "GLOBALS", ".", "substitute", "(", "Tools", ".", "fromHtml", "(", "expected", ".", "text", "(", ")", ")", ")", ";", "Object", "parse", "=", "ta", ".", "parse", "(", "substitute", ")", ";", "success", "=", "ta", ".", "equals", "(", "parse", ",", "actual", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "getFormatter", "(", ")", ".", "exception", "(", "expected", ",", "e", ")", ";", "return", ";", "}", "if", "(", "success", ")", "{", "getFormatter", "(", ")", ".", "right", "(", "expected", ",", "ta", ")", ";", "}", "else", "{", "getFormatter", "(", ")", ".", "wrong", "(", "expected", ",", "ta", ")", ";", "}", "}", "}", "private", "void", "debugMethodCallStart", "(", ")", "{", "debugMethodCall", "(", "\"=>", "\"", ")", ";", "}", "private", "void", "debugMethodCallEnd", "(", ")", "{", "debugMethodCall", "(", "\"<=", "\"", ")", ";", "}", "private", "void", "debugMethodCall", "(", "String", "h", ")", "{", "if", "(", "debugMethodCall", ")", "{", "StackTraceElement", "el", "=", "Thread", ".", "currentThread", "(", ")", ".", "getStackTrace", "(", ")", "[", "4", "]", ";", "LOG", ".", "debug", "(", "h", "+", "el", ".", "getMethodName", "(", ")", ")", ";", "}", "}", "protected", "RestResponse", "getLastResponse", "(", ")", "{", "return", "lastResponse", ";", "}", "protected", "RestRequest", "getLastRequest", "(", ")", "{", "return", "lastRequest", ";", "}", "private", "String", "[", "]", "buildThisRequestUrl", "(", "String", "uri", ")", "{", "String", "[", "]", "parts", "=", "new", "String", "[", "2", "]", ";", "if", "(", "baseUrl", "==", "null", "||", "uri", ".", "startsWith", "(", "baseUrl", ".", "toString", "(", ")", ")", ")", "{", "Url", "url", "=", "new", "Url", "(", "uri", ")", ";", "parts", "[", "0", "]", "=", "url", ".", "getBaseUrl", "(", ")", ";", "parts", "[", "1", "]", "=", "url", ".", "getResource", "(", ")", ";", "}", "else", "{", "try", "{", "Url", "attempted", "=", "new", "Url", "(", "uri", ")", ";", "parts", "[", "0", "]", "=", "attempted", ".", "getBaseUrl", "(", ")", ";", "parts", "[", "1", "]", "=", "attempted", ".", "getResource", "(", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "parts", "[", "0", "]", "=", "baseUrl", ".", "toString", "(", ")", ";", "parts", "[", "1", "]", "=", "uri", ";", "}", "}", "return", "parts", ";", "}", "private", "void", "setLastResponse", "(", "RestResponse", "lastResponse", ")", "{", "this", ".", "lastResponse", "=", "lastResponse", ";", "}", "private", "void", "setLastRequest", "(", "RestRequest", "lastRequest", ")", "{", "this", ".", "lastRequest", "=", "lastRequest", ";", "}", "private", "Map", "<", "String", ",", "String", ">", "parseHeaders", "(", "String", "str", ")", "{", "return", "Tools", ".", "convertStringToMap", "(", "str", ",", "\":\"", ",", "LINE_SEPARATOR", ",", "true", ")", ";", "}", "private", "Map", "<", "String", ",", "String", ">", "parseNamespaceContext", "(", "String", "str", ")", "{", "return", "Tools", ".", "convertStringToMap", "(", "str", ",", "\"=\"", ",", "LINE_SEPARATOR", ",", "true", ")", ";", "}", "private", "String", "stripTag", "(", "String", "somethingWithinATag", ")", "{", "return", "Tools", ".", "fromSimpleTag", "(", "somethingWithinATag", ")", ";", "}", "private", "void", "configFormatter", "(", "Runner", "runner", ")", "{", "formatter", "=", "partsFactory", ".", "buildCellFormatter", "(", "runner", ")", ";", "}", "private", "void", "configFixture", "(", ")", "{", "GLOBALS", "=", "new", "Variables", "(", "config", ")", ";", "displayActualOnRight", "=", "config", ".", "getAsBoolean", "(", "\"\"", ",", "displayActualOnRight", ")", ";", "minLenForCollapseToggle", "=", "config", ".", "getAsInteger", "(", "\"\"", ",", "minLenForCollapseToggle", ")", ";", "String", "str", "=", "config", ".", "get", "(", "\"\"", ",", "\"\"", ")", ";", "defaultHeaders", "=", "parseHeaders", "(", "str", ")", ";", "str", "=", "config", ".", "get", "(", "\"\"", ",", "\"\"", ")", ";", "namespaceContext", "=", "parseNamespaceContext", "(", "str", ")", ";", "LOG", ".", "debug", "(", "\"\"", "+", "namespaceContext", ")", ";", "ContentType", ".", "resetDefaultMapping", "(", ")", ";", "ContentType", ".", "config", "(", "config", ")", ";", "}", "private", "void", "configRestClient", "(", ")", "{", "restClient", "=", "partsFactory", ".", "buildRestClient", "(", "getConfig", "(", ")", ")", ";", "}", "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "private", "void", "renderReplacement", "(", "CellWrapper", "cell", ",", "String", "actual", ")", "{", "StringTypeAdapter", "adapter", "=", "new", "StringTypeAdapter", "(", ")", ";", "adapter", ".", "set", "(", "actual", ")", ";", "if", "(", "!", "adapter", ".", "equals", "(", "actual", ",", "cell", ".", "body", "(", ")", ")", ")", "{", "getFormatter", "(", ")", ".", "right", "(", "cell", ",", "adapter", ")", ";", "}", "}", "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "private", "void", "processSlimRow", "(", "List", "<", "List", "<", "String", ">", ">", "resultTable", ",", "List", "<", "String", ">", "row", ")", "{", "RowWrapper", "currentRow", "=", "new", "SlimRow", "(", "row", ")", ";", "try", "{", "processRow", "(", "currentRow", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "LOG", ".", "error", "(", "\"\"", "+", "row", ".", "get", "(", "0", ")", ",", "e", ")", ";", "getFormatter", "(", ")", ".", "exception", "(", "currentRow", ".", "getCell", "(", "0", ")", ",", "e", ")", ";", "}", "finally", "{", "List", "<", "String", ">", "rowAsList", "=", "mapSlimRow", "(", "row", ",", "currentRow", ")", ";", "resultTable", ".", "add", "(", "rowAsList", ")", ";", "}", "}", "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "private", "List", "<", "String", ">", "mapSlimRow", "(", "List", "<", "String", ">", "resultRow", ",", "RowWrapper", "currentRow", ")", "{", "List", "<", "String", ">", "rowAsList", "=", "(", "(", "SlimRow", ")", "currentRow", ")", ".", "asList", "(", ")", ";", "for", "(", "int", "c", "=", "0", ";", "c", "<", "rowAsList", ".", "size", "(", ")", ";", "c", "++", ")", "{", "String", "v", "=", "rowAsList", ".", "get", "(", "c", ")", ";", "if", "(", "v", ".", "equals", "(", "resultRow", ".", "get", "(", "c", ")", ")", ")", "{", "rowAsList", ".", "set", "(", "c", ",", "\"\"", ")", ";", "}", "}", "return", "rowAsList", ";", "}", "}", "</s>" ]
12,817
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "CellWrapper", ";", "import", "fit", ".", "Parse", ";", "public", "class", "FitCell", "implements", "CellWrapper", "<", "Parse", ">", "{", "private", "final", "Parse", "cell", ";", "public", "FitCell", "(", "Parse", "c", ")", "{", "this", ".", "cell", "=", "c", ";", "}", "@", "Override", "public", "String", "text", "(", ")", "{", "try", "{", "return", "cell", ".", "text", "(", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "return", "\"\"", ";", "}", "}", "@", "Override", "public", "void", "body", "(", "String", "string", ")", "{", "cell", ".", "body", "=", "string", ";", "}", "@", "Override", "public", "String", "body", "(", ")", "{", "return", "cell", ".", "body", ";", "}", "@", "Override", "public", "void", "addToBody", "(", "String", "string", ")", "{", "cell", ".", "addToBody", "(", "string", ")", ";", "}", "@", "Override", "public", "Parse", "getWrapped", "(", ")", "{", "return", "cell", ";", "}", "}", "</s>" ]
12,818
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "CellWrapper", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "RowWrapper", ";", "public", "class", "SlimRow", "implements", "RowWrapper", "<", "String", ">", "{", "private", "final", "List", "<", "CellWrapper", "<", "String", ">", ">", "row", ";", "public", "SlimRow", "(", "List", "<", "String", ">", "rawRow", ")", "{", "this", ".", "row", "=", "new", "ArrayList", "<", "CellWrapper", "<", "String", ">", ">", "(", ")", ";", "for", "(", "String", "r", ":", "rawRow", ")", "{", "this", ".", "row", ".", "add", "(", "new", "SlimCell", "(", "r", ")", ")", ";", "}", "}", "public", "CellWrapper", "<", "String", ">", "getCell", "(", "int", "c", ")", "{", "if", "(", "c", "<", "this", ".", "row", ".", "size", "(", ")", ")", "{", "return", "this", ".", "row", ".", "get", "(", "c", ")", ";", "}", "return", "null", ";", "}", "public", "int", "size", "(", ")", "{", "if", "(", "row", "!=", "null", ")", "{", "return", "row", ".", "size", "(", ")", ";", "}", "return", "0", ";", "}", "public", "List", "<", "String", ">", "asList", "(", ")", "{", "List", "<", "String", ">", "ret", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", "(", "CellWrapper", "<", "String", ">", "w", ":", "row", ")", "{", "ret", ".", "add", "(", "w", ".", "body", "(", ")", ")", ";", "}", "return", "ret", ";", "}", "public", "CellWrapper", "<", "String", ">", "removeCell", "(", "int", "c", ")", "{", "if", "(", "c", "<", "this", ".", "row", ".", "size", "(", ")", ")", "{", "return", "this", ".", "row", ".", "remove", "(", "c", ")", ";", "}", "return", "null", ";", "}", "}", "</s>" ]
12,819
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ";", "import", "java", ".", "util", ".", "List", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "Config", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "Tools", ";", "import", "fit", ".", "Fixture", ";", "import", "fit", ".", "Parse", ";", "public", "class", "RestFixtureConfig", "extends", "Fixture", "{", "private", "Config", "config", ";", "public", "RestFixtureConfig", "(", ")", "{", "}", "public", "RestFixtureConfig", "(", "String", "...", "args", ")", "{", "super", ".", "args", "=", "args", ";", "}", "public", "List", "<", "List", "<", "String", ">", ">", "doTable", "(", "List", "<", "List", "<", "String", ">", ">", "rows", ")", "{", "Config", "c", "=", "getConfig", "(", ")", ";", "for", "(", "List", "<", "String", ">", "row", ":", "rows", ")", "{", "String", "k", "=", "row", ".", "get", "(", "0", ")", ";", "if", "(", "row", ".", "size", "(", ")", "==", "2", ")", "{", "k", "=", "row", ".", "get", "(", "0", ")", ";", "String", "v", "=", "row", ".", "get", "(", "1", ")", ";", "c", ".", "add", "(", "k", ",", "v", ")", ";", "row", ".", "set", "(", "0", ",", "\"\"", ")", ";", "row", ".", "set", "(", "1", ",", "\"pass:\"", "+", "Tools", ".", "toHtml", "(", "v", ")", ")", ";", "}", "else", "{", "row", ".", "set", "(", "0", ",", "\"error:\"", "+", "k", "+", "Tools", ".", "toHtml", "(", "\"\"", "+", "\"\"", ")", ")", ";", "}", "}", "return", "rows", ";", "}", "@", "Override", "public", "void", "doRow", "(", "Parse", "p", ")", "{", "Parse", "cells", "=", "p", ".", "parts", ";", "try", "{", "String", "key", "=", "cells", ".", "text", "(", ")", ";", "String", "value", "=", "cells", ".", "more", ".", "text", "(", ")", ";", "Config", "c", "=", "getConfig", "(", ")", ";", "c", ".", "add", "(", "key", ",", "value", ")", ";", "String", "fValue", "=", "Tools", ".", "toHtml", "(", "value", ")", ";", "Parse", "valueParse", "=", "cells", ".", "more", ";", "valueParse", ".", "body", "=", "fValue", ";", "right", "(", "valueParse", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "exception", "(", "p", ",", "e", ")", ";", "}", "}", "private", "Config", "getConfig", "(", ")", "{", "if", "(", "config", "!=", "null", ")", "{", "return", "config", ";", "}", "if", "(", "super", ".", "args", "!=", "null", "&&", "super", ".", "args", ".", "length", ">", "0", ")", "{", "config", "=", "Config", ".", "getConfig", "(", "super", ".", "args", "[", "0", "]", ")", ";", "}", "else", "{", "config", "=", "Config", ".", "getConfig", "(", ")", ";", "}", "return", "config", ";", "}", "}", "</s>" ]
12,820
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertEquals", ";", "import", "org", ".", "junit", ".", "After", ";", "import", "org", ".", "junit", ".", "Before", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "Config", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "Variables", ";", "import", "fit", ".", "Parse", ";", "public", "class", "RestFixtureFitTest", "{", "private", "static", "final", "String", "BASE_URL", "=", "\"\"", ";", "private", "FitRestFixture", "fixture", ";", "private", "final", "Variables", "variables", "=", "new", "Variables", "(", ")", ";", "private", "Config", "config", ";", "private", "Parse", "emptyParse", ";", "@", "Before", "public", "void", "setUp", "(", ")", "{", "config", "=", "Config", ".", "getConfig", "(", ")", ";", "fixture", "=", "new", "FitRestFixture", "(", ")", "{", "{", "super", ".", "args", "=", "new", "String", "[", "]", "{", "BASE_URL", "}", ";", "}", "}", ";", "variables", ".", "clearAll", "(", ")", ";", "RestFixtureTestHelper", "helper", "=", "new", "RestFixtureTestHelper", "(", ")", ";", "emptyParse", "=", "helper", ".", "buildEmptyParse", "(", ")", ";", "}", "@", "After", "public", "void", "tearDown", "(", ")", "{", "config", ".", "clear", "(", ")", ";", "}", "@", "Test", "(", "expected", "=", "RuntimeException", ".", "class", ")", "public", "void", "mustNotifyCallerThatBaseUrlAsFixtureArgIsMandatory", "(", ")", "{", "fixture", "=", "new", "FitRestFixture", "(", ")", "{", "{", "super", ".", "args", "=", "new", "String", "[", "]", "{", "}", ";", "}", "}", ";", "fixture", ".", "doCells", "(", "emptyParse", ")", ";", "}", "@", "Test", "public", "void", "mustSetConfigNameToDefaultWhenNotSpecifiedAsSecondOptionalParameter_FIT", "(", ")", "{", "fixture", "=", "new", "FitRestFixture", "(", ")", "{", "{", "super", ".", "args", "=", "new", "String", "[", "]", "{", "BASE_URL", "}", ";", "}", "}", ";", "fixture", ".", "doCells", "(", "emptyParse", ")", ";", "assertEquals", "(", "Config", ".", "DEFAULT_CONFIG_NAME", ",", "fixture", ".", "getConfig", "(", ")", ".", "getName", "(", ")", ")", ";", "}", "@", "Test", "public", "void", "mustSetConfigNameToSpecifiedValueIfOptionalSecondParameterIsSpecified_FIT", "(", ")", "{", "fixture", "=", "new", "FitRestFixture", "(", ")", "{", "{", "super", ".", "args", "=", "new", "String", "[", "]", "{", "BASE_URL", ",", "\"configName\"", "}", ";", "}", "}", ";", "fixture", ".", "doCells", "(", "emptyParse", ")", ";", "assertEquals", "(", "\"configName\"", ",", "fixture", ".", "getConfig", "(", ")", ".", "getName", "(", ")", ")", ";", "}", "}", "</s>" ]
12,821
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertEquals", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "fail", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Arrays", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "junit", ".", "After", ";", "import", "org", ".", "junit", ".", "Before", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "Config", ";", "import", "fit", ".", "Parse", ";", "import", "fit", ".", "exception", ".", "FitParseException", ";", "public", "class", "RestFixtureConfigTest", "{", "private", "static", "final", "String", "CONFIG_NAME", "=", "\"configName\"", ";", "private", "Config", "namedConfig", ";", "private", "Config", "defaultNamedConfig", ";", "@", "Before", "public", "void", "setUp", "(", ")", "{", "defaultNamedConfig", "=", "Config", ".", "getConfig", "(", ")", ";", "namedConfig", "=", "Config", ".", "getConfig", "(", "CONFIG_NAME", ")", ";", "}", "@", "After", "public", "void", "tearDown", "(", ")", "{", "namedConfig", ".", "clear", "(", ")", ";", "defaultNamedConfig", ".", "clear", "(", ")", ";", "}", "@", "Test", "public", "void", "mustStoreDataInNamedConfigWhoseNameIsPassedAsFirstArgToTheFixture", "(", ")", "{", "RestFixtureConfig", "fixture", "=", "new", "RestFixtureConfig", "(", ")", "{", "{", "super", ".", "args", "=", "new", "String", "[", "]", "{", "CONFIG_NAME", "}", ";", "}", "}", ";", "testStoreDataInNamedFitConfig", "(", "fixture", ",", "namedConfig", ")", ";", "fixture", "=", "new", "RestFixtureConfig", "(", "CONFIG_NAME", ")", ";", "testStoreDataInNamedSlimConfig", "(", "fixture", ",", "namedConfig", ")", ";", "}", "@", "Test", "public", "void", "mustStoreDataInNamedConfigWhoseNameIsNotPassedHenceUsingDefault_FitVersion", "(", ")", "{", "RestFixtureConfig", "fixtureNoArg", "=", "new", "RestFixtureConfig", "(", ")", ";", "testStoreDataInNamedFitConfig", "(", "fixtureNoArg", ",", "defaultNamedConfig", ")", ";", "testStoreDataInNamedSlimConfig", "(", "fixtureNoArg", ",", "defaultNamedConfig", ")", ";", "}", "private", "void", "testStoreDataInNamedFitConfig", "(", "RestFixtureConfig", "fixture", ",", "final", "Config", "config", ")", "{", "String", "row1", "=", "createFitTestRow", "(", "\"key1\"", ",", "\"value1\"", ")", ";", "String", "row2", "=", "createFitTestRow", "(", "\"key2\"", ",", "\"value2\"", ")", ";", "String", "row3", "=", "createFitTestRow", "(", "\"keyEmpty\"", ",", "\"\"", ")", ";", "Parse", "table", "=", "createFitTestInstance", "(", "row1", ",", "row2", ",", "row3", ")", ";", "fixture", ".", "doRows", "(", "table", ")", ";", "assertEquals", "(", "\"value1\"", ",", "config", ".", "get", "(", "\"key1\"", ")", ")", ";", "assertEquals", "(", "\"value2\"", ",", "config", ".", "get", "(", "\"key2\"", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "config", ".", "get", "(", "\"keyEmpty\"", ")", ")", ";", "}", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "void", "testStoreDataInNamedSlimConfig", "(", "RestFixtureConfig", "fixture", ",", "final", "Config", "config", ")", "{", "List", "<", "String", ">", "row1", "=", "createSlimTestRow", "(", "\"key1\"", ",", "\"value1\"", ")", ";", "List", "<", "String", ">", "row2", "=", "createSlimTestRow", "(", "\"key2\"", ",", "\"value2\"", ")", ";", "List", "<", "String", ">", "row3", "=", "createSlimTestRow", "(", "\"keyEmpty\"", ",", "\"\"", ")", ";", "List", "<", "List", "<", "String", ">", ">", "table", "=", "createSlimTestInstance", "(", "row1", ",", "row2", ",", "row3", ")", ";", "fixture", ".", "doTable", "(", "table", ")", ";", "assertEquals", "(", "\"value1\"", ",", "config", ".", "get", "(", "\"key1\"", ")", ")", ";", "assertEquals", "(", "\"value2\"", ",", "config", ".", "get", "(", "\"key2\"", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "config", ".", "get", "(", "\"keyEmpty\"", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "table", ".", "get", "(", "0", ")", ".", "get", "(", "0", ")", ")", ";", "assertEquals", "(", "\"pass:value1\"", ",", "table", ".", "get", "(", "0", ")", ".", "get", "(", "1", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "table", ".", "get", "(", "1", ")", ".", "get", "(", "0", ")", ")", ";", "assertEquals", "(", "\"pass:value2\"", ",", "table", ".", "get", "(", "1", ")", ".", "get", "(", "1", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "table", ".", "get", "(", "2", ")", ".", "get", "(", "0", ")", ")", ";", "assertEquals", "(", "\"pass:\"", ",", "table", ".", "get", "(", "2", ")", ".", "get", "(", "1", ")", ")", ";", "}", "private", "List", "<", "String", ">", "createSlimTestRow", "(", "String", "...", "cells", ")", "{", "return", "Arrays", ".", "asList", "(", "cells", ")", ";", "}", "private", "List", "<", "List", "<", "String", ">", ">", "createSlimTestInstance", "(", "List", "<", "String", ">", "...", "rows", ")", "{", "List", "<", "List", "<", "String", ">", ">", "table", "=", "new", "ArrayList", "<", "List", "<", "String", ">", ">", "(", ")", ";", "for", "(", "List", "<", "String", ">", "row", ":", "rows", ")", "{", "table", ".", "add", "(", "row", ")", ";", "}", "return", "table", ";", "}", "private", "Parse", "createFitTestInstance", "(", "String", "...", "rows", ")", "{", "Parse", "t", "=", "null", ";", "StringBuffer", "rBuff", "=", "new", "StringBuffer", "(", ")", ";", "rBuff", ".", "append", "(", "\"<table>\"", ")", ";", "for", "(", "String", "r", ":", "rows", ")", "{", "rBuff", ".", "append", "(", "r", ")", ";", "}", "rBuff", ".", "append", "(", "\"</table>\"", ")", ";", "try", "{", "t", "=", "new", "Parse", "(", "rBuff", ".", "toString", "(", ")", ",", "new", "String", "[", "]", "{", "\"table\"", ",", "\"row\"", ",", "\"col\"", "}", ",", "1", ",", "0", ")", ";", "}", "catch", "(", "FitParseException", "e", ")", "{", "fail", "(", "\"\"", ")", ";", "}", "return", "t", ";", "}", "private", "String", "createFitTestRow", "(", "String", "cell1", ",", "String", "cell2", ")", "{", "String", "row", "=", "String", ".", "format", "(", "\"\"", ",", "cell1", ",", "cell2", ")", ";", "return", "row", ";", "}", "}", "</s>" ]
12,822
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ";", "import", "static", "org", ".", "mockito", ".", "Matchers", ".", "any", ";", "import", "static", "org", ".", "mockito", ".", "Matchers", ".", "isA", ";", "import", "static", "org", ".", "mockito", ".", "Mockito", ".", "mock", ";", "import", "static", "org", ".", "mockito", ".", "Mockito", ".", "when", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Arrays", ";", "import", "java", ".", "util", ".", "List", ";", "import", "smartrics", ".", "rest", ".", "client", ".", "RestClient", ";", "import", "smartrics", ".", "rest", ".", "client", ".", "RestRequest", ";", "import", "smartrics", ".", "rest", ".", "client", ".", "RestResponse", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "BodyTypeAdapter", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "CellFormatter", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "CellWrapper", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "Config", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "ContentType", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "RowWrapper", ";", "import", "fit", ".", "Parse", ";", "import", "fit", ".", "exception", ".", "FitParseException", ";", "public", "class", "RestFixtureTestHelper", "{", "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "public", "RowWrapper", "<", "?", ">", "createTestRow", "(", "String", "...", "cells", ")", "{", "RowWrapper", "<", "?", ">", "row", "=", "mock", "(", "RowWrapper", ".", "class", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "cells", ".", "length", ";", "i", "++", ")", "{", "CellWrapper", "cell", "=", "mock", "(", "CellWrapper", ".", "class", ")", ";", "when", "(", "cell", ".", "getWrapped", "(", ")", ")", ".", "thenReturn", "(", "cells", "[", "i", "]", ",", "cells", "[", "i", "]", ")", ";", "when", "(", "cell", ".", "text", "(", ")", ")", ".", "thenReturn", "(", "cells", "[", "i", "]", ",", "cells", "[", "i", "]", ")", ";", "when", "(", "cell", ".", "body", "(", ")", ")", ".", "thenReturn", "(", "cells", "[", "i", "]", ",", "cells", "[", "i", "]", ")", ";", "when", "(", "row", ".", "getCell", "(", "i", ")", ")", ".", "thenReturn", "(", "cell", ",", "cell", ")", ";", "}", "return", "row", ";", "}", "public", "Parse", "createSingleRowFitTable", "(", "String", "...", "cells", ")", "{", "Parse", "t", "=", "null", ";", "StringBuffer", "rBuff", "=", "new", "StringBuffer", "(", ")", ";", "rBuff", ".", "append", "(", "\"<table>\"", ")", ";", "rBuff", ".", "append", "(", "createFitRow", "(", "cells", ")", ")", ";", "rBuff", ".", "append", "(", "\"</table>\"", ")", ";", "try", "{", "t", "=", "new", "Parse", "(", "rBuff", ".", "toString", "(", ")", ")", ";", "}", "catch", "(", "FitParseException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "return", "t", ";", "}", "private", "String", "createFitRow", "(", "String", "...", "cells", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "buffer", ".", "append", "(", "\"<tr>\"", ")", ";", "for", "(", "String", "c", ":", "cells", ")", "{", "buffer", ".", "append", "(", "\"<td>\"", ")", ".", "append", "(", "c", ")", ".", "append", "(", "\"</td>\"", ")", ";", "}", "buffer", ".", "append", "(", "\"</tr>\"", ")", ";", "return", "buffer", ".", "toString", "(", ")", ";", "}", "public", "Parse", "buildEmptyParse", "(", ")", "{", "return", "createSingleRowFitTable", "(", "\"&nbsp;\"", ")", ";", "}", "public", "List", "<", "List", "<", "String", ">", ">", "createSingleRowSlimTable", "(", "String", "...", "cells", ")", "{", "List", "<", "List", "<", "String", ">", ">", "table", "=", "new", "ArrayList", "<", "List", "<", "String", ">", ">", "(", ")", ";", "table", ".", "add", "(", "Arrays", ".", "asList", "(", "cells", ")", ")", ";", "return", "table", ";", "}", "@", "SuppressWarnings", "(", "{", "\"unchecked\"", ",", "\"rawtypes\"", "}", ")", "public", "void", "wireMocks", "(", "Config", "conf", ",", "PartsFactory", "pf", ",", "RestClient", "rc", ",", "RestRequest", "req", ",", "RestResponse", "resp", ",", "CellFormatter", "cf", ",", "BodyTypeAdapter", "bta", ")", "{", "when", "(", "pf", ".", "buildRestClient", "(", "conf", ")", ")", ".", "thenReturn", "(", "rc", ")", ";", "when", "(", "pf", ".", "buildRestRequest", "(", ")", ")", ".", "thenReturn", "(", "req", ")", ";", "when", "(", "rc", ".", "execute", "(", "req", ")", ")", ".", "thenReturn", "(", "resp", ")", ";", "when", "(", "pf", ".", "buildCellFormatter", "(", "any", "(", "RestFixture", ".", "Runner", ".", "class", ")", ")", ")", ".", "thenReturn", "(", "cf", ")", ";", "when", "(", "pf", ".", "buildBodyTypeAdapter", "(", "isA", "(", "ContentType", ".", "class", ")", ",", "isA", "(", "String", ".", "class", ")", ")", ")", ".", "thenReturn", "(", "bta", ")", ";", "}", "}", "</s>" ]
12,823
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "equalTo", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "is", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertFalse", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertThat", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertTrue", ";", "import", "static", "org", ".", "mockito", ".", "Mockito", ".", "mock", ";", "import", "static", "org", ".", "mockito", ".", "Mockito", ".", "verify", ";", "import", "static", "org", ".", "mockito", ".", "Mockito", ".", "verifyNoMoreInteractions", ";", "import", "static", "org", ".", "mockito", ".", "Mockito", ".", "when", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "junit", ".", "Before", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "RestDataTypeAdapter", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "StringTypeAdapter", ";", "import", "fit", ".", "ActionFixture", ";", "import", "fit", ".", "Parse", ";", "import", "fit", ".", "exception", ".", "FitParseException", ";", "public", "class", "FitFormatterTest", "{", "private", "ActionFixture", "mockDelegate", "=", "null", ";", "private", "FitFormatter", "formatter", ";", "private", "Parse", "dummyParse", ";", "private", "RestFixtureTestHelper", "helper", ";", "@", "Before", "public", "void", "setUp", "(", ")", "throws", "FitParseException", "{", "mockDelegate", "=", "mock", "(", "ActionFixture", ".", "class", ")", ";", "helper", "=", "new", "RestFixtureTestHelper", "(", ")", ";", "formatter", "=", "new", "FitFormatter", "(", ")", ";", "formatter", ".", "setActionFixtureDelegate", "(", "mockDelegate", ")", ";", "formatter", ".", "setDisplayActual", "(", "false", ")", ";", "dummyParse", "=", "helper", ".", "createSingleRowFitTable", "(", "\"some\"", ",", "\"content\"", ")", ";", "dummyParse", ".", "body", "=", "\"somebody\"", ";", "}", "@", "Test", "public", "void", "delegatesCallToException", "(", ")", "{", "Throwable", "exception", "=", "new", "Throwable", "(", ")", ";", "formatter", ".", "exception", "(", "new", "FitCell", "(", "dummyParse", ")", ",", "exception", ")", ";", "verify", "(", "mockDelegate", ")", ".", "exception", "(", "dummyParse", ",", "exception", ")", ";", "verifyNoMoreInteractions", "(", "mockDelegate", ")", ";", "}", "@", "Test", "public", "void", "delegatesCallToCheck", "(", ")", "{", "StringTypeAdapter", "ta", "=", "new", "StringTypeAdapter", "(", ")", ";", "formatter", ".", "check", "(", "new", "FitCell", "(", "dummyParse", ")", ",", "ta", ")", ";", "verify", "(", "mockDelegate", ")", ".", "check", "(", "dummyParse", ",", "ta", ")", ";", "verifyNoMoreInteractions", "(", "mockDelegate", ")", ";", "}", "@", "Test", "public", "void", "fullyRendersWrong_noActualIfDisplayActualIsFalse_noErrorsDisplayedIfNone", "(", ")", "{", "formatter", ".", "setDisplayActual", "(", "false", ")", ";", "RestDataTypeAdapter", "typeAdapter", "=", "mock", "(", "RestDataTypeAdapter", ".", "class", ",", "\"typeAdapter\"", ")", ";", "when", "(", "typeAdapter", ".", "toString", "(", ")", ")", ".", "thenReturn", "(", "\"actual\"", ")", ";", "List", "<", "String", ">", "errors", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "when", "(", "typeAdapter", ".", "getErrors", "(", ")", ")", ".", "thenReturn", "(", "errors", ")", ";", "formatter", ".", "wrong", "(", "new", "FitCell", "(", "dummyParse", ")", ",", "typeAdapter", ")", ";", "verify", "(", "mockDelegate", ")", ".", "wrong", "(", "dummyParse", ")", ";", "verify", "(", "typeAdapter", ")", ".", "getErrors", "(", ")", ";", "assertTrue", "(", "\"\"", ",", "dummyParse", ".", "body", ".", "indexOf", "(", "\"somebody\"", ")", ">=", "0", ")", ";", "assertFalse", "(", "\"\"", ",", "dummyParse", ".", "body", ".", "indexOf", "(", "\"expected\"", ")", ">=", "0", ")", ";", "assertFalse", "(", "\"\"", ",", "dummyParse", ".", "body", ".", "indexOf", "(", "\"errors\"", ")", ">=", "0", ")", ";", "assertFalse", "(", "\"\"", ",", "dummyParse", ".", "body", ".", "indexOf", "(", "\"actual\"", ")", ">=", "0", ")", ";", "verifyNoMoreInteractions", "(", "mockDelegate", ")", ";", "verifyNoMoreInteractions", "(", "typeAdapter", ")", ";", "}", "@", "Test", "public", "void", "fullyRendersWrong_withActualIfDisplayActualIsTrue", "(", ")", "{", "formatter", ".", "setDisplayActual", "(", "true", ")", ";", "RestDataTypeAdapter", "typeAdapter", "=", "mock", "(", "RestDataTypeAdapter", ".", "class", ",", "\"typeAdapter\"", ")", ";", "when", "(", "typeAdapter", ".", "toString", "(", ")", ")", ".", "thenReturn", "(", "\"the_content\"", ")", ";", "List", "<", "String", ">", "errors", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "when", "(", "typeAdapter", ".", "getErrors", "(", ")", ")", ".", "thenReturn", "(", "errors", ")", ";", "formatter", ".", "wrong", "(", "new", "FitCell", "(", "dummyParse", ")", ",", "typeAdapter", ")", ";", "verify", "(", "mockDelegate", ")", ".", "wrong", "(", "dummyParse", ")", ";", "verify", "(", "typeAdapter", ")", ".", "getErrors", "(", ")", ";", "assertTrue", "(", "\"\"", ",", "dummyParse", ".", "body", ".", "indexOf", "(", "\"somebody\"", ")", ">=", "0", ")", ";", "assertTrue", "(", "\"\"", ",", "dummyParse", ".", "body", ".", "indexOf", "(", "\"expected\"", ")", ">=", "0", ")", ";", "assertFalse", "(", "\"\"", ",", "dummyParse", ".", "body", ".", "indexOf", "(", "\"errors\"", ")", ">=", "0", ")", ";", "assertTrue", "(", "\"\"", ",", "dummyParse", ".", "body", ".", "indexOf", "(", "\"actual\"", ")", ">=", "0", ")", ";", "assertTrue", "(", "\"\"", ",", "dummyParse", ".", "body", ".", "indexOf", "(", "\"the_content\"", ")", ">=", "0", ")", ";", "verifyNoMoreInteractions", "(", "mockDelegate", ")", ";", "verifyNoMoreInteractions", "(", "typeAdapter", ")", ";", "}", "@", "Test", "public", "void", "fullyRendersRight_withActualIfDisplayActualIsTrue", "(", ")", "{", "formatter", ".", "setDisplayActual", "(", "true", ")", ";", "RestDataTypeAdapter", "typeAdapter", "=", "mock", "(", "RestDataTypeAdapter", ".", "class", ",", "\"typeAdapter\"", ")", ";", "when", "(", "typeAdapter", ".", "toString", "(", ")", ")", ".", "thenReturn", "(", "\"the_content\"", ")", ";", "formatter", ".", "right", "(", "new", "FitCell", "(", "dummyParse", ")", ",", "typeAdapter", ")", ";", "verify", "(", "mockDelegate", ")", ".", "right", "(", "dummyParse", ")", ";", "assertTrue", "(", "\"\"", ",", "dummyParse", ".", "body", ".", "indexOf", "(", "\"somebody\"", ")", ">=", "0", ")", ";", "assertTrue", "(", "\"\"", ",", "dummyParse", ".", "body", ".", "indexOf", "(", "\"expected\"", ")", ">=", "0", ")", ";", "assertTrue", "(", "\"\"", ",", "dummyParse", ".", "body", ".", "indexOf", "(", "\"actual\"", ")", ">=", "0", ")", ";", "assertTrue", "(", "\"\"", ",", "dummyParse", ".", "body", ".", "indexOf", "(", "\"the_content\"", ")", ">=", "0", ")", ";", "verifyNoMoreInteractions", "(", "mockDelegate", ")", ";", "verifyNoMoreInteractions", "(", "typeAdapter", ")", ";", "}", "@", "Test", "public", "void", "fullyRendersRight_noActualIfDisplayActualIsFalse", "(", ")", "{", "formatter", ".", "setDisplayActual", "(", "false", ")", ";", "RestDataTypeAdapter", "typeAdapter", "=", "mock", "(", "RestDataTypeAdapter", ".", "class", ",", "\"typeAdapter\"", ")", ";", "when", "(", "typeAdapter", ".", "toString", "(", ")", ")", ".", "thenReturn", "(", "\"the_content\"", ")", ";", "formatter", ".", "right", "(", "new", "FitCell", "(", "dummyParse", ")", ",", "typeAdapter", ")", ";", "verify", "(", "mockDelegate", ")", ".", "right", "(", "dummyParse", ")", ";", "assertTrue", "(", "\"\"", ",", "dummyParse", ".", "body", ".", "indexOf", "(", "\"somebody\"", ")", ">=", "0", ")", ";", "assertFalse", "(", "\"\"", ",", "dummyParse", ".", "body", ".", "indexOf", "(", "\"expected\"", ")", ">=", "0", ")", ";", "assertFalse", "(", "\"\"", ",", "dummyParse", ".", "body", ".", "indexOf", "(", "\"actual\"", ")", ">=", "0", ")", ";", "assertFalse", "(", "\"\"", ",", "dummyParse", ".", "body", ".", "indexOf", "(", "\"the_content\"", ")", ">=", "0", ")", ";", "verifyNoMoreInteractions", "(", "mockDelegate", ")", ";", "verifyNoMoreInteractions", "(", "typeAdapter", ")", ";", "}", "@", "Test", "public", "void", "fullyRendersWrong_noActualIfDisplayActualIsFalse_errorsDisplayedIfAny", "(", ")", "{", "formatter", ".", "setDisplayActual", "(", "false", ")", ";", "RestDataTypeAdapter", "typeAdapter", "=", "mock", "(", "RestDataTypeAdapter", ".", "class", ",", "\"typeAdapter\"", ")", ";", "when", "(", "typeAdapter", ".", "toString", "(", ")", ")", ".", "thenReturn", "(", "\"actual\"", ")", ";", "List", "<", "String", ">", "errors", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "errors", ".", "add", "(", "\"err1\"", ")", ";", "when", "(", "typeAdapter", ".", "getErrors", "(", ")", ")", ".", "thenReturn", "(", "errors", ")", ";", "formatter", ".", "wrong", "(", "new", "FitCell", "(", "dummyParse", ")", ",", "typeAdapter", ")", ";", "verify", "(", "mockDelegate", ")", ".", "wrong", "(", "dummyParse", ")", ";", "verify", "(", "typeAdapter", ")", ".", "getErrors", "(", ")", ";", "assertTrue", "(", "\"\"", ",", "dummyParse", ".", "body", ".", "indexOf", "(", "\"somebody\"", ")", ">=", "0", ")", ";", "assertFalse", "(", "\"\"", ",", "dummyParse", ".", "body", ".", "indexOf", "(", "\"expected\"", ")", ">=", "0", ")", ";", "assertTrue", "(", "\"\"", ",", "dummyParse", ".", "body", ".", "indexOf", "(", "\"err1\"", ")", ">=", "0", ")", ";", "assertTrue", "(", "\"\"", ",", "dummyParse", ".", "body", ".", "indexOf", "(", "\"errors\"", ")", ">=", "0", ")", ";", "assertFalse", "(", "\"\"", ",", "dummyParse", ".", "body", ".", "indexOf", "(", "\"actual\"", ")", ">=", "0", ")", ";", "verifyNoMoreInteractions", "(", "mockDelegate", ")", ";", "verifyNoMoreInteractions", "(", "typeAdapter", ")", ";", "}", "@", "Test", "public", "void", "rendersTextAsHtmlLink", "(", ")", "{", "FitCell", "cell", "=", "new", "FitCell", "(", "dummyParse", ")", ";", "formatter", ".", "asLink", "(", "cell", ",", "\"\"", ",", "\"linked\"", ")", ";", "assertThat", "(", "cell", ".", "body", "(", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "fromRawIsSimplyABypassAsAllHandlingIsDoneByTheParse", "(", ")", "{", "assertThat", "(", "formatter", ".", "fromRaw", "(", "\"a\"", ")", ",", "is", "(", "equalTo", "(", "\"a\"", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "greyCellAreSpansWithAnAssignedClass", "(", ")", "{", "assertThat", "(", "formatter", ".", "gray", "(", "\"area\"", ")", ".", "trim", "(", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "}", "}", "</s>" ]
12,824
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "equalTo", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "is", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertThat", ";", "import", "java", ".", "io", ".", "ByteArrayOutputStream", ";", "import", "java", ".", "io", ".", "PrintStream", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "StringTypeAdapter", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "TextBodyTypeAdapter", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "Tools", ";", "public", "class", "SlimFormatterTest", "{", "@", "Test", "public", "void", "shouldDisplayGrayedActualOnCheckIfNoExpectedIsSpecified", "(", ")", "{", "SlimCell", "c", "=", "new", "SlimCell", "(", "\"\"", ")", ";", "SlimFormatter", "formatter", "=", "new", "SlimFormatter", "(", ")", ";", "StringTypeAdapter", "actual", "=", "new", "StringTypeAdapter", "(", ")", ";", "actual", ".", "set", "(", "\"2\"", ")", ";", "formatter", ".", "check", "(", "c", ",", "actual", ")", ";", "assertThat", "(", "c", ".", "body", "(", ")", ",", "is", "(", "equalTo", "(", "\"report:2\"", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldDisplayNothingOnCheckIfNoExpectedIsSpecifiedAndActualIsNullOrEmpty", "(", ")", "{", "SlimCell", "c", "=", "new", "SlimCell", "(", "\"\"", ")", ";", "SlimFormatter", "formatter", "=", "new", "SlimFormatter", "(", ")", ";", "StringTypeAdapter", "actual", "=", "new", "StringTypeAdapter", "(", ")", ";", "formatter", ".", "check", "(", "c", ",", "actual", ")", ";", "assertThat", "(", "c", ".", "body", "(", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "actual", ".", "set", "(", "\"\"", ")", ";", "assertThat", "(", "c", ".", "body", "(", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldDisplayPassOnCheckIfExpectedAndActualMatch", "(", ")", "{", "SlimCell", "c", "=", "new", "SlimCell", "(", "\"abc123\"", ")", ";", "SlimFormatter", "formatter", "=", "new", "SlimFormatter", "(", ")", ";", "StringTypeAdapter", "actual", "=", "new", "StringTypeAdapter", "(", ")", ";", "actual", ".", "set", "(", "\"abc123\"", ")", ";", "formatter", ".", "check", "(", "c", ",", "actual", ")", ";", "assertThat", "(", "c", ".", "body", "(", ")", ",", "is", "(", "equalTo", "(", "\"pass:abc123\"", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldDisplayPassOnCheckIfExpectedAndActualMatch_whenDisplayingActual", "(", ")", "{", "SlimCell", "c", "=", "new", "SlimCell", "(", "\"\"", ")", ";", "SlimFormatter", "formatter", "=", "new", "SlimFormatter", "(", ")", ";", "formatter", ".", "setDisplayActual", "(", "true", ")", ";", "StringTypeAdapter", "actual", "=", "new", "StringTypeAdapter", "(", ")", "{", "@", "Override", "public", "boolean", "equals", "(", "Object", "a", ",", "Object", "b", ")", "{", "return", "true", ";", "}", "}", ";", "actual", ".", "set", "(", "\"abc123\"", ")", ";", "formatter", ".", "check", "(", "c", ",", "actual", ")", ";", "assertThat", "(", "c", ".", "body", "(", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldDisplayFailOnCheckIfExpectedAndActualMatch_whenNotDisplayingActual", "(", ")", "{", "SlimCell", "c", "=", "new", "SlimCell", "(", "\"abc123\"", ")", ";", "SlimFormatter", "formatter", "=", "new", "SlimFormatter", "(", ")", ";", "formatter", ".", "setDisplayActual", "(", "false", ")", ";", "StringTypeAdapter", "actual", "=", "new", "StringTypeAdapter", "(", ")", ";", "actual", ".", "set", "(", "\"def345\"", ")", ";", "formatter", ".", "check", "(", "c", ",", "actual", ")", ";", "assertThat", "(", "c", ".", "body", "(", ")", ",", "is", "(", "equalTo", "(", "\"fail:abc123\"", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldDisplayFailOnCheckIfExpectedAndActualMatch_whenDisplayingActual", "(", ")", "{", "SlimCell", "c", "=", "new", "SlimCell", "(", "\"abc123\"", ")", ";", "SlimFormatter", "formatter", "=", "new", "SlimFormatter", "(", ")", ";", "formatter", ".", "setDisplayActual", "(", "true", ")", ";", "StringTypeAdapter", "actual", "=", "new", "StringTypeAdapter", "(", ")", ";", "actual", ".", "set", "(", "\"def345\"", ")", ";", "formatter", ".", "check", "(", "c", ",", "actual", ")", ";", "assertThat", "(", "c", ".", "body", "(", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldDisplayXmlDataInActual", "(", ")", "{", "SlimCell", "c", "=", "new", "SlimCell", "(", "\"<xml", "/>\"", ")", ";", "SlimFormatter", "formatter", "=", "new", "SlimFormatter", "(", ")", ";", "formatter", ".", "setDisplayActual", "(", "true", ")", ";", "TextBodyTypeAdapter", "actual", "=", "new", "TextBodyTypeAdapter", "(", ")", ";", "actual", ".", "set", "(", "\"<xml", "/>\"", ")", ";", "formatter", ".", "check", "(", "c", ",", "actual", ")", ";", "assertThat", "(", "c", ".", "body", "(", ")", ",", "is", "(", "equalTo", "(", "Tools", ".", "toHtml", "(", "\"pass:<xml", "/>\"", ")", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldRenderLinksAsGreyed", "(", ")", "{", "SlimFormatter", "formatter", "=", "new", "SlimFormatter", "(", ")", ";", "SlimCell", "c", "=", "new", "SlimCell", "(", "\"abc123\"", ")", ";", "formatter", ".", "asLink", "(", "c", ",", "\"\"", ",", "\"text\"", ")", ";", "assertThat", "(", "c", ".", "body", "(", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldRenderExceptionsAsSlimErrorCellWithStackTracesInCode", "(", ")", "{", "SlimFormatter", "formatter", "=", "new", "SlimFormatter", "(", ")", ";", "Throwable", "t", "=", "new", "Throwable", "(", ")", ";", "SlimCell", "c", "=", "new", "SlimCell", "(", "\"abc123\"", ")", ";", "ByteArrayOutputStream", "bais", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "PrintStream", "ps", "=", "new", "PrintStream", "(", "bais", ")", ";", "t", ".", "printStackTrace", "(", "ps", ")", ";", "String", "trace", "=", "Tools", ".", "toHtml", "(", "new", "String", "(", "bais", ".", "toByteArray", "(", ")", ")", ")", ";", "formatter", ".", "exception", "(", "c", ",", "t", ")", ";", "assertThat", "(", "c", ".", "body", "(", ")", ".", "startsWith", "(", "\"error:\"", ")", ",", "is", "(", "true", ")", ")", ";", "assertThat", "(", "c", ".", "body", "(", ")", ".", "contains", "(", "\"<code>\"", ")", ",", "is", "(", "true", ")", ")", ";", "assertThat", "(", "c", ".", "body", "(", ")", ".", "contains", "(", "\"</code>\"", ")", ",", "is", "(", "true", ")", ")", ";", "assertThat", "(", "c", ".", "body", "(", ")", ".", "contains", "(", "trace", ")", ",", "is", "(", "true", ")", ")", ";", "}", "}", "</s>" ]
12,825
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "equalTo", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "is", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertEquals", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertThat", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "junit", ".", "After", ";", "import", "org", ".", "junit", ".", "Before", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "Config", ";", "public", "class", "RestFixtureSlimFitTest", "{", "private", "static", "final", "String", "BASE_URL", "=", "\"\"", ";", "private", "RestFixture", "fixture", ";", "private", "Config", "config", ";", "private", "RestFixtureTestHelper", "helper", "=", "new", "RestFixtureTestHelper", "(", ")", ";", "@", "Before", "public", "void", "setUp", "(", ")", "{", "config", "=", "Config", ".", "getConfig", "(", ")", ";", "fixture", "=", "new", "RestFixture", "(", "BASE_URL", ")", ";", "}", "@", "After", "public", "void", "tearDown", "(", ")", "{", "config", ".", "clear", "(", ")", ";", "}", "@", "Test", "public", "void", "mustSetConfigNameToDefaultWhenNotSpecifiedAsSecondOptionalParameter_SLIM", "(", ")", "{", "fixture", "=", "new", "RestFixture", "(", "BASE_URL", ",", "\"configName\"", ")", ";", "assertEquals", "(", "\"configName\"", ",", "fixture", ".", "getConfig", "(", ")", ".", "getName", "(", ")", ")", ";", "}", "@", "Test", "public", "void", "mustSetConfigNameToSpecifiedValueIfOptionalSecondParameterIsSpecified_SLIM", "(", ")", "{", "fixture", "=", "new", "RestFixture", "(", "BASE_URL", ",", "\"configName\"", ")", ";", "assertThat", "(", "fixture", ".", "getConfig", "(", ")", ".", "getName", "(", ")", ",", "is", "(", "equalTo", "(", "\"configName\"", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "mustLeaveCellsForSetXMethodsIgnored", "(", ")", "{", "List", "<", "List", "<", "String", ">", ">", "table", "=", "helper", ".", "createSingleRowSlimTable", "(", "\"setBody\"", ",", "\"\"", ")", ";", "List", "<", "List", "<", "String", ">", ">", "result", "=", "fixture", ".", "doTable", "(", "table", ")", ";", "assertThat", "(", "result", ".", "get", "(", "0", ")", ".", "get", "(", "0", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "assertThat", "(", "result", ".", "get", "(", "0", ")", ".", "get", "(", "1", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "}", "}", "</s>" ]
12,826
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertNull", ";", "import", "org", ".", "junit", ".", "Before", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "smartrics", ".", "rest", ".", "client", ".", "RestResponse", ";", "public", "class", "LetBodyJsHandlerTest", "{", "private", "Variables", "variables", ";", "@", "Before", "public", "void", "setUp", "(", ")", "{", "variables", "=", "new", "Variables", "(", ")", ";", "variables", ".", "clearAll", "(", ")", ";", "}", "@", "Test", "public", "void", "shouldHandleExpressionsReturningNull", "(", ")", "{", "LetBodyJsHandler", "h", "=", "new", "LetBodyJsHandler", "(", ")", ";", "String", "r", "=", "h", ".", "handle", "(", "new", "RestResponse", "(", ")", ",", "null", ",", "\"null\"", ")", ";", "assertNull", "(", "r", ")", ";", "}", "}", "</s>" ]
12,827
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertEquals", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertFalse", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertTrue", ";", "import", "org", ".", "junit", ".", "Test", ";", "public", "class", "StatusCodeTypeAdapterTest", "{", "private", "StatusCodeTypeAdapter", "adapter", "=", "new", "StatusCodeTypeAdapter", "(", ")", ";", "@", "Test", "public", "void", "shouldParseStatusCodesAsTrimmedStrings", "(", ")", "{", "assertEquals", "(", "\"100\"", ",", "(", "String", ")", "adapter", ".", "parse", "(", "\"", "100", "\"", ")", ")", ";", "assertEquals", "(", "\"null\"", ",", "(", "String", ")", "adapter", ".", "parse", "(", "null", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldRenderCellContentAsStrings", "(", ")", "{", "assertEquals", "(", "\"200\"", ",", "adapter", ".", "toString", "(", "\"200\"", ")", ")", ";", "assertEquals", "(", "\"blank\"", ",", "adapter", ".", "toString", "(", "\"", "\"", ")", ")", ";", "assertEquals", "(", "\"null\"", ",", "adapter", ".", "toString", "(", "null", ")", ")", ";", "}", "@", "Test", "public", "void", "expectedShouldBeTreatedAsRegularExpression", "(", ")", "{", "assertTrue", "(", "\"\"", ",", "adapter", ".", "equals", "(", "\"20\\\\d\"", ",", "\"201\"", ")", ")", ";", "assertTrue", "(", "\"\"", ",", "adapter", ".", "equals", "(", "\"20\\\\d\"", ",", "\"202\"", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldNotEqualiseIfExpectedOrActualAreNull", "(", ")", "{", "assertFalse", "(", "adapter", ".", "equals", "(", "null", ",", "\"201\"", ")", ")", ";", "assertFalse", "(", "adapter", ".", "equals", "(", "\"20\\\\d\"", ",", "null", ")", ")", ";", "}", "@", "Test", "public", "void", "whenExpectedIsNotMatchedAnErrorShouldBeAdded", "(", ")", "{", "adapter", ".", "equals", "(", "\"20\\\\d\"", ",", "\"404\"", ")", ";", "assertEquals", "(", "1", ",", "adapter", ".", "getErrors", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "adapter", ".", "getErrors", "(", ")", ".", "get", "(", "0", ")", ")", ";", "}", "}", "</s>" ]
12,828
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "http", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "equalTo", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "instanceOf", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "is", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertThat", ";", "import", "org", ".", "apache", ".", "commons", ".", "httpclient", ".", "HttpURL", ";", "import", "org", ".", "junit", ".", "Test", ";", "public", "class", "DeleteMethodTest", "{", "@", "Test", "public", "void", "buildsUriThatAllowSquareBracketsInQueryString", "(", ")", "throws", "Exception", "{", "DeleteMethod", "m", "=", "new", "DeleteMethod", "(", ")", ";", "m", ".", "setURI", "(", "new", "HttpURL", "(", "\"\"", ")", ")", ";", "assertThat", "(", "m", ".", "getURI", "(", ")", ",", "is", "(", "instanceOf", "(", "HttpURL", ".", "class", ")", ")", ")", ";", "assertThat", "(", "m", ".", "getURI", "(", ")", ".", "getQuery", "(", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "}", "}", "</s>" ]
12,829
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "http", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "equalTo", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "instanceOf", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "is", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertThat", ";", "import", "org", ".", "apache", ".", "commons", ".", "httpclient", ".", "HttpURL", ";", "import", "org", ".", "junit", ".", "Test", ";", "public", "class", "GetMethodTest", "{", "@", "Test", "public", "void", "buildsUriThatAllowSquareBracketsInQueryString", "(", ")", "throws", "Exception", "{", "GetMethod", "m", "=", "new", "GetMethod", "(", ")", ";", "m", ".", "setURI", "(", "new", "HttpURL", "(", "\"\"", ")", ")", ";", "assertThat", "(", "m", ".", "getURI", "(", ")", ",", "is", "(", "instanceOf", "(", "HttpURL", ".", "class", ")", ")", ")", ";", "assertThat", "(", "m", ".", "getURI", "(", ")", ".", "getQuery", "(", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "}", "}", "</s>" ]
12,830
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "http", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "equalTo", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "instanceOf", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "is", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertThat", ";", "import", "org", ".", "apache", ".", "commons", ".", "httpclient", ".", "HttpURL", ";", "import", "org", ".", "junit", ".", "Test", ";", "public", "class", "PostMethodTest", "{", "@", "Test", "public", "void", "buildsUriThatAllowSquareBracketsInQueryString", "(", ")", "throws", "Exception", "{", "PostMethod", "m", "=", "new", "PostMethod", "(", ")", ";", "m", ".", "setURI", "(", "new", "HttpURL", "(", "\"\"", ")", ")", ";", "assertThat", "(", "m", ".", "getURI", "(", ")", ",", "is", "(", "instanceOf", "(", "HttpURL", ".", "class", ")", ")", ")", ";", "assertThat", "(", "m", ".", "getURI", "(", ")", ".", "getQuery", "(", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "}", "}", "</s>" ]
12,831
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "http", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "equalTo", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "instanceOf", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "is", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertThat", ";", "import", "org", ".", "apache", ".", "commons", ".", "httpclient", ".", "HttpURL", ";", "import", "org", ".", "junit", ".", "Test", ";", "public", "class", "PutMethodTest", "{", "@", "Test", "public", "void", "buildsUriThatAllowSquareBracketsInQueryString", "(", ")", "throws", "Exception", "{", "PutMethod", "m", "=", "new", "PutMethod", "(", ")", ";", "m", ".", "setURI", "(", "new", "HttpURL", "(", "\"\"", ")", ")", ";", "assertThat", "(", "m", ".", "getURI", "(", ")", ",", "is", "(", "instanceOf", "(", "HttpURL", ".", "class", ")", ")", ")", ";", "assertThat", "(", "m", ".", "getURI", "(", ")", ".", "getQuery", "(", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "}", "}", "</s>" ]
12,832
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "equalTo", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "is", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertEquals", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertFalse", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertNull", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertThat", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertTrue", ";", "import", "static", "org", ".", "mockito", ".", "Mockito", ".", "mock", ";", "import", "static", "org", ".", "mockito", ".", "Mockito", ".", "when", ";", "import", "java", ".", "io", ".", "ByteArrayInputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "InputStream", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "javax", ".", "xml", ".", "xpath", ".", "XPathConstants", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "org", ".", "w3c", ".", "dom", ".", "NodeList", ";", "public", "class", "ToolsTest", "{", "private", "static", "Map", "<", "String", ",", "String", ">", "DEF_NS_CONTEXT", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "@", "Test", "public", "void", "mustMatchWhenRegexIsValidAndThereIsAMatch", "(", ")", "{", "assertTrue", "(", "Tools", ".", "regex", "(", "\"200\"", ",", "\"200\"", ")", ")", ";", "}", "@", "Test", "public", "void", "mustNotMatchWhenRegexIsValidAndThereIsNotAMatch", "(", ")", "{", "assertFalse", "(", "Tools", ".", "regex", "(", "\"200\"", ",", "\"404\"", ")", ")", ";", "}", "@", "Test", "(", "expected", "=", "IllegalArgumentException", ".", "class", ")", "public", "void", "mustNotMatchWhenRegexIsInvalidAndNotifyError", "(", ")", "{", "Tools", ".", "regex", "(", "\"200\"", ",", "\"40[]4\"", ")", ";", "}", "@", "Test", "public", "void", "dualityOfToAndFromHtml", "(", ")", "{", "String", "stuff", "=", "\"<a>", "n", "</a>\"", ";", "assertEquals", "(", "stuff", ",", "Tools", ".", "fromHtml", "(", "Tools", ".", "toHtml", "(", "stuff", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldReadAnInputStreamToAString", "(", ")", "{", "InputStream", "is", "=", "new", "ByteArrayInputStream", "(", "\"a", "string\"", ".", "getBytes", "(", ")", ")", ";", "assertEquals", "(", "\"a", "string\"", ",", "Tools", ".", "getStringFromInputStream", "(", "is", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "Tools", ".", "getStringFromInputStream", "(", "null", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldThrowRTEWrappingInputStreamExceptionsWhenReadingInputStreamToAString", "(", ")", "throws", "Exception", "{", "InputStream", "is", "=", "mock", "(", "InputStream", ".", "class", ")", ";", "when", "(", "is", ".", "read", "(", ")", ")", ".", "thenThrow", "(", "new", "IOException", "(", "\"io", "error\"", ")", ")", ";", "try", "{", "Tools", ".", "getStringFromInputStream", "(", "is", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "assertEquals", "(", "\"\"", ",", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "@", "Test", "public", "void", "shouldThrowWhenReadingInputStreamToAStringWhenTryingToEncodeWithUnknownEncoding", "(", ")", "throws", "Exception", "{", "String", "encoding", "=", "\"==========\"", ";", "InputStream", "is", "=", "mock", "(", "InputStream", ".", "class", ")", ";", "try", "{", "Tools", ".", "getStringFromInputStream", "(", "is", ",", "encoding", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "assertEquals", "(", "\"\"", "+", "encoding", ",", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "@", "Test", "public", "void", "shouldWrapAStringIntoAnInputStream", "(", ")", "{", "InputStream", "is", "=", "Tools", ".", "getInputStreamFromString", "(", "\"\"", ",", "\"UTF-8\"", ")", ";", "assertEquals", "(", "\"\"", ",", "Tools", ".", "getStringFromInputStream", "(", "is", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldThrowRTEWhenWrappingAStringIntoAnInputStreamWithUnknownEncoding", "(", ")", "{", "try", "{", "Tools", ".", "getInputStreamFromString", "(", "\"\"", ",", "\"crap\"", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "assertEquals", "(", "\"\"", ",", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "@", "Test", "public", "void", "shouldConvertAMapIntoAStringRepresentation", "(", ")", "{", "final", "Map", "<", "String", ",", "String", ">", "map", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "map", ".", "put", "(", "\"k1\"", ",", "\"v1\"", ")", ";", "map", ".", "put", "(", "\"k2\"", ",", "\"v2\"", ")", ";", "final", "String", "nvSep", "=", "\"|\"", ";", "final", "String", "entrySep", "=", "\"##\"", ";", "String", "repr", "=", "Tools", ".", "convertMapToString", "(", "map", ",", "nvSep", ",", "entrySep", ")", ";", "assertEquals", "(", "\"k1|v1##k2|v2\"", ",", "repr", ")", ";", "}", "@", "Test", "public", "void", "shouldConvertAStringIntoAMap", "(", ")", "{", "Map", "<", "String", ",", "String", ">", "map", "=", "Tools", ".", "convertStringToMap", "(", "\"k1~v1##k2~v2\"", ",", "\"~\"", ",", "\"##\"", ",", "false", ")", ";", "assertEquals", "(", "2", ",", "map", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"v2\"", ",", "map", ".", "get", "(", "\"k2\"", ")", ")", ";", "assertEquals", "(", "\"v1\"", ",", "map", ".", "get", "(", "\"k1\"", ")", ")", ";", "map", "=", "Tools", ".", "convertStringToMap", "(", "\"k1##k2~v2\"", ",", "\"~\"", ",", "\"##\"", ",", "false", ")", ";", "assertEquals", "(", "2", ",", "map", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "map", ".", "get", "(", "\"k1\"", ")", ")", ";", "assertEquals", "(", "\"v2\"", ",", "map", ".", "get", "(", "\"k2\"", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldConvertAStringIntoAMapAndCleanHtmlTagsFromValues", "(", ")", "{", "Map", "<", "String", ",", "String", ">", "map", "=", "Tools", ".", "convertStringToMap", "(", "\"\"", ",", "\"=\"", ",", "\"n\"", ",", "true", ")", ";", "assertEquals", "(", "2", ",", "map", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"v1\"", ",", "map", ".", "get", "(", "\"k1\"", ")", ")", ";", "assertEquals", "(", "\"v2\"", ",", "map", ".", "get", "(", "\"k2\"", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldConvertAMultilineStringIntoAMap", "(", ")", "{", "Map", "<", "String", ",", "String", ">", "map", "=", "Tools", ".", "convertStringToMap", "(", "\"\"", ",", "\"=\"", ",", "\"n\"", ",", "false", ")", ";", "assertEquals", "(", "2", ",", "map", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"v2\"", ",", "map", ".", "get", "(", "\"k2\"", ")", ")", ";", "assertEquals", "(", "\"v1\"", ",", "map", ".", "get", "(", "\"k1\"", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldConvertAMultilineStringIntoAMapWhenEscapeSequenceIsNested", "(", ")", "{", "Map", "<", "String", ",", "String", ">", "map", "=", "Tools", ".", "convertStringToMap", "(", "\"\"", ",", "\"=\"", ",", "\"n\"", ",", "false", ")", ";", "assertEquals", "(", "2", ",", "map", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"v2\"", ",", "map", ".", "get", "(", "\"k2\"", ")", ")", ";", "assertEquals", "(", "\"v1\"", ",", "map", ".", "get", "(", "\"k1\"", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldConvertAMultilineStringIntoAMapIgnoresEmptyLines", "(", ")", "{", "Map", "<", "String", ",", "String", ">", "map", "=", "Tools", ".", "convertStringToMap", "(", "\"\"", ",", "\"=\"", ",", "\"n\"", ",", "false", ")", ";", "assertEquals", "(", "2", ",", "map", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"v2\"", ",", "map", ".", "get", "(", "\"k2\"", ")", ")", ";", "assertEquals", "(", "\"v1\"", ",", "map", ".", "get", "(", "\"k1\"", ")", ")", ";", "assertNull", "(", "map", ".", "get", "(", "\"\"", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldExtractXPathsFromXmlDocumentAsNodeLists", "(", ")", "{", "String", "xml", "=", "\"\"", ";", "assertEquals", "(", "1", ",", "Tools", ".", "extractXPath", "(", "DEF_NS_CONTEXT", ",", "\"/\"", ",", "xml", ")", ".", "getLength", "(", ")", ")", ";", "assertEquals", "(", "2", ",", "Tools", ".", "extractXPath", "(", "DEF_NS_CONTEXT", ",", "\"/a/c\"", ",", "xml", ")", ".", "getLength", "(", ")", ")", ";", "assertEquals", "(", "1", ",", "Tools", ".", "extractXPath", "(", "DEF_NS_CONTEXT", ",", "\"\"", ",", "xml", ")", ".", "getLength", "(", ")", ")", ";", "assertEquals", "(", "\"test\"", ",", "Tools", ".", "extractXPath", "(", "DEF_NS_CONTEXT", ",", "\"/a/b/text()\"", ",", "xml", ")", ".", "item", "(", "0", ")", ".", "getNodeValue", "(", ")", ")", ";", "assertEquals", "(", "1", ",", "Tools", ".", "extractXPath", "(", "DEF_NS_CONTEXT", ",", "\"\"", ",", "xml", ")", ".", "getLength", "(", ")", ")", ";", "assertEquals", "(", "3", ",", "Tools", ".", "extractXPath", "(", "DEF_NS_CONTEXT", ",", "\"\"", ",", "xml", ")", ".", "getLength", "(", ")", ")", ";", "assertEquals", "(", "3", ",", "Tools", ".", "extractXPath", "(", "DEF_NS_CONTEXT", ",", "\"\"", ",", "xml", ")", ".", "getLength", "(", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldExtractXPathsFromXmlDocumentAsStrings", "(", ")", "{", "String", "xml", "=", "\"\"", ";", "assertEquals", "(", "\"1\"", ",", "Tools", ".", "extractXPath", "(", "\"count(/)\"", ",", "xml", ",", "XPathConstants", ".", "STRING", ",", "\"UTF-8\"", ")", ")", ";", "assertEquals", "(", "\"2\"", ",", "Tools", ".", "extractXPath", "(", "\"count(/a/c)\"", ",", "xml", ",", "XPathConstants", ".", "STRING", ",", "\"UTF-8\"", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldExtractXPathsFromXmlDocumentAsNumber", "(", ")", "{", "String", "xml", "=", "\"\"", ";", "assertEquals", "(", "1.0", ",", "Tools", ".", "extractXPath", "(", "\"count(/a/b)\"", ",", "xml", ",", "XPathConstants", ".", "NUMBER", ",", "\"UTF-8\"", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldExtractXPathsFromXmlDocumentAsBoolean", "(", ")", "{", "String", "xml", "=", "\"\"", ";", "assertEquals", "(", "Boolean", ".", "TRUE", ",", "Tools", ".", "extractXPath", "(", "\"\"", ",", "xml", ",", "XPathConstants", ".", "BOOLEAN", ",", "\"UTF-8\"", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldExtractXPathsFromXmlDocumentAsNumberWithDefaultNamespace", "(", ")", "{", "String", "xml", "=", "\"\"", ";", "HashMap", "<", "String", ",", "String", ">", "ns", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "ns", ".", "put", "(", "\"def\"", ",", "\"\"", ")", ";", "assertEquals", "(", "\"test\"", ",", "Tools", ".", "extractXPath", "(", "ns", ",", "\"/def:a/def:b\"", ",", "xml", ",", "XPathConstants", ".", "STRING", ",", "\"UTF-8\"", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldExtractXPathsFromXmlDocumentAsNumberWithGenericNamespace", "(", ")", "{", "String", "xml", "=", "\"\"", ";", "HashMap", "<", "String", ",", "String", ">", "ns", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "ns", ".", "put", "(", "\"alias\"", ",", "\"\"", ")", ";", "assertEquals", "(", "\"tada\"", ",", "Tools", ".", "extractXPath", "(", "ns", ",", "\"/a/alias:c\"", ",", "xml", ",", "XPathConstants", ".", "STRING", ",", "\"UTF-8\"", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldExtractXPathsFromXmlDocumentWithNestedGenericNamespace", "(", ")", "{", "String", "xml", "=", "\"\"", "+", "\"\"", ";", "HashMap", "<", "String", ",", "String", ">", "ns", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "ns", ".", "put", "(", "\"ns1alias\"", ",", "\"\"", ")", ";", "assertEquals", "(", "\"true\"", ",", "Tools", ".", "extractXPath", "(", "ns", ",", "\"\"", ",", "xml", ",", "XPathConstants", ".", "BOOLEAN", ",", "\"UTF-8\"", ")", ".", "toString", "(", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldExtractXPathsFromXmlDocumentAsNodelistWithGenericNamespace", "(", ")", "{", "String", "xml", "=", "\"\"", ";", "HashMap", "<", "String", ",", "String", ">", "ns", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "ns", ".", "put", "(", "\"ns1alias\"", ",", "\"\"", ")", ";", "NodeList", "nodeList", "=", "(", "NodeList", ")", "Tools", ".", "extractXPath", "(", "ns", ",", "\"\"", ",", "xml", ",", "XPathConstants", ".", "NODESET", ",", "\"UTF-8\"", ")", ";", "assertEquals", "(", "1", ",", "nodeList", ".", "getLength", "(", ")", ")", ";", "}", "@", "Test", "(", "expected", "=", "IllegalArgumentException", ".", "class", ")", "public", "void", "shouldNotifyCallerWhenXPathIsWrong", "(", ")", "{", "Tools", ".", "extractXPath", "(", "DEF_NS_CONTEXT", ",", "\"/a[text=1\"", ",", "\"<a>1</a>\"", ")", ";", "}", "@", "Test", "(", "expected", "=", "IllegalArgumentException", ".", "class", ")", "public", "void", "shouldNotifyCallerWhenXmlIsWrong", "(", ")", "{", "Tools", ".", "extractXPath", "(", "DEF_NS_CONTEXT", ",", "\"\"", ",", "\"<a>1<a>\"", ")", ";", "}", "@", "Test", "(", "expected", "=", "IllegalArgumentException", ".", "class", ")", "public", "void", "shouldNotifyCallerWhenXmlCannotBeParsed", "(", ")", "{", "Tools", ".", "extractXPath", "(", "DEF_NS_CONTEXT", ",", "\"\"", ",", "null", ")", ";", "}", "@", "Test", "public", "void", "codeCoversionUsesCodeHtmlTag", "(", ")", "{", "assertThat", "(", "Tools", ".", "toCode", "(", "\"x\"", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldWrapTextInHtmlAnchor", "(", ")", "{", "assertThat", "(", "Tools", ".", "toHtmlLink", "(", "\"\"", ",", "\"x\"", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldExtractTextFromSimpleTag", "(", ")", "{", "assertEquals", "(", "\"stuff\"", ",", "Tools", ".", "fromSimpleTag", "(", "\"\"", ")", ")", ";", "}", "@", "Test", "public", "void", "basicChecksOnMakeCollapsableItem", "(", ")", "{", "int", "id", "=", "\"someContent\"", ".", "hashCode", "(", ")", ";", "String", "ret", "=", "Tools", ".", "makeToggleCollapseable", "(", "\"message\"", ",", "\"someContent\"", ")", ";", "assertTrue", "(", "ret", ".", "indexOf", "(", "\"\"", "+", "id", ")", ">", "0", ")", ";", "assertTrue", "(", "ret", ".", "indexOf", "(", "\"\"", "+", "id", ")", ">", "0", ")", ";", "}", "@", "Test", "public", "void", "shouldConvertJsonToXml", "(", ")", "{", "String", "xml", "=", "Tools", ".", "fromJSONtoXML", "(", "\"\"", ")", ";", "assertEquals", "(", "\"1\"", ",", "Tools", ".", "extractXPath", "(", "\"\"", ",", "xml", ",", "XPathConstants", ".", "STRING", ",", "\"UTF-8\"", ")", ")", ";", "assertEquals", "(", "\"regent", "st\"", ",", "Tools", ".", "extractXPath", "(", "\"\"", ",", "xml", ",", "XPathConstants", ".", "STRING", ",", "\"UTF-8\"", ")", ")", ";", "assertEquals", "(", "\"joe\"", ",", "Tools", ".", "extractXPath", "(", "\"/person/name\"", ",", "xml", ",", "XPathConstants", ".", "STRING", ",", "\"UTF-8\"", ")", ")", ";", "assertEquals", "(", "\"bloggs\"", ",", "Tools", ".", "extractXPath", "(", "\"\"", ",", "xml", ",", "XPathConstants", ".", "STRING", ",", "\"UTF-8\"", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldCheckIfAStringIsValidJson", "(", ")", "{", "String", "jsonPart0", "=", "\"\"", ";", "String", "jsonPart1", "=", "\"\"", ";", "assertFalse", "(", "Tools", ".", "isValidJson", "(", "jsonPart0", ")", ")", ";", "assertTrue", "(", "Tools", ".", "isValidJson", "(", "jsonPart0", "+", "jsonPart1", ")", ")", ";", "}", "}", "</s>" ]
12,833
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertEquals", ";", "import", "java", ".", "net", ".", "URL", ";", "import", "org", ".", "junit", ".", "Test", ";", "public", "class", "UrlTest", "{", "@", "Test", "(", "expected", "=", "IllegalArgumentException", ".", "class", ")", "public", "void", "mustRejectEmptyStringUriRepresentations", "(", ")", "{", "new", "Url", "(", "\"\"", ")", ";", "}", "@", "Test", "(", "expected", "=", "IllegalArgumentException", ".", "class", ")", "public", "void", "mustRejectNullStringUriRepresentations", "(", ")", "{", "new", "Url", "(", "null", ")", ";", "}", "@", "Test", "(", "expected", "=", "IllegalArgumentException", ".", "class", ")", "public", "void", "mustRejectMalformedUrls", "(", ")", "{", "new", "Url", "(", "\"aaa\"", ")", ";", "}", "@", "Test", "(", "expected", "=", "IllegalArgumentException", ".", "class", ")", "public", "void", "mustRejectUrlsWithNoHost", "(", ")", "{", "new", "Url", "(", "\"http:///a\"", ")", ";", "}", "@", "Test", "public", "void", "mustAcceptWellFormedUrl", "(", ")", "{", "String", "url", "=", "\"http://a.com\"", ";", "Url", "u", "=", "new", "Url", "(", "url", ")", ";", "assertEquals", "(", "url", ",", "u", ".", "toString", "(", ")", ")", ";", "}", "@", "Test", "public", "void", "tailingSlashOnAUrlIsOptional", "(", ")", "{", "Url", "u1", "=", "new", "Url", "(", "\"\"", ")", ";", "Url", "u2", "=", "new", "Url", "(", "\"http://a.com\"", ")", ";", "assertEquals", "(", "u1", ".", "toString", "(", ")", ",", "u2", ".", "toString", "(", ")", ")", ";", "}", "@", "Test", "public", "void", "mustBuildUrlTailingPathToBaseUrl", "(", ")", "{", "Url", "u", "=", "new", "Url", "(", "\"http://a.com\"", ")", ";", "URL", "fullUrl1", "=", "u", ".", "buildURL", "(", "\"/path\"", ")", ";", "URL", "fullUrl2", "=", "u", ".", "buildURL", "(", "\"path\"", ")", ";", "assertEquals", "(", "\"\"", ",", "fullUrl1", ".", "toExternalForm", "(", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "fullUrl2", ".", "toExternalForm", "(", ")", ")", ";", "}", "@", "Test", "(", "expected", "=", "IllegalArgumentException", ".", "class", ")", "public", "void", "mustRejectNullPaths", "(", ")", "{", "Url", "u", "=", "new", "Url", "(", "\"http://a.com\"", ")", ";", "u", ".", "buildURL", "(", "null", ")", ";", "}", "@", "Test", "public", "void", "mustExtractPartsIfUrlIsComplete", "(", ")", "{", "Url", "u", "=", "new", "Url", "(", "\"\"", ")", ";", "assertEquals", "(", "\"/resource\"", ",", "u", ".", "getResource", "(", ")", ")", ";", "assertEquals", "(", "\"http://a.com\"", ",", "u", ".", "getBaseUrl", "(", ")", ")", ";", "}", "@", "Test", "public", "void", "mustExtractPartsIfUrlIsCompleteWithNoPathTerminatingWithSlash", "(", ")", "{", "Url", "u", "=", "new", "Url", "(", "\"\"", ")", ";", "assertEquals", "(", "\"http://a.com\"", ",", "u", ".", "getBaseUrl", "(", ")", ")", ";", "assertEquals", "(", "\"/\"", ",", "u", ".", "getResource", "(", ")", ")", ";", "}", "@", "Test", "public", "void", "mustExtractPartsIfUrlIsCompleteWithNoPathTerminatingWithoutSlash", "(", ")", "{", "Url", "u", "=", "new", "Url", "(", "\"http://a.com\"", ")", ";", "assertEquals", "(", "\"http://a.com\"", ",", "u", ".", "getBaseUrl", "(", ")", ")", ";", "assertEquals", "(", "\"/\"", ",", "u", ".", "getResource", "(", ")", ")", ";", "}", "}", "</s>" ]
12,834
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertEquals", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertFalse", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertNull", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertTrue", ";", "import", "org", ".", "junit", ".", "Test", ";", "public", "class", "StringTypeAdapterTest", "{", "@", "Test", "public", "void", "shouldEqualsTwoNullStrings", "(", ")", "{", "assertTrue", "(", "new", "StringTypeAdapter", "(", ")", ".", "equals", "(", "null", ",", "null", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldEqualsTwoEqualStrings", "(", ")", "{", "assertTrue", "(", "new", "StringTypeAdapter", "(", ")", ".", "equals", "(", "\"a\"", ",", "\"a\"", ")", ")", ";", "assertFalse", "(", "new", "StringTypeAdapter", "(", ")", ".", "equals", "(", "\"a\"", ",", "\"b\"", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldParseNullString", "(", ")", "{", "assertNull", "(", "new", "StringTypeAdapter", "(", ")", ".", "parse", "(", "\"null\"", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldParseEmptyString", "(", ")", "{", "assertEquals", "(", "\"\"", ",", "new", "StringTypeAdapter", "(", ")", ".", "parse", "(", "\"blank\"", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldParseAnyString", "(", ")", "{", "assertEquals", "(", "\"any\"", ",", "new", "StringTypeAdapter", "(", ")", ".", "parse", "(", "\"any\"", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldConvertAnyString", "(", ")", "{", "assertEquals", "(", "\"any\"", ",", "new", "StringTypeAdapter", "(", ")", ".", "toString", "(", "\"any\"", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldConvertNullString", "(", ")", "{", "assertEquals", "(", "\"null\"", ",", "new", "StringTypeAdapter", "(", ")", ".", "toString", "(", "null", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldConvertEmptyString", "(", ")", "{", "assertEquals", "(", "\"blank\"", ",", "new", "StringTypeAdapter", "(", ")", ".", "toString", "(", "\"\"", ")", ")", ";", "}", "}", "</s>" ]
12,835
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertEquals", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertFalse", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertTrue", ";", "import", "org", ".", "junit", ".", "Test", ";", "public", "class", "TextBodyTypeAdapterTest", "{", "private", "final", "TextBodyTypeAdapter", "adapter", "=", "new", "TextBodyTypeAdapter", "(", ")", ";", "@", "Test", "public", "void", "shouldParseTextAsTrimmedStrings", "(", ")", "{", "assertEquals", "(", "\"abc", "123\"", ",", "adapter", ".", "parse", "(", "\"", "abc", "123", "\"", ")", ")", ";", "assertEquals", "(", "\"null\"", ",", "adapter", ".", "parse", "(", "null", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldRenderCellContentAsStrings", "(", ")", "{", "assertEquals", "(", "\"abc123\"", ",", "adapter", ".", "toString", "(", "\"abc123\"", ")", ")", ";", "assertEquals", "(", "\"no-body\"", ",", "adapter", ".", "toString", "(", "\"", "\"", ")", ")", ";", "assertEquals", "(", "\"no-body\"", ",", "adapter", ".", "toString", "(", "null", ")", ")", ";", "assertEquals", "(", "\"<fred", "/>\"", ",", "adapter", ".", "toString", "(", "\"<fred", "/>\"", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldNotEqualiseIfOneHasCRLF", "(", ")", "{", "assertFalse", "(", "adapter", ".", "equals", "(", "\"abc123\"", ",", "\"abcrn123\"", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldEqualiseIfBothHaveCRLF", "(", ")", "{", "assertTrue", "(", "adapter", ".", "equals", "(", "\"abcrn123\"", ",", "\"abcrn123\"", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldNotEqualiseIfExpectedOrActualAreNull", "(", ")", "{", "assertFalse", "(", "adapter", ".", "equals", "(", "null", ",", "\"abc123\"", ")", ")", ";", "assertFalse", "(", "adapter", ".", "equals", "(", "\"sgsgd\"", ",", "null", ")", ")", ";", "}", "@", "Test", "public", "void", "whenExpectedIsNotMatchedAnErrorShouldBeAdded", "(", ")", "{", "adapter", ".", "equals", "(", "\"xyz\"", ",", "\"abc\"", ")", ";", "assertEquals", "(", "1", ",", "adapter", ".", "getErrors", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "adapter", ".", "getErrors", "(", ")", ".", "get", "(", "0", ")", ")", ";", "}", "@", "Test", "public", "void", "whenExpectedIsNotMatchedAnErrorShouldBeAddedAlsoForPlainStringMatching", "(", ")", "{", "String", "illegalRegex", "=", "\"[xyz\"", ";", "adapter", ".", "equals", "(", "illegalRegex", ",", "\"abc\"", ")", ";", "assertEquals", "(", "1", ",", "adapter", ".", "getErrors", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "adapter", ".", "getErrors", "(", ")", ".", "get", "(", "0", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldConvertTextToXmlUsingTextTag", "(", ")", "{", "assertEquals", "(", "\"\"", ",", "adapter", ".", "toXmlString", "(", "\"abc\"", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldMatchRegexExpressions", "(", ")", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "sb", ".", "append", "(", "\"<resource>n\"", ")", ";", "sb", ".", "append", "(", "\"\"", ")", ";", "sb", ".", "append", "(", "\"\"", ")", ";", "sb", ".", "append", "(", "\"\"", ")", ";", "sb", ".", "append", "(", "\"\"", ")", ";", "sb", ".", "append", "(", "\"\"", ")", ";", "sb", ".", "append", "(", "\"</resource>n\"", ")", ";", "assertTrue", "(", "adapter", ".", "equals", "(", "\"\"", ",", "sb", ".", "toString", "(", ")", ")", ")", ";", "}", "}", "</s>" ]
12,836
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertEquals", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertNull", ";", "import", "org", ".", "apache", ".", "commons", ".", "httpclient", ".", "HttpClient", ";", "import", "org", ".", "apache", ".", "commons", ".", "httpclient", ".", "UsernamePasswordCredentials", ";", "import", "org", ".", "apache", ".", "commons", ".", "httpclient", ".", "auth", ".", "AuthScope", ";", "import", "org", ".", "junit", ".", "After", ";", "import", "org", ".", "junit", ".", "Before", ";", "import", "org", ".", "junit", ".", "Test", ";", "public", "class", "HttpClientBuilderTest", "{", "private", "Config", "config", ";", "private", "Config", "incompleteConfig", ";", "@", "Before", "public", "void", "createConfig", "(", ")", "{", "config", "=", "Config", ".", "getConfig", "(", "\"complete\"", ")", ";", "config", ".", "add", "(", "\"\"", ",", "\"111\"", ")", ";", "config", ".", "add", "(", "\"\"", ",", "\"HOST\"", ")", ";", "config", ".", "add", "(", "\"\"", ",", "\"1200\"", ")", ";", "config", ".", "add", "(", "\"\"", ",", "\"UNAMEIT\"", ")", ";", "config", ".", "add", "(", "\"\"", ",", "\"secr3t\"", ")", ";", "incompleteConfig", "=", "Config", ".", "getConfig", "(", "\"incomplete\"", ")", ";", "incompleteConfig", ".", "add", "(", "\"\"", ",", "\"HOST\"", ")", ";", "incompleteConfig", ".", "add", "(", "\"\"", ",", "\"UNAMEIT\"", ")", ";", "}", "@", "After", "public", "void", "removeConfig", "(", ")", "{", "config", ".", "clear", "(", ")", ";", "incompleteConfig", ".", "clear", "(", ")", ";", "}", "@", "Test", "public", "void", "mustSetDefaultsForNotSuppliedConfigValues", "(", ")", "{", "HttpClientBuilder", "b", "=", "new", "HttpClientBuilder", "(", ")", ";", "HttpClient", "cli", "=", "b", ".", "createHttpClient", "(", "Config", ".", "getConfig", "(", ")", ")", ";", "assertEquals", "(", "HttpClientBuilder", ".", "DEFAULT_SO_TO", ".", "intValue", "(", ")", ",", "cli", ".", "getParams", "(", ")", ".", "getSoTimeout", "(", ")", ")", ";", "assertNull", "(", "cli", ".", "getHostConfiguration", "(", ")", ".", "getProxyHost", "(", ")", ")", ";", "assertNull", "(", "cli", ".", "getState", "(", ")", ".", "getProxyCredentials", "(", "AuthScope", ".", "ANY", ")", ")", ";", "}", "@", "Test", "public", "void", "mustSetValuesAsOfThoseSuppliedInConfig", "(", ")", "{", "HttpClientBuilder", "b", "=", "new", "HttpClientBuilder", "(", ")", ";", "HttpClient", "cli", "=", "b", ".", "createHttpClient", "(", "config", ")", ";", "assertEquals", "(", "111", ",", "cli", ".", "getParams", "(", ")", ".", "getSoTimeout", "(", ")", ")", ";", "assertEquals", "(", "\"HOST\"", ",", "cli", ".", "getHostConfiguration", "(", ")", ".", "getProxyHost", "(", ")", ")", ";", "assertEquals", "(", "1200", ",", "cli", ".", "getHostConfiguration", "(", ")", ".", "getProxyPort", "(", ")", ")", ";", "UsernamePasswordCredentials", "credentials", "=", "(", "UsernamePasswordCredentials", ")", "cli", ".", "getState", "(", ")", ".", "getCredentials", "(", "AuthScope", ".", "ANY", ")", ";", "assertEquals", "(", "\"UNAMEIT\"", ",", "credentials", ".", "getUserName", "(", ")", ")", ";", "assertEquals", "(", "\"secr3t\"", ",", "credentials", ".", "getPassword", "(", ")", ")", ";", "}", "@", "Test", "public", "void", "mustNotSetCredentialsIfBothConfigValueAreNotAvailable", "(", ")", "{", "HttpClientBuilder", "b", "=", "new", "HttpClientBuilder", "(", ")", ";", "HttpClient", "cli", "=", "b", ".", "createHttpClient", "(", "incompleteConfig", ")", ";", "assertNull", "(", "cli", ".", "getState", "(", ")", ".", "getProxyCredentials", "(", "AuthScope", ".", "ANY", ")", ")", ";", "}", "@", "Test", "public", "void", "mustSetDefaultProxyPortIfNotSuppliedWithProxyHost", "(", ")", "{", "HttpClientBuilder", "b", "=", "new", "HttpClientBuilder", "(", ")", ";", "HttpClient", "cli", "=", "b", ".", "createHttpClient", "(", "incompleteConfig", ")", ";", "assertEquals", "(", "80", ",", "cli", ".", "getHostConfiguration", "(", ")", ".", "getProxyPort", "(", ")", ")", ";", "}", "}", "</s>" ]
12,837
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertEquals", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertNull", ";", "import", "org", ".", "junit", ".", "Before", ";", "import", "org", ".", "junit", ".", "Test", ";", "public", "class", "VariablesTest", "{", "@", "Before", "public", "void", "clearVariables", "(", ")", "{", "new", "Variables", "(", ")", ".", "clearAll", "(", ")", ";", "}", "@", "Test", "public", "void", "variablesShoudBeStatic", "(", ")", "{", "Variables", "v1", "=", "new", "Variables", "(", ")", ";", "Variables", "v2", "=", "new", "Variables", "(", ")", ";", "assertNull", "(", "v1", ".", "get", "(", "\"a\"", ")", ")", ";", "assertNull", "(", "v2", ".", "get", "(", "\"a\"", ")", ")", ";", "v1", ".", "put", "(", "\"a\"", ",", "\"val\"", ")", ";", "assertEquals", "(", "\"val\"", ",", "v1", ".", "get", "(", "\"a\"", ")", ")", ";", "assertEquals", "(", "\"val\"", ",", "v2", ".", "get", "(", "\"a\"", ")", ")", ";", "}", "@", "Test", "public", "void", "variablesAreSubstitutedWithCurrentValueWhenLabelsAreIdentifiedWithinPercentSymbol", "(", ")", "{", "Variables", "v1", "=", "new", "Variables", "(", ")", ";", "v1", ".", "put", "(", "\"ID\"", ",", "\"100\"", ")", ";", "String", "newText", "=", "v1", ".", "substitute", "(", "\"\"", ")", ";", "assertEquals", "(", "\"\"", ",", "newText", ")", ";", "}", "@", "Test", "public", "void", "variablesAreSubstitutedMultipleTimes", "(", ")", "{", "Variables", "v1", "=", "new", "Variables", "(", ")", ";", "v1", ".", "put", "(", "\"ID\"", ",", "\"100\"", ")", ";", "String", "newText", "=", "v1", ".", "substitute", "(", "\"\"", ")", ";", "assertEquals", "(", "\"\"", ",", "newText", ")", ";", "}", "@", "Test", "public", "void", "nonExistentVariablesAreNotReplaced", "(", ")", "{", "Variables", "v1", "=", "new", "Variables", "(", ")", ";", "v1", ".", "put", "(", "\"ID\"", ",", "\"100\"", ")", ";", "String", "newText", "=", "v1", ".", "substitute", "(", "\"\"", ")", ";", "assertEquals", "(", "\"\"", ",", "newText", ")", ";", "}", "@", "Test", "public", "void", "variablesContainingNullAreSubWithStringNullByDefault", "(", ")", "{", "Config", ".", "getConfig", "(", ")", ".", "clear", "(", ")", ";", "Variables", "v1", "=", "new", "Variables", "(", ")", ";", "v1", ".", "put", "(", "\"ID\"", ",", "null", ")", ";", "String", "newText", "=", "v1", ".", "substitute", "(", "\"\"", ")", ";", "assertEquals", "(", "\"\"", ",", "newText", ")", ";", "}", "@", "Test", "public", "void", "variablesContainingNullAreSubWithValueSuppliedViaConfig", "(", ")", "{", "Config", "c", "=", "Config", ".", "getConfig", "(", ")", ";", "c", ".", "add", "(", "\"\"", ",", "\"\"", ")", ";", "Variables", "v1", "=", "new", "Variables", "(", "c", ")", ";", "v1", ".", "put", "(", "\"ID\"", ",", "null", ")", ";", "String", "newText", "=", "v1", ".", "substitute", "(", "\"\"", ")", ";", "assertEquals", "(", "\"\"", ",", "newText", ")", ";", "}", "@", "Test", "public", "void", "variablesContainingNullAreSubWithEmptyValueSuppliedViaConfig", "(", ")", "{", "Config", "c", "=", "Config", ".", "getConfig", "(", ")", ";", "c", ".", "add", "(", "\"\"", ",", "\"\"", ")", ";", "Variables", "v1", "=", "new", "Variables", "(", "c", ")", ";", "v1", ".", "put", "(", "\"ID\"", ",", "null", ")", ";", "String", "newText", "=", "v1", ".", "substitute", "(", "\"\"", ")", ";", "assertEquals", "(", "\"null", "is", "''\"", ",", "newText", ")", ";", "}", "}", "</s>" ]
12,838
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertEquals", ";", "import", "java", ".", "nio", ".", "charset", ".", "Charset", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "junit", ".", "After", ";", "import", "org", ".", "junit", ".", "Before", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "smartrics", ".", "rest", ".", "client", ".", "RestData", ";", "import", "smartrics", ".", "rest", ".", "client", ".", "RestData", ".", "Header", ";", "public", "class", "ContentTypeTest", "{", "@", "Before", "@", "After", "public", "void", "resetDefaultContentTypeMap", "(", ")", "{", "ContentType", ".", "resetDefaultMapping", "(", ")", ";", "}", "@", "Test", "public", "void", "shouldReturnCorrectTypeGivenApplicationXml", "(", ")", "{", "List", "<", "Header", ">", "headers", "=", "new", "ArrayList", "<", "Header", ">", "(", ")", ";", "headers", ".", "add", "(", "new", "RestData", ".", "Header", "(", "\"Content-Type\"", ",", "\"\"", ")", ")", ";", "assertEquals", "(", "ContentType", ".", "XML", ",", "ContentType", ".", "parse", "(", "headers", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldReturnCorrectTypeGivenApplicationJson", "(", ")", "{", "List", "<", "Header", ">", "headers", "=", "new", "ArrayList", "<", "Header", ">", "(", ")", ";", "headers", ".", "add", "(", "new", "RestData", ".", "Header", "(", "\"Content-Type\"", ",", "\"\"", ")", ")", ";", "assertEquals", "(", "ContentType", ".", "JSON", ",", "ContentType", ".", "parse", "(", "headers", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldReturnCorrectTypeGivenApplicationText", "(", ")", "{", "List", "<", "Header", ">", "headers", "=", "new", "ArrayList", "<", "Header", ">", "(", ")", ";", "headers", ".", "add", "(", "new", "RestData", ".", "Header", "(", "\"Content-Type\"", ",", "\"text/plain\"", ")", ")", ";", "assertEquals", "(", "ContentType", ".", "TEXT", ",", "ContentType", ".", "parse", "(", "headers", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldReturnCorrectTypeGivenApplicationTextWithCharset", "(", ")", "{", "List", "<", "Header", ">", "headers", "=", "new", "ArrayList", "<", "Header", ">", "(", ")", ";", "headers", ".", "add", "(", "new", "RestData", ".", "Header", "(", "\"Content-Type\"", ",", "\"\"", ")", ")", ";", "assertEquals", "(", "ContentType", ".", "TEXT", ",", "ContentType", ".", "parse", "(", "headers", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldReturnDefaultGivenAnythingElse", "(", ")", "{", "List", "<", "Header", ">", "headers", "=", "new", "ArrayList", "<", "Header", ">", "(", ")", ";", "headers", ".", "add", "(", "new", "RestData", ".", "Header", "(", "\"Content-Type\"", ",", "\"blah/blah\"", ")", ")", ";", "assertEquals", "(", "ContentType", ".", "typeFor", "(", "\"default\"", ")", ",", "ContentType", ".", "parse", "(", "headers", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldReturnDefaultGivenEmptyHeaders", "(", ")", "{", "List", "<", "Header", ">", "headers", "=", "new", "ArrayList", "<", "Header", ">", "(", ")", ";", "assertEquals", "(", "ContentType", ".", "typeFor", "(", "\"default\"", ")", ",", "ContentType", ".", "parse", "(", "headers", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldReturnDefaultGivenMoreThanOneHeaders", "(", ")", "{", "List", "<", "Header", ">", "headers", "=", "new", "ArrayList", "<", "Header", ">", "(", ")", ";", "headers", ".", "add", "(", "new", "RestData", ".", "Header", "(", "\"Content-Type\"", ",", "\"\"", ")", ")", ";", "headers", ".", "add", "(", "new", "RestData", ".", "Header", "(", "\"Content-Type\"", ",", "\"\"", ")", ")", ";", "assertEquals", "(", "ContentType", ".", "typeFor", "(", "\"default\"", ")", ",", "ContentType", ".", "parse", "(", "headers", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldReturnDefaultGivenOneHeaderThatIsNotContentType", "(", ")", "{", "List", "<", "Header", ">", "headers", "=", "new", "ArrayList", "<", "Header", ">", "(", ")", ";", "headers", ".", "add", "(", "new", "RestData", ".", "Header", "(", "\"\"", ",", "\"\"", ")", ")", ";", "assertEquals", "(", "ContentType", ".", "typeFor", "(", "\"default\"", ")", ",", "ContentType", ".", "parse", "(", "headers", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldParseTheCharset", "(", ")", "{", "List", "<", "Header", ">", "headers", "=", "new", "ArrayList", "<", "Header", ">", "(", ")", ";", "headers", ".", "add", "(", "new", "RestData", ".", "Header", "(", "\"Content-Type\"", ",", "\"\"", ")", ")", ";", "assertEquals", "(", "ContentType", ".", "parseCharset", "(", "headers", ")", ",", "\"UTF-8\"", ")", ";", "}", "@", "Test", "public", "void", "shouldUseDefaultSystemCharsetIfCharsetNotParseableAndDefaultNotSpecifiedViaProperty", "(", ")", "{", "List", "<", "Header", ">", "headers", "=", "new", "ArrayList", "<", "Header", ">", "(", ")", ";", "headers", ".", "add", "(", "new", "RestData", ".", "Header", "(", "\"Content-Type\"", ",", "\"\"", ")", ")", ";", "Config", "c", "=", "Config", ".", "getConfig", "(", ")", ";", "c", ".", "add", "(", "\"\"", ",", "confMap", "(", ")", ")", ";", "c", ".", "add", "(", "\"\"", ",", "null", ")", ";", "ContentType", ".", "config", "(", "c", ")", ";", "assertEquals", "(", "ContentType", ".", "parseCharset", "(", "headers", ")", ",", "Charset", ".", "defaultCharset", "(", ")", ".", "name", "(", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldUseSpecifieDefaultCharsetProperty", "(", ")", "{", "List", "<", "Header", ">", "headers", "=", "new", "ArrayList", "<", "Header", ">", "(", ")", ";", "headers", ".", "add", "(", "new", "RestData", ".", "Header", "(", "\"Content-Type\"", ",", "\"\"", ")", ")", ";", "Config", "c", "=", "Config", ".", "getConfig", "(", ")", ";", "c", ".", "add", "(", "\"\"", ",", "confMap", "(", ")", ")", ";", "c", ".", "add", "(", "\"\"", ",", "\"MY-CHARSET\"", ")", ";", "ContentType", ".", "config", "(", "c", ")", ";", "assertEquals", "(", "ContentType", ".", "parseCharset", "(", "headers", ")", ",", "\"MY-CHARSET\"", ")", ";", "}", "@", "Test", "public", "void", "shouldSetupInternalStateFromConfig", "(", ")", "{", "StringBuffer", "configEntry", "=", "new", "StringBuffer", "(", ")", ";", "configEntry", ".", "append", "(", "\"\"", ")", ";", "Config", "c", "=", "Config", ".", "getConfig", "(", ")", ";", "c", ".", "add", "(", "\"\"", ",", "configEntry", ".", "toString", "(", ")", ")", ";", "ContentType", ".", "config", "(", "c", ")", ";", "assertEquals", "(", "ContentType", ".", "XML", ",", "ContentType", ".", "typeFor", "(", "\"\"", ")", ")", ";", "assertEquals", "(", "ContentType", ".", "XML", ",", "ContentType", ".", "typeFor", "(", "\"default\"", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldSetupTheContentTypeToAdaptersMapViaConfig", "(", ")", "{", "Config", "c", "=", "Config", ".", "getConfig", "(", ")", ";", "c", ".", "add", "(", "\"\"", ",", "confMap", "(", ")", ")", ";", "c", ".", "add", "(", "\"\"", ",", "\"MY-CHARSET\"", ")", ";", "ContentType", ".", "config", "(", "c", ")", ";", "List", "<", "Header", ">", "headers", "=", "new", "ArrayList", "<", "Header", ">", "(", ")", ";", "headers", ".", "add", "(", "new", "RestData", ".", "Header", "(", "\"Content-Type\"", ",", "\"\"", ")", ")", ";", "assertEquals", "(", "ContentType", ".", "JSON", ",", "ContentType", ".", "parse", "(", "headers", ")", ")", ";", "headers", ".", "set", "(", "0", ",", "new", "RestData", ".", "Header", "(", "\"Content-Type\"", ",", "\"\"", ")", ")", ";", "assertEquals", "(", "ContentType", ".", "XML", ",", "ContentType", ".", "parse", "(", "headers", ")", ")", ";", "headers", ".", "set", "(", "0", ",", "new", "RestData", ".", "Header", "(", "\"Content-Type\"", ",", "\"\"", ")", ")", ";", "assertEquals", "(", "ContentType", ".", "XML", ",", "ContentType", ".", "parse", "(", "headers", ")", ")", ";", "headers", ".", "set", "(", "0", ",", "new", "RestData", ".", "Header", "(", "\"Content-Type\"", ",", "\"\"", ")", ")", ";", "assertEquals", "(", "ContentType", ".", "XML", ",", "ContentType", ".", "parse", "(", "headers", ")", ")", ";", "headers", ".", "set", "(", "0", ",", "new", "RestData", ".", "Header", "(", "\"Content-Type\"", ",", "\"text/plain\"", ")", ")", ";", "assertEquals", "(", "ContentType", ".", "JSON", ",", "ContentType", ".", "parse", "(", "headers", ")", ")", ";", "headers", ".", "set", "(", "0", ",", "new", "RestData", ".", "Header", "(", "\"Content-Type\"", ",", "\"unhandled\"", ")", ")", ";", "assertEquals", "(", "ContentType", ".", "TEXT", ",", "ContentType", ".", "parse", "(", "headers", ")", ")", ";", "}", "private", "String", "confMap", "(", ")", "{", "StringBuffer", "configEntry", "=", "new", "StringBuffer", "(", ")", ";", "configEntry", ".", "append", "(", "\"\"", ")", ";", "configEntry", ".", "append", "(", "\"\"", ")", ";", "configEntry", ".", "append", "(", "\"\"", ")", ";", "configEntry", ".", "append", "(", "\"\"", ")", ";", "configEntry", ".", "append", "(", "\"\"", ")", ";", "return", "configEntry", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
12,839
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "equalTo", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "is", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertEquals", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertNull", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertThat", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertTrue", ";", "import", "org", ".", "junit", ".", "After", ";", "import", "org", ".", "junit", ".", "Before", ";", "import", "org", ".", "junit", ".", "Test", ";", "public", "class", "ConfigTest", "{", "private", "Config", "namedConfig", ";", "private", "Config", "defaultNamedConfig", ";", "@", "Before", "public", "void", "setUp", "(", ")", "{", "namedConfig", "=", "Config", ".", "getConfig", "(", "\"configName\"", ")", ";", "defaultNamedConfig", "=", "Config", ".", "getConfig", "(", ")", ";", "namedConfig", ".", "add", "(", "\"key\"", ",", "\"value\"", ")", ";", "}", "@", "After", "public", "void", "tearDown", "(", ")", "{", "namedConfig", ".", "clear", "(", ")", ";", "defaultNamedConfig", ".", "clear", "(", ")", ";", "}", "@", "Test", "public", "void", "mustInitializeNameOfConfigFromCtorInput", "(", ")", "{", "assertThat", "(", "namedConfig", ".", "getName", "(", ")", ",", "is", "(", "equalTo", "(", "\"configName\"", ")", ")", ")", ";", "assertThat", "(", "defaultNamedConfig", ".", "getName", "(", ")", ",", "is", "(", "equalTo", "(", "Config", ".", "DEFAULT_CONFIG_NAME", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "mustInitializeNameToDefaultIfGetterArgIsNull", "(", ")", "{", "assertThat", "(", "Config", ".", "getConfig", "(", "null", ")", ".", "getName", "(", ")", ",", "is", "(", "equalTo", "(", "Config", ".", "DEFAULT_CONFIG_NAME", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "mustAddConfigDataToANamedConfig", "(", ")", "{", "namedConfig", ".", "add", "(", "\"key1\"", ",", "\"value1\"", ")", ";", "assertEquals", "(", "\"value1\"", ",", "namedConfig", ".", "get", "(", "\"key1\"", ")", ")", ";", "}", "@", "Test", "public", "void", "mustAddConfigDataToDefaultConfigIfConfigNameIsNull", "(", ")", "{", "defaultNamedConfig", ".", "add", "(", "\"key1\"", ",", "\"value1\"", ")", ";", "assertEquals", "(", "\"value1\"", ",", "defaultNamedConfig", ".", "get", "(", "\"key1\"", ")", ")", ";", "}", "@", "Test", "public", "void", "mustReturnNullForRequestsOnExistentNamedConfigsWithNonExistentKey", "(", ")", "{", "assertNull", "(", "namedConfig", ".", "get", "(", "\"\"", ")", ")", ";", "}", "@", "Test", "public", "void", "mustReturnDefaultForRequestsOnExistentNamedConfigsWithNonExistentKey", "(", ")", "{", "assertEquals", "(", "\"val\"", ",", "namedConfig", ".", "get", "(", "\"\"", ",", "\"val\"", ")", ")", ";", "}", "@", "Test", "public", "void", "mustClearNamedConfig", "(", ")", "{", "namedConfig", ".", "clear", "(", ")", ";", "assertNull", "(", "namedConfig", ".", "get", "(", "\"key\"", ")", ")", ";", "}", "@", "Test", "public", "void", "mustClearDefaultNamedConfigIfConfigNameIsNull", "(", ")", "{", "defaultNamedConfig", ".", "clear", "(", ")", ";", "assertNull", "(", "defaultNamedConfig", ".", "get", "(", "\"key\"", ")", ")", ";", "}", "@", "Test", "public", "void", "mustAddToDefaultNamedConfigWhenConfigNameIsNotAvailable", "(", ")", "{", "defaultNamedConfig", ".", "add", "(", "\"\"", ",", "\"\"", ")", ";", "assertEquals", "(", "\"\"", ",", "defaultNamedConfig", ".", "get", "(", "\"\"", ")", ")", ";", "}", "@", "Test", "public", "void", "mustReturnNullForRequestsOnDefaultNamedConfigsWithNonExistentKey", "(", ")", "{", "assertNull", "(", "defaultNamedConfig", ".", "get", "(", "\"\"", ")", ")", ";", "}", "@", "Test", "public", "void", "mustClearDefaultConfig", "(", ")", "{", "defaultNamedConfig", ".", "clear", "(", ")", ";", "assertNull", "(", "defaultNamedConfig", ".", "get", "(", "\"key\"", ")", ")", ";", "}", "@", "Test", "public", "void", "mustGetDataParsedAsLong", "(", ")", "{", "defaultNamedConfig", ".", "add", "(", "\"long\"", ",", "\"100\"", ")", ";", "defaultNamedConfig", ".", "add", "(", "\"long-x\"", ",", "\"x\"", ")", ";", "assertEquals", "(", "Long", ".", "valueOf", "(", "100", ")", ",", "defaultNamedConfig", ".", "getAsLong", "(", "\"long\"", ",", "Long", ".", "valueOf", "(", "10", ")", ")", ")", ";", "assertEquals", "(", "Long", ".", "valueOf", "(", "10", ")", ",", "defaultNamedConfig", ".", "getAsLong", "(", "\"\"", ",", "Long", ".", "valueOf", "(", "10", ")", ")", ")", ";", "assertEquals", "(", "Long", ".", "valueOf", "(", "10", ")", ",", "defaultNamedConfig", ".", "getAsLong", "(", "\"long-x\"", ",", "Long", ".", "valueOf", "(", "10", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "mustGetDataParsedAsBoolean", "(", ")", "{", "defaultNamedConfig", ".", "add", "(", "\"bool\"", ",", "\"false\"", ")", ";", "defaultNamedConfig", ".", "add", "(", "\"bool-x\"", ",", "\"x\"", ")", ";", "assertEquals", "(", "Boolean", ".", "FALSE", ",", "defaultNamedConfig", ".", "getAsBoolean", "(", "\"bool\"", ",", "Boolean", ".", "TRUE", ")", ")", ";", "assertEquals", "(", "Boolean", ".", "TRUE", ",", "defaultNamedConfig", ".", "getAsBoolean", "(", "\"\"", ",", "Boolean", ".", "TRUE", ")", ")", ";", "assertEquals", "(", "Boolean", ".", "FALSE", ",", "defaultNamedConfig", ".", "getAsBoolean", "(", "\"bool-x\"", ",", "Boolean", ".", "TRUE", ")", ")", ";", "}", "@", "Test", "public", "void", "mustGetDataParsedAsInteger", "(", ")", "{", "defaultNamedConfig", ".", "add", "(", "\"int\"", ",", "\"19\"", ")", ";", "defaultNamedConfig", ".", "add", "(", "\"int-x\"", ",", "\"x\"", ")", ";", "assertEquals", "(", "Integer", ".", "valueOf", "(", "19", ")", ",", "defaultNamedConfig", ".", "getAsInteger", "(", "\"int\"", ",", "Integer", ".", "valueOf", "(", "10", ")", ")", ")", ";", "assertEquals", "(", "Integer", ".", "valueOf", "(", "10", ")", ",", "defaultNamedConfig", ".", "getAsInteger", "(", "\"\"", ",", "Integer", ".", "valueOf", "(", "10", ")", ")", ")", ";", "assertEquals", "(", "Integer", ".", "valueOf", "(", "10", ")", ",", "defaultNamedConfig", ".", "getAsInteger", "(", "\"int-x\"", ",", "Integer", ".", "valueOf", "(", "10", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "mustContainAtLeastNameInStringRepresentation", "(", ")", "{", "assertTrue", "(", "\"\"", ",", "defaultNamedConfig", ".", "toString", "(", ")", ".", "contains", "(", "defaultNamedConfig", ".", "getName", "(", ")", ")", ")", ";", "assertTrue", "(", "\"\"", ",", "namedConfig", ".", "toString", "(", ")", ".", "contains", "(", "namedConfig", ".", "getName", "(", ")", ")", ")", ";", "}", "}", "</s>" ]
12,840
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "equalTo", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "is", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertNull", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertThat", ";", "import", "org", ".", "junit", ".", "Before", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "smartrics", ".", "rest", ".", "client", ".", "RestResponse", ";", "public", "class", "LetBodyHandlerTest", "{", "private", "Variables", "variables", ";", "@", "Before", "public", "void", "setUp", "(", ")", "{", "variables", "=", "new", "Variables", "(", ")", ";", "variables", ".", "clearAll", "(", ")", ";", "}", "@", "Test", "public", "void", "shouldHandleExpressionsReturningNull", "(", ")", "{", "LetBodyHandler", "h", "=", "new", "LetBodyHandler", "(", ")", ";", "String", "r", "=", "h", ".", "handle", "(", "new", "RestResponse", "(", ")", ",", "null", ",", "\"null\"", ")", ";", "assertNull", "(", "r", ")", ";", "}", "@", "Test", "public", "void", "shouldHandleJsBodyWithXPaths", "(", ")", "{", "LetBodyHandler", "h", "=", "new", "LetBodyHandler", "(", ")", ";", "RestResponse", "response", "=", "new", "RestResponse", "(", ")", ";", "response", ".", "addHeader", "(", "\"Content-Type\"", ",", "\"\"", ")", ";", "response", ".", "setBody", "(", "\"\"", ")", ";", "String", "ret", "=", "h", ".", "handle", "(", "response", ",", "null", ",", "\"\"", ")", ";", "assertThat", "(", "ret", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "}", "}", "</s>" ]
12,841
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "equalTo", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "is", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertEquals", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertFalse", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertThat", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertTrue", ";", "import", "java", ".", "util", ".", "Arrays", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Vector", ";", "import", "org", ".", "junit", ".", "Before", ";", "import", "org", ".", "junit", ".", "Test", ";", "public", "class", "JSONBodyTypeAdapterTest", "{", "private", "JSONBodyTypeAdapter", "adapter", ";", "private", "static", "final", "String", "json0", "=", "\"\"", ";", "private", "static", "final", "String", "json1", "=", "\"{\\\"a\\\":", "\\\"", "1&\\\"}\"", ";", "private", "static", "final", "List", "<", "String", ">", "xPaths", "=", "Arrays", ".", "asList", "(", "\"/a\"", ",", "\"//b\"", ")", ";", "private", "static", "final", "String", "xPathsAsString", "=", "\"/a<br/>//b\"", ";", "@", "Before", "public", "void", "setUp", "(", ")", "{", "adapter", "=", "new", "JSONBodyTypeAdapter", "(", ")", ";", "adapter", ".", "setContext", "(", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldIdentifyContentObjectsWithNoBodyAsBeingEqual", "(", ")", "{", "assertTrue", "(", "adapter", ".", "equals", "(", "\"no-body\"", ",", "\"no-body\"", ")", ")", ";", "assertTrue", "(", "adapter", ".", "equals", "(", "\"no-body\"", ",", "\"\"", ")", ")", ";", "assertTrue", "(", "adapter", ".", "equals", "(", "\"no-body\"", ",", "null", ")", ")", ";", "assertFalse", "(", "adapter", ".", "equals", "(", "\"/a\"", ",", "null", ")", ")", ";", "assertFalse", "(", "adapter", ".", "equals", "(", "\"no-body\"", ",", "json0", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldIdentifyAsEqualsIfExpectedObjectIsAListOfXPathsAvailableInActual", "(", ")", "{", "assertTrue", "(", "\"\"", ",", "adapter", ".", "equals", "(", "Arrays", ".", "asList", "(", "\"\"", ")", ",", "json0", ")", ")", ";", "assertTrue", "(", "\"\"", ",", "adapter", ".", "equals", "(", "Arrays", ".", "asList", "(", "\"\"", ",", "\"\"", ")", ",", "json0", ")", ")", ";", "assertTrue", "(", "\"\"", ",", "adapter", ".", "equals", "(", "Arrays", ".", "asList", "(", "\"\"", ",", "\"\"", ")", ",", "json0", ")", ")", ";", "assertTrue", "(", "\"\"", ",", "adapter", ".", "equals", "(", "Arrays", ".", "asList", "(", "\"\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ")", ",", "json0", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldIdentifyAsEqualsIfExpectedObjectIsAJavascriptExpressionInActual", "(", ")", "{", "assertTrue", "(", "\"\"", ",", "adapter", ".", "equals", "(", "\"\"", ",", "json0", ")", ")", ";", "assertTrue", "(", "\"\"", ",", "adapter", ".", "equals", "(", "\"\"", ",", "json0", ")", ")", ";", "assertTrue", "(", "\"\"", ",", "adapter", ".", "equals", "(", "\"\"", ",", "json0", ")", ")", ";", "assertTrue", "(", "\"\"", ",", "adapter", ".", "equals", "(", "Arrays", ".", "asList", "(", "\"\"", ",", "\"\"", ")", ",", "json0", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldStoreNotFoundMessageForEveryXPathExpressionNotFoundForEqualityCheck", "(", ")", "{", "assertFalse", "(", "adapter", ".", "equals", "(", "Arrays", ".", "asList", "(", "\"\"", ",", "\"\"", ",", "\"\"", ")", ",", "json0", ")", ")", ";", "assertEquals", "(", "2", ",", "adapter", ".", "getErrors", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "adapter", ".", "getErrors", "(", ")", ".", "get", "(", "0", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "adapter", ".", "getErrors", "(", ")", ".", "get", "(", "1", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldStoreNotFoundMessageForEveryJSonExpressionNotFoundForEqualityCheck", "(", ")", "{", "assertFalse", "(", "adapter", ".", "equals", "(", "Arrays", ".", "asList", "(", "\"\"", ",", "\"\"", ",", "\"\"", ")", ",", "json0", ")", ")", ";", "assertEquals", "(", "2", ",", "adapter", ".", "getErrors", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "adapter", ".", "getErrors", "(", ")", ".", "get", "(", "0", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "adapter", ".", "getErrors", "(", ")", ".", "get", "(", "1", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldReturnItsStringRepresentationAsPrintableHTML", "(", ")", "{", "assertEquals", "(", "json1", ",", "adapter", ".", "toString", "(", "json1", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldReturnItsStringRepresentationAsPrintableHTMLEvenWhenEmpty", "(", ")", "{", "assertEquals", "(", "\"no-body\"", ",", "adapter", ".", "toString", "(", "\"\"", ")", ")", ";", "}", "@", "Test", "public", "void", "shoudlParseStringWithXPathInHtmlIntoAProperList", "(", ")", "throws", "Exception", "{", "assertTrue", "(", "xPathsAsString", ".", "indexOf", "(", "\"<br/>\"", ")", ">", "-", "1", ")", ";", "assertEquals", "(", "xPaths", ",", "adapter", ".", "parse", "(", "xPathsAsString", ")", ")", ";", "}", "@", "Test", "public", "void", "shoudlParseNoJsonIntoAnEmptyList", "(", ")", "throws", "Exception", "{", "assertEquals", "(", "new", "Vector", "<", "String", ">", "(", ")", ",", "adapter", ".", "parse", "(", "null", ")", ")", ";", "assertEquals", "(", "new", "Vector", "<", "String", ">", "(", ")", ",", "adapter", ".", "parse", "(", "\"no-body\"", ")", ")", ";", "assertEquals", "(", "new", "Vector", "<", "String", ">", "(", ")", ",", "adapter", ".", "parse", "(", "\"\"", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldConvertJSONToXML", "(", ")", "{", "assertThat", "(", "adapter", ".", "toXmlString", "(", "json1", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "}", "}", "</s>" ]
12,842
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "equalTo", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "is", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertEquals", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertThat", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "fail", ";", "import", "static", "org", ".", "mockito", ".", "Mockito", ".", "mock", ";", "import", "static", "org", ".", "mockito", ".", "Mockito", ".", "verify", ";", "import", "static", "org", ".", "mockito", ".", "Mockito", ".", "verifyNoMoreInteractions", ";", "import", "static", "org", ".", "mockito", ".", "Mockito", ".", "when", ";", "import", "java", ".", "util", ".", "Collections", ";", "import", "org", ".", "junit", ".", "Before", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "fit", ".", "Fixture", ";", "public", "class", "RestDataTypeAdapterTest", "{", "private", "RestDataTypeAdapter", "adapter", ";", "@", "Before", "public", "void", "setUp", "(", ")", "{", "adapter", "=", "new", "RestDataTypeAdapter", "(", ")", "{", "}", ";", "}", "@", "Test", "public", "void", "mustAllowStoringOfTheInstanceOfTheCellContent", "(", ")", "{", "adapter", ".", "set", "(", "\"data\"", ")", ";", "assertEquals", "(", "\"data\"", ",", "adapter", ".", "get", "(", ")", ")", ";", "}", "@", "Test", "public", "void", "mustReturnStringRepresentationOfTheCellContent", "(", ")", "{", "adapter", ".", "set", "(", "\"\"", ")", ";", "assertEquals", "(", "\"blank\"", ",", "adapter", ".", "toString", "(", ")", ")", ";", "adapter", ".", "set", "(", "null", ")", ";", "assertEquals", "(", "\"null\"", ",", "adapter", ".", "toString", "(", ")", ")", ";", "adapter", ".", "set", "(", "new", "Object", "(", ")", "{", "public", "String", "toString", "(", ")", "{", "return", "\"x45\"", ";", "}", "}", ")", ";", "assertEquals", "(", "\"x45\"", ",", "adapter", ".", "toString", "(", ")", ")", ";", "}", "@", "Test", "public", "void", "mustAllowStoringOfErrors", "(", ")", "{", "adapter", ".", "addError", "(", "\"error\"", ")", ";", "assertEquals", "(", "\"error\"", ",", "adapter", ".", "getErrors", "(", ")", ".", "get", "(", "0", ")", ")", ";", "}", "@", "Test", "public", "void", "mustDisallowAddToTheErrorsList", "(", ")", "{", "try", "{", "adapter", ".", "getErrors", "(", ")", ".", "add", "(", "\"\"", ")", ";", "}", "catch", "(", "UnsupportedOperationException", "e", ")", "{", "}", "}", "@", "Test", "public", "void", "mustDisallowRemoveFromTheErrorsList", "(", ")", "{", "adapter", ".", "addError", "(", "\"error\"", ")", ";", "try", "{", "adapter", ".", "getErrors", "(", ")", ".", "remove", "(", "0", ")", ";", "}", "catch", "(", "UnsupportedOperationException", "e", ")", "{", "}", "}", "@", "Test", "public", "void", "mustDisallowOpsOnTheErrorsList", "(", ")", "{", "adapter", ".", "addError", "(", "\"error1\"", ")", ";", "adapter", ".", "addError", "(", "\"error2\"", ")", ";", "try", "{", "Collections", ".", "sort", "(", "adapter", ".", "getErrors", "(", ")", ")", ";", "fail", "(", "\"\"", ")", ";", "}", "catch", "(", "UnsupportedOperationException", "e", ")", "{", "}", "}", "@", "Test", "public", "void", "fromRawStringDelegatesToParse", "(", ")", "throws", "Exception", "{", "Fixture", "mockFixture", "=", "mock", "(", "Fixture", ".", "class", ")", ";", "adapter", ".", "init", "(", "mockFixture", ",", "String", ".", "class", ")", ";", "when", "(", "mockFixture", ".", "parse", "(", "\"ss\"", ",", "String", ".", "class", ")", ")", ".", "thenReturn", "(", "\"parsed", "ss\"", ")", ";", "adapter", ".", "fromString", "(", "\"ss\"", ")", ";", "verify", "(", "mockFixture", ")", ".", "parse", "(", "\"ss\"", ",", "String", ".", "class", ")", ";", "verifyNoMoreInteractions", "(", "mockFixture", ")", ";", "}", "@", "Test", "public", "void", "fromRawStringMapsCheckedExceptionsOfParseIntoRuntimeException", "(", ")", "throws", "Exception", "{", "Fixture", "mockFixture", "=", "mock", "(", "Fixture", ".", "class", ")", ";", "adapter", ".", "init", "(", "mockFixture", ",", "String", ".", "class", ")", ";", "when", "(", "mockFixture", ".", "parse", "(", "\"ss\"", ",", "String", ".", "class", ")", ")", ".", "thenThrow", "(", "new", "Exception", "(", "\"\"", ")", ")", ";", "try", "{", "adapter", ".", "fromString", "(", "\"ss\"", ")", ";", "fail", "(", "\"\"", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "assertThat", "(", "e", ".", "getMessage", "(", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "}", "verify", "(", "mockFixture", ")", ".", "parse", "(", "\"ss\"", ",", "String", ".", "class", ")", ";", "verifyNoMoreInteractions", "(", "mockFixture", ")", ";", "}", "}", "</s>" ]
12,843
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertEquals", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertFalse", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertTrue", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "fail", ";", "import", "java", ".", "util", ".", "Arrays", ";", "import", "java", ".", "util", ".", "Collection", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "smartrics", ".", "rest", ".", "client", ".", "RestData", ".", "Header", ";", "public", "class", "HeadersTypeAdapterTest", "{", "private", "final", "HeadersTypeAdapter", "adapter", "=", "new", "HeadersTypeAdapter", "(", ")", ";", "private", "final", "String", "ls", "=", "\"n\"", ";", "private", "final", "Header", "h0", "=", "new", "Header", "(", "\"n0\"", ",", "\"v0\"", ")", ";", "private", "final", "Header", "h1", "=", "new", "Header", "(", "\"n1\"", ",", "\"v1\"", ")", ";", "private", "final", "Header", "h", "=", "new", "Header", "(", "\"n\"", ",", "\"v\"", ")", ";", "private", "final", "Header", "h2", "=", "new", "Header", "(", "\"n1\"", ",", "\"v1\"", ")", ";", "private", "final", "Header", "h3", "=", "new", "Header", "(", "\"n3\"", ",", "\"v3\"", ")", ";", "private", "final", "Header", "h4", "=", "new", "Header", "(", "\"n\"", ",", "\"\"", ")", ";", "private", "final", "Collection", "<", "Header", ">", "expected", "=", "Arrays", ".", "asList", "(", "h", ",", "h2", ",", "h3", ")", ";", "private", "final", "Collection", "<", "Header", ">", "expectedWithColonsInValues", "=", "Arrays", ".", "asList", "(", "h4", ",", "h2", ")", ";", "private", "final", "Header", "h5actual", "=", "new", "Header", "(", "\"content-type\"", ",", "\"\"", ")", ";", "private", "final", "Header", "h5expected", "=", "new", "Header", "(", "\"content-type\"", ",", "\"\"", ")", ";", "private", "final", "Collection", "<", "Header", ">", "expectedWithSemiColonsInValues", "=", "Arrays", ".", "asList", "(", "h5expected", ")", ";", "private", "final", "Collection", "<", "Header", ">", "actualWithSemiColonsInValues", "=", "Arrays", ".", "asList", "(", "h5actual", ")", ";", "private", "final", "Collection", "<", "Header", ">", "actualSubset", "=", "Arrays", ".", "asList", "(", "h", ",", "h2", ")", ";", "private", "final", "Collection", "<", "Header", ">", "actualSame", "=", "Arrays", ".", "asList", "(", "h", ",", "h2", ",", "h3", ")", ";", "private", "final", "Collection", "<", "Header", ">", "actualSuperset", "=", "Arrays", ".", "asList", "(", "h0", ",", "h1", ",", "h", ",", "h2", ",", "h3", ")", ";", "private", "final", "String", "headersAsHtmlString", "=", "\"\"", ";", "private", "final", "String", "headersAsOutputString", "=", "\"n", ":", "v\"", "+", "ls", "+", "\"n1", ":", "v1\"", "+", "ls", "+", "\"n3", ":", "v3\"", ";", "private", "final", "String", "headersAsHtmlStringWithColonsInValue", "=", "\"\"", ";", "@", "Test", "public", "void", "shouldIdentifyContentObjectsWithNoBodyAsBeingEqual", "(", ")", "{", "assertFalse", "(", "adapter", ".", "equals", "(", "null", ",", "null", ")", ")", ";", "}", "@", "Test", "public", "void", "actualHeadersMustBeASupersetOfExpectedHeaders", "(", ")", "{", "assertTrue", "(", "adapter", ".", "equals", "(", "expected", ",", "actualSame", ")", ")", ";", "assertTrue", "(", "adapter", ".", "equals", "(", "expected", ",", "actualSuperset", ")", ")", ";", "}", "@", "Test", "public", "void", "actualHeadersShouldntBeASupersetOfExpectedHeaders", "(", ")", "{", "assertFalse", "(", "adapter", ".", "equals", "(", "expected", ",", "actualSubset", ")", ")", ";", "}", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "@", "Test", "public", "void", "shouldParseHeadersInHtmlFormatAsProperListOfHeaders", "(", ")", "{", "try", "{", "Collection", "<", "Header", ">", "result", "=", "(", "Collection", "<", "Header", ">", ")", "adapter", ".", "parse", "(", "headersAsHtmlString", ")", ";", "assertEquals", "(", "expected", ",", "result", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "fail", "(", ")", ";", "}", "}", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "@", "Test", "public", "void", "shouldParseHeadersInHtmlFormatWithMultipleColonsAsProperListOfHeaders", "(", ")", "{", "try", "{", "Collection", "<", "Header", ">", "result", "=", "(", "Collection", "<", "Header", ">", ")", "adapter", ".", "parse", "(", "headersAsHtmlStringWithColonsInValue", ")", ";", "assertEquals", "(", "expectedWithColonsInValues", ",", "result", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "fail", "(", ")", ";", "}", "}", "@", "Test", "(", "expected", "=", "IllegalArgumentException", ".", "class", ")", "public", "void", "shouldNotifyClientOfBadHeaderSyntax", "(", ")", "{", "try", "{", "adapter", ".", "parse", "(", "\"\"", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "if", "(", "e", "instanceof", "RuntimeException", ")", "{", "throw", "(", "RuntimeException", ")", "e", ";", "}", "fail", "(", "\"\"", ")", ";", "}", "}", "@", "Test", "public", "void", "shouldTransformACollectionOfHeadersIntoAHtmlString", "(", ")", "{", "String", "result", "=", "adapter", ".", "toString", "(", "expected", ")", ";", "assertEquals", "(", "headersAsOutputString", ",", "result", ")", ";", "}", "@", "Test", "public", "void", "shouldMatchHeadersWithRegex", "(", ")", "{", "boolean", "res", "=", "adapter", ".", "equals", "(", "expectedWithSemiColonsInValues", ",", "actualWithSemiColonsInValues", ")", ";", "assertTrue", "(", "\"\"", "+", "h5expected", ",", "res", ")", ";", "}", "}", "</s>" ]
12,844
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertEquals", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertFalse", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertTrue", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "fail", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Arrays", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "java", ".", "util", ".", "Vector", ";", "import", "org", ".", "junit", ".", "Test", ";", "public", "class", "XPathBodyTypeAdapterTest", "{", "private", "final", "XPathBodyTypeAdapter", "adapter", "=", "new", "XPathBodyTypeAdapter", "(", ")", ";", "private", "static", "final", "String", "xml0", "=", "\"\"", ";", "private", "static", "final", "String", "xml1", "=", "\"<a>", "1&</a>\"", ";", "private", "static", "final", "List", "<", "String", ">", "xPaths", "=", "Arrays", ".", "asList", "(", "\"/a\"", ",", "\"//b\"", ")", ";", "private", "static", "final", "String", "xPathsAsString", "=", "\"/a<br/>//b\"", ";", "@", "Test", "public", "void", "shouldIdentifyContentObjectsWithNoBodyAsBeingEqual", "(", ")", "{", "assertTrue", "(", "adapter", ".", "equals", "(", "\"no-body\"", ",", "\"no-body\"", ")", ")", ";", "assertTrue", "(", "adapter", ".", "equals", "(", "\"no-body\"", ",", "\"\"", ")", ")", ";", "assertTrue", "(", "adapter", ".", "equals", "(", "\"no-body\"", ",", "null", ")", ")", ";", "assertFalse", "(", "adapter", ".", "equals", "(", "\"/a\"", ",", "null", ")", ")", ";", "assertFalse", "(", "adapter", ".", "equals", "(", "\"no-body\"", ",", "xml0", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldIdentifyAsEqualsIfExpectedObjectIsAListOfXPathsAvailableInActual", "(", ")", "{", "assertTrue", "(", "\"\"", ",", "adapter", ".", "equals", "(", "Arrays", ".", "asList", "(", "\"\"", ")", ",", "xml0", ")", ")", ";", "assertTrue", "(", "\"\"", ",", "adapter", ".", "equals", "(", "Arrays", ".", "asList", "(", "\"\"", ",", "\"\"", ")", ",", "xml0", ")", ")", ";", "assertTrue", "(", "\"\"", ",", "adapter", ".", "equals", "(", "Arrays", ".", "asList", "(", "\"\"", ",", "\"\"", ")", ",", "xml0", ")", ")", ";", "assertTrue", "(", "\"\"", ",", "adapter", ".", "equals", "(", "Arrays", ".", "asList", "(", "\"\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ")", ",", "xml0", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldStoreNotFoundMessageForEveryExpressionNotFoundForEqualityCheck", "(", ")", "{", "assertFalse", "(", "adapter", ".", "equals", "(", "Arrays", ".", "asList", "(", "\"\"", ",", "\"\"", ",", "\"\"", ")", ",", "xml0", ")", ")", ";", "assertEquals", "(", "2", ",", "adapter", ".", "getErrors", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "adapter", ".", "getErrors", "(", ")", ".", "get", "(", "0", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "adapter", ".", "getErrors", "(", ")", ".", "get", "(", "1", ")", ")", ";", "}", "@", "Test", "(", "expected", "=", "IllegalArgumentException", ".", "class", ")", "public", "void", "shouldFailEqualityCheckIfAnyExpressionIsInvalid", "(", ")", "{", "adapter", ".", "equals", "(", "Arrays", ".", "asList", "(", "\"\"", ",", "\"\"", ")", ",", "xml0", ")", ";", "}", "@", "Test", "public", "void", "shouldReturnItsStringRepresentationAsPrintableHTML", "(", ")", "{", "assertEquals", "(", "xml1", ",", "adapter", ".", "toString", "(", "xml1", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldReturnItsStringRepresentationAsPrintableHTMLEvenWhenEmpty", "(", ")", "{", "assertEquals", "(", "\"no-body\"", ",", "adapter", ".", "toString", "(", "\"\"", ")", ")", ";", "}", "@", "Test", "public", "void", "shoudlParseStringWithXPathInHtmlIntoAProperList", "(", ")", "{", "try", "{", "assertTrue", "(", "xPathsAsString", ".", "indexOf", "(", "\"<br/>\"", ")", ">", "-", "1", ")", ";", "assertEquals", "(", "xPaths", ",", "adapter", ".", "parse", "(", "xPathsAsString", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "fail", "(", "\"\"", ")", ";", "}", "}", "@", "Test", "public", "void", "shoudlParseNoXPathsIntoAnEmptyList", "(", ")", "{", "try", "{", "assertEquals", "(", "new", "Vector", "<", "String", ">", "(", ")", ",", "adapter", ".", "parse", "(", "null", ")", ")", ";", "assertEquals", "(", "new", "Vector", "<", "String", ">", "(", ")", ",", "adapter", ".", "parse", "(", "\"\"", ")", ")", ";", "assertEquals", "(", "new", "Vector", "<", "String", ">", "(", ")", ",", "adapter", ".", "parse", "(", "\"no-body\"", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "fail", "(", "\"\"", ")", ";", "}", "}", "@", "Test", "public", "void", "shouldMatchXPathWithNamespaces", "(", ")", "{", "List", "<", "String", ">", "expected", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "expected", ".", "add", "(", "\"\"", ")", ";", "String", "actual", "=", "\"\"", "+", "\"\"", ";", "Map", "<", "String", ",", "String", ">", "ns", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "ns", ".", "put", "(", "\"ns1alias\"", ",", "\"\"", ")", ";", "adapter", ".", "setContext", "(", "ns", ")", ";", "assertTrue", "(", "adapter", ".", "equals", "(", "expected", ",", "actual", ")", ")", ";", "}", "}", "</s>" ]
12,845
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertTrue", ";", "import", "org", ".", "junit", ".", "Test", ";", "public", "class", "BodyTypeAdapterFactoryTest", "{", "public", "String", "charset", "=", "\"UTF-8\"", ";", "@", "Test", "public", "void", "jsonContentTypeReturnsJSONBodyTypeAdapter", "(", ")", "{", "BodyTypeAdapter", "bodyTypeAdapter", "=", "BodyTypeAdapterFactory", ".", "getBodyTypeAdapter", "(", "ContentType", ".", "JSON", ",", "charset", ")", ";", "assertTrue", "(", "bodyTypeAdapter", "instanceof", "JSONBodyTypeAdapter", ")", ";", "}", "@", "Test", "public", "void", "xmlContentTypeReturnsXPathBodyTypeAdapter", "(", ")", "{", "BodyTypeAdapter", "bodyTypeAdapter", "=", "BodyTypeAdapterFactory", ".", "getBodyTypeAdapter", "(", "ContentType", ".", "XML", ",", "charset", ")", ";", "assertTrue", "(", "bodyTypeAdapter", "instanceof", "XPathBodyTypeAdapter", ")", ";", "}", "@", "Test", "public", "void", "textContentTypeReturnsXPathBodyTypeAdapter", "(", ")", "{", "BodyTypeAdapter", "bodyTypeAdapter", "=", "BodyTypeAdapterFactory", ".", "getBodyTypeAdapter", "(", "ContentType", ".", "TEXT", ",", "charset", ")", ";", "assertTrue", "(", "bodyTypeAdapter", "instanceof", "TextBodyTypeAdapter", ")", ";", "}", "@", "Test", "(", "expected", "=", "IllegalArgumentException", ".", "class", ")", "public", "void", "nullContentTypeThrowsException", "(", ")", "{", "BodyTypeAdapterFactory", ".", "getBodyTypeAdapter", "(", "null", ",", "charset", ")", ";", "}", "@", "Test", "public", "void", "unknownContentTypeReturnsXPathBodyTypeAdapter", "(", ")", "{", "BodyTypeAdapter", "bodyTypeAdapter", "=", "BodyTypeAdapterFactory", ".", "getBodyTypeAdapter", "(", "ContentType", ".", "typeFor", "(", "\"unknown\"", ")", ",", "charset", ")", ";", "assertTrue", "(", "bodyTypeAdapter", "instanceof", "XPathBodyTypeAdapter", ")", ";", "}", "}", "</s>" ]
12,846
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "equalTo", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "is", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "nullValue", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertThat", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "fail", ";", "import", "org", ".", "junit", ".", "Before", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "smartrics", ".", "rest", ".", "client", ".", "RestResponse", ";", "public", "class", "JavascriptWrapperTest", "{", "private", "Variables", "variables", ";", "@", "Before", "public", "void", "setUp", "(", ")", "{", "variables", "=", "new", "Variables", "(", ")", ";", "variables", ".", "clearAll", "(", ")", ";", "}", "@", "Test", "public", "void", "shouldProvideSymbolMapInJsContext", "(", ")", "{", "variables", ".", "put", "(", "\"my_sym\"", ",", "\"98\"", ")", ";", "RestResponse", "response", "=", "new", "RestResponse", "(", ")", ";", "JavascriptWrapper", "h", "=", "new", "JavascriptWrapper", "(", ")", ";", "Object", "res", "=", "h", ".", "evaluateExpression", "(", "response", ",", "\"\"", ")", ";", "assertThat", "(", "res", ".", "toString", "(", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldProvideLastResponseBodyInJsContext", "(", ")", "{", "RestResponse", "response", "=", "createResponse", "(", ")", ";", "JavascriptWrapper", "h", "=", "new", "JavascriptWrapper", "(", ")", ";", "Object", "res", "=", "h", ".", "evaluateExpression", "(", "response", ",", "\"\"", ")", ";", "assertThat", "(", "res", ".", "toString", "(", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldProvideLastResponseBodyAsJsonForJsonContentTypeInJsContext", "(", ")", "{", "String", "json", "=", "\"\"", ";", "RestResponse", "response", "=", "createResponse", "(", "ContentType", ".", "JSON", ",", "json", ")", ";", "JavascriptWrapper", "h", "=", "new", "JavascriptWrapper", "(", ")", ";", "Object", "res", "=", "h", ".", "evaluateExpression", "(", "response", ",", "\"\"", ")", ";", "assertThat", "(", "res", ".", "toString", "(", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldProvideLastResponseBodyAsJsonForContentThatLooksLikeJsonInJsContext", "(", ")", "{", "String", "json", "=", "\"\"", ";", "RestResponse", "response", "=", "createResponse", "(", "ContentType", ".", "TEXT", ",", "json", ")", ";", "JavascriptWrapper", "h", "=", "new", "JavascriptWrapper", "(", ")", ";", "Object", "res", "=", "h", ".", "evaluateExpression", "(", "response", ",", "\"\"", ")", ";", "assertThat", "(", "res", ".", "toString", "(", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldNotProvideLastResponseBodyInJsContextIfResponseIsNull", "(", ")", "{", "JavascriptWrapper", "h", "=", "new", "JavascriptWrapper", "(", ")", ";", "Object", "res", "=", "h", ".", "evaluateExpression", "(", "(", "RestResponse", ")", "null", ",", "\"\"", ")", ";", "assertThat", "(", "res", ".", "toString", "(", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldHandleNullReturnedByJsEvaluation", "(", ")", "{", "JavascriptWrapper", "h", "=", "new", "JavascriptWrapper", "(", ")", ";", "Object", "res", "=", "h", ".", "evaluateExpression", "(", "(", "RestResponse", ")", "null", ",", "\"null\"", ")", ";", "assertThat", "(", "res", ",", "is", "(", "nullValue", "(", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldHandleNullReturnedByStringJsEvaluation", "(", ")", "{", "JavascriptWrapper", "h", "=", "new", "JavascriptWrapper", "(", ")", ";", "Object", "res", "=", "h", ".", "evaluateExpression", "(", "(", "String", ")", "null", ",", "\"null\"", ")", ";", "assertThat", "(", "res", ",", "is", "(", "nullValue", "(", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldProvideLastResponseResourceInJsContext", "(", ")", "{", "RestResponse", "response", "=", "createResponse", "(", ")", ";", "JavascriptWrapper", "h", "=", "new", "JavascriptWrapper", "(", ")", ";", "Object", "res", "=", "h", ".", "evaluateExpression", "(", "response", ",", "\"\"", ")", ";", "assertThat", "(", "res", ".", "toString", "(", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldProvideLastResponseStatusTextInJsContext", "(", ")", "{", "RestResponse", "response", "=", "createResponse", "(", ")", ";", "JavascriptWrapper", "h", "=", "new", "JavascriptWrapper", "(", ")", ";", "Object", "res", "=", "h", ".", "evaluateExpression", "(", "response", ",", "\"\"", ")", ";", "assertThat", "(", "res", ".", "toString", "(", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldProvideLastResponseTxIdInJsContext", "(", ")", "{", "RestResponse", "response", "=", "createResponse", "(", ")", ";", "JavascriptWrapper", "h", "=", "new", "JavascriptWrapper", "(", ")", ";", "Object", "res", "=", "h", ".", "evaluateExpression", "(", "response", ",", "\"\"", ")", ";", "assertThat", "(", "res", ".", "toString", "(", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldProvideLastResponseStatusCodeInJsContext", "(", ")", "{", "RestResponse", "response", "=", "createResponse", "(", ")", ";", "JavascriptWrapper", "h", "=", "new", "JavascriptWrapper", "(", ")", ";", "Object", "res", "=", "h", ".", "evaluateExpression", "(", "response", ",", "\"\"", ")", ";", "assertThat", "(", "res", ".", "toString", "(", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldProvideLastResponseHeadersInJsContext", "(", ")", "{", "RestResponse", "response", "=", "createResponse", "(", ")", ";", "JavascriptWrapper", "h", "=", "new", "JavascriptWrapper", "(", ")", ";", "Object", "res", "=", "h", ".", "evaluateExpression", "(", "response", ",", "\"\"", ")", ";", "assertThat", "(", "res", ".", "toString", "(", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "res", "=", "h", ".", "evaluateExpression", "(", "response", ",", "\"\"", ")", ";", "assertThat", "(", "res", ".", "toString", "(", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "res", "=", "h", ".", "evaluateExpression", "(", "response", ",", "\"\"", ")", ";", "assertThat", "(", "res", ".", "toString", "(", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "res", "=", "h", ".", "evaluateExpression", "(", "response", ",", "\"\"", ")", ";", "assertThat", "(", "res", ".", "toString", "(", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "res", "=", "h", ".", "evaluateExpression", "(", "response", ",", "\"\"", ")", ";", "assertThat", "(", "res", ".", "toString", "(", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "res", "=", "h", ".", "evaluateExpression", "(", "response", ",", "\"\"", ")", ";", "assertThat", "(", "res", ".", "toString", "(", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "res", "=", "h", ".", "evaluateExpression", "(", "response", ",", "\"\"", ")", ";", "assertThat", "(", "res", ".", "toString", "(", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldTrapJavascriptErrorAndWrapThemInErrors", "(", ")", "{", "RestResponse", "response", "=", "createResponse", "(", ")", ";", "JavascriptWrapper", "h", "=", "new", "JavascriptWrapper", "(", ")", ";", "try", "{", "h", ".", "evaluateExpression", "(", "response", ",", "\"\"", ")", ";", "fail", "(", "\"\"", ")", ";", "}", "catch", "(", "JavascriptException", "e", ")", "{", "assertThat", "(", "e", ".", "getMessage", "(", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "}", "}", "private", "RestResponse", "createResponse", "(", ")", "{", "RestResponse", "r", "=", "createResponse", "(", "ContentType", ".", "XML", ",", "\"<xml", "/>\"", ")", ";", "return", "r", ";", "}", "private", "RestResponse", "createResponse", "(", "ContentType", "contentType", ",", "String", "body", ")", "{", "RestResponse", "response", "=", "new", "RestResponse", "(", ")", ";", "response", ".", "setResource", "(", "\"/resources\"", ")", ";", "response", ".", "setStatusCode", "(", "200", ")", ";", "response", ".", "setStatusText", "(", "\"OK\"", ")", ";", "response", ".", "setBody", "(", "body", ")", ";", "response", ".", "addHeader", "(", "\"Content-Type\"", ",", "contentType", ".", "toMime", "(", ")", ".", "get", "(", "0", ")", ")", ";", "response", ".", "addHeader", "(", "\"\"", ",", "\"jolly\"", ")", ";", "response", ".", "addHeader", "(", "\"\"", ",", "\"good\"", ")", ";", "response", ".", "addHeader", "(", "\"\"", ",", "\"7\"", ")", ";", "response", ".", "setTransactionId", "(", "123456789L", ")", ";", "return", "response", ";", "}", "}", "</s>" ]
12,847
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "equalTo", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "is", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertThat", ";", "import", "org", ".", "junit", ".", "Before", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "SlimCell", ";", "public", "class", "SlimCellTest", "{", "private", "SlimCell", "c", ";", "@", "Before", "public", "void", "setUp", "(", ")", "{", "c", "=", "new", "SlimCell", "(", "\"content\"", ")", ";", "}", "@", "Test", "public", "void", "testConstruction", "(", ")", "{", "assertThat", "(", "c", ".", "body", "(", ")", ",", "is", "(", "equalTo", "(", "\"content\"", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "testAddBodyAppendsContentToExisting", "(", ")", "{", "c", ".", "addToBody", "(", "\"_more\"", ")", ";", "assertThat", "(", "c", ".", "body", "(", ")", ",", "is", "(", "equalTo", "(", "\"content_more\"", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "textAndBodyAreEquivalent", "(", ")", "{", "assertThat", "(", "c", ".", "body", "(", ")", ",", "is", "(", "equalTo", "(", "c", ".", "text", "(", ")", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldBeAbleToOverrideTheContent", "(", ")", "{", "c", ".", "body", "(", "\"another\"", ")", ";", "assertThat", "(", "\"another\"", ",", "is", "(", "equalTo", "(", "c", ".", "body", "(", ")", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "wrappedObjectIsTheStringUsedForConstruction", "(", ")", "{", "assertThat", "(", "\"content\"", ",", "is", "(", "equalTo", "(", "c", ".", "getWrapped", "(", ")", ")", ")", ")", ";", "}", "}", "</s>" ]
12,848
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "equalTo", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "is", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertThat", ";", "import", "org", ".", "junit", ".", "Before", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "FitCell", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "RestFixtureTestHelper", ";", "import", "fit", ".", "Parse", ";", "public", "class", "FitCellTest", "{", "private", "FitCell", "c", ";", "@", "Before", "public", "void", "setUp", "(", ")", "throws", "Exception", "{", "RestFixtureTestHelper", "helper", "=", "new", "RestFixtureTestHelper", "(", ")", ";", "Parse", "p", "=", "helper", ".", "createSingleRowFitTable", "(", "\"justone\"", ")", ";", "c", "=", "new", "FitCell", "(", "p", ".", "parts", ".", "parts", ")", ";", "}", "@", "Test", "public", "void", "testConstruction", "(", ")", "{", "assertThat", "(", "c", ".", "body", "(", ")", ",", "is", "(", "equalTo", "(", "\"justone\"", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "testAddBodyAppendsContentToExisting", "(", ")", "{", "c", ".", "addToBody", "(", "\"_more\"", ")", ";", "assertThat", "(", "c", ".", "body", "(", ")", ",", "is", "(", "equalTo", "(", "\"justone_more\"", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "textAndBodyAreEquivalent", "(", ")", "{", "assertThat", "(", "c", ".", "body", "(", ")", ",", "is", "(", "equalTo", "(", "c", ".", "text", "(", ")", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "shouldBeAbleToOverrideTheContent", "(", ")", "{", "c", ".", "body", "(", "\"another\"", ")", ";", "assertThat", "(", "\"another\"", ",", "is", "(", "equalTo", "(", "c", ".", "body", "(", ")", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "wrappedObjectIsTheStringUsedForConstruction", "(", ")", "{", "assertThat", "(", "\"justone\"", ",", "is", "(", "equalTo", "(", "c", ".", "getWrapped", "(", ")", ".", "body", ")", ")", ")", ";", "}", "}", "</s>" ]
12,849
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "equalTo", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "is", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "nullValue", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertEquals", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertThat", ";", "import", "static", "org", ".", "mockito", ".", "Matchers", ".", "any", ";", "import", "static", "org", ".", "mockito", ".", "Matchers", ".", "eq", ";", "import", "static", "org", ".", "mockito", ".", "Matchers", ".", "isA", ";", "import", "static", "org", ".", "mockito", ".", "Mockito", ".", "mock", ";", "import", "static", "org", ".", "mockito", ".", "Mockito", ".", "times", ";", "import", "static", "org", ".", "mockito", ".", "Mockito", ".", "verify", ";", "import", "static", "org", ".", "mockito", ".", "Mockito", ".", "verifyNoMoreInteractions", ";", "import", "static", "org", ".", "mockito", ".", "Mockito", ".", "when", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "junit", ".", "After", ";", "import", "org", ".", "junit", ".", "Before", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "smartrics", ".", "rest", ".", "client", ".", "RestClient", ";", "import", "smartrics", ".", "rest", ".", "client", ".", "RestRequest", ";", "import", "smartrics", ".", "rest", ".", "client", ".", "RestRequest", ".", "Method", ";", "import", "smartrics", ".", "rest", ".", "client", ".", "RestResponse", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "RestFixture", ".", "Runner", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "BodyTypeAdapter", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "CellFormatter", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "CellWrapper", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "Config", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "ContentType", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "HeadersTypeAdapter", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "JavascriptException", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "RowWrapper", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "StatusCodeTypeAdapter", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "StringTypeAdapter", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "Variables", ";", "import", "fit", ".", "Fixture", ";", "public", "class", "RestFixtureTest", "{", "private", "static", "final", "String", "BASE_URL", "=", "\"\"", ";", "private", "RestFixture", "fixture", ";", "private", "final", "Variables", "variables", "=", "new", "Variables", "(", ")", ";", "private", "RestFixtureTestHelper", "helper", ";", "private", "PartsFactory", "mockPartsFactory", ";", "private", "RestClient", "mockRestClient", ";", "private", "RestRequest", "mockLastRequest", ";", "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "private", "CellFormatter", "mockCellFormatter", ";", "private", "Config", "config", ";", "private", "RestResponse", "lastResponse", ";", "private", "BodyTypeAdapter", "mockBodyTypeAdapter", ";", "@", "Before", "public", "void", "setUp", "(", ")", "{", "helper", "=", "new", "RestFixtureTestHelper", "(", ")", ";", "mockBodyTypeAdapter", "=", "mock", "(", "BodyTypeAdapter", ".", "class", ")", ";", "mockCellFormatter", "=", "mock", "(", "CellFormatter", ".", "class", ")", ";", "mockRestClient", "=", "mock", "(", "RestClient", ".", "class", ")", ";", "mockLastRequest", "=", "mock", "(", "RestRequest", ".", "class", ")", ";", "mockPartsFactory", "=", "mock", "(", "PartsFactory", ".", "class", ")", ";", "variables", ".", "clearAll", "(", ")", ";", "lastResponse", "=", "new", "RestResponse", "(", ")", ";", "lastResponse", ".", "setStatusCode", "(", "200", ")", ";", "lastResponse", ".", "setBody", "(", "\"\"", ")", ";", "lastResponse", ".", "setResource", "(", "\"/uri\"", ")", ";", "lastResponse", ".", "setStatusText", "(", "\"OK\"", ")", ";", "lastResponse", ".", "setTransactionId", "(", "0L", ")", ";", "config", "=", "Config", ".", "getConfig", "(", ")", ";", "ContentType", ".", "resetDefaultMapping", "(", ")", ";", "helper", ".", "wireMocks", "(", "config", ",", "mockPartsFactory", ",", "mockRestClient", ",", "mockLastRequest", ",", "lastResponse", ",", "mockCellFormatter", ",", "mockBodyTypeAdapter", ")", ";", "fixture", "=", "new", "RestFixture", "(", "mockPartsFactory", ",", "BASE_URL", ",", "Config", ".", "DEFAULT_CONFIG_NAME", ")", ";", "fixture", ".", "initialize", "(", "Runner", ".", "OTHER", ")", ";", "}", "@", "After", "public", "void", "tearDown", "(", ")", "{", "config", ".", "clear", "(", ")", ";", "}", "@", "Test", "public", "void", "mustSetConfigNameToDefaultWhenNotSpecifiedAsSecondOptionalParameter_SLIM", "(", ")", "{", "fixture", "=", "new", "RestFixture", "(", "BASE_URL", ",", "\"configName\"", ")", ";", "assertEquals", "(", "\"configName\"", ",", "fixture", ".", "getConfig", "(", ")", ".", "getName", "(", ")", ")", ";", "}", "@", "Test", "public", "void", "mustSetConfigNameToSpecifiedValueIfOptionalSecondParameterIsSpecified_SLIM", "(", ")", "{", "fixture", "=", "new", "RestFixture", "(", "BASE_URL", ",", "\"configName\"", ")", ";", "assertEquals", "(", "\"configName\"", ",", "fixture", ".", "getConfig", "(", ")", ".", "getName", "(", ")", ")", ";", "}", "@", "Test", "public", "void", "mustUseDefaultHeadersIfDefinedOnNamedConfig", "(", ")", "{", "config", ".", "add", "(", "\"\"", ",", "\"added1", ":", "1\"", "+", "System", ".", "getProperty", "(", "\"\"", ")", "+", "\"added2", ":", "2\"", ")", ";", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"GET\"", ",", "\"/uri\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "addHeaders", "(", "fixture", ".", "getDefaultHeaders", "(", ")", ")", ";", "}", "@", "Test", "public", "void", "mustAllowMultilineHeadersWhenSettingHeaders", "(", ")", "{", "String", "multilineHeaders", "=", "\"\"", ";", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"setHeaders\"", ",", "multilineHeaders", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "assertEquals", "(", "\"one\"", ",", "fixture", ".", "getHeaders", "(", ")", ".", "get", "(", "\"header1\"", ")", ")", ";", "assertEquals", "(", "\"two\"", ",", "fixture", ".", "getHeaders", "(", ")", ".", "get", "(", "\"header2\"", ")", ")", ";", "assertEquals", "(", "\"with:colon\"", ",", "fixture", ".", "getHeaders", "(", ")", ".", "get", "(", "\"header3\"", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "fixture", ".", "getHeaders", "(", ")", ".", "get", "(", "\"header4\"", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "fixture", ".", "getHeaders", "(", ")", ".", "get", "(", "\"header5\"", ")", ")", ";", "}", "@", "Test", "public", "void", "mustExpandSymbolsWhenSettingMultilineHeaders", "(", ")", "{", "Fixture", ".", "setSymbol", "(", "\"hval1\"", ",", "\"one\"", ")", ";", "Fixture", ".", "setSymbol", "(", "\"hval2\"", ",", "\"two\"", ")", ";", "String", "multilineHeaders", "=", "\"\"", ";", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"setHeaders\"", ",", "multilineHeaders", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "assertEquals", "(", "\"one\"", ",", "fixture", ".", "getHeaders", "(", ")", ".", "get", "(", "\"header1\"", ")", ")", ";", "assertEquals", "(", "\"two\"", ",", "fixture", ".", "getHeaders", "(", ")", ".", "get", "(", "\"header2\"", ")", ")", ";", "assertEquals", "(", "\"with:colon\"", ",", "fixture", ".", "getHeaders", "(", ")", ".", "get", "(", "\"header3\"", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "fixture", ".", "getHeaders", "(", ")", ".", "get", "(", "\"header4\"", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "fixture", ".", "getHeaders", "(", ")", ".", "get", "(", "\"header5\"", ")", ")", ";", "}", "@", "Test", "public", "void", "mustAllowSettingHeaders", "(", ")", "{", "String", "header", "=", "\"header1:one\"", ";", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"setHeader\"", ",", "header", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "assertEquals", "(", "\"one\"", ",", "fixture", ".", "getHeaders", "(", ")", ".", "get", "(", "\"header1\"", ")", ")", ";", "}", "@", "Test", "public", "void", "mustExpandSymbolSetWithLetWhenSettingHeaders", "(", ")", "{", "when", "(", "mockLastRequest", ".", "getQuery", "(", ")", ")", ".", "thenReturn", "(", "\"\"", ")", ";", "when", "(", "mockRestClient", ".", "getBaseUrl", "(", ")", ")", ".", "thenReturn", "(", "BASE_URL", ")", ";", "lastResponse", ".", "setBody", "(", "\"\"", ")", ";", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"GET\"", ",", "\"/uri\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "row", "=", "helper", ".", "createTestRow", "(", "\"let\"", ",", "\"headerValue\"", ",", "\"body\"", ",", "\"/body/text()\"", ",", "\"1234\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "row", "=", "helper", ".", "createTestRow", "(", "\"setHeader\"", ",", "\"\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "assertEquals", "(", "\"1234\"", ",", "fixture", ".", "getHeaders", "(", ")", ".", "get", "(", "\"header1\"", ")", ")", ";", "}", "@", "Test", "public", "void", "mustExpandSymbolWhenSettingHeaders", "(", ")", "{", "Fixture", ".", "setSymbol", "(", "\"hval\"", ",", "\"one\"", ")", ";", "String", "header", "=", "\"\"", ";", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"setHeader\"", ",", "header", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "assertEquals", "(", "\"one\"", ",", "fixture", ".", "getHeaders", "(", ")", ".", "get", "(", "\"\"", ")", ")", ";", "}", "@", "Test", "public", "void", "mustRenderSymbolValueWhenSettingHeaders", "(", ")", "{", "Fixture", ".", "setSymbol", "(", "\"hval\"", ",", "\"one\"", ")", ";", "String", "header", "=", "\"\"", ";", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"setHeader\"", ",", "header", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "verify", "(", "row", ".", "getCell", "(", "1", ")", ")", ".", "text", "(", ")", ";", "verify", "(", "row", ".", "getCell", "(", "1", ")", ")", ".", "body", "(", "\"\"", ")", ";", "verifyNoMoreInteractions", "(", "row", ".", "getCell", "(", "1", ")", ")", ";", "}", "@", "Test", "(", "expected", "=", "RuntimeException", ".", "class", ")", "public", "void", "mustNotifyClientIfHTTPVerbInFirstCellIsNotSupported", "(", ")", "{", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"IDONTEXIST\"", ",", "\"/uri\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "}", "@", "Test", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "mustNotifyClientIfExpectedBodyCellHasNotBeenSpecified", "(", ")", "{", "when", "(", "mockRestClient", ".", "getBaseUrl", "(", ")", ")", ".", "thenReturn", "(", "BASE_URL", ")", ";", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"GET\"", ",", "\"/uri\"", ",", "\"\"", ",", "\"\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "exception", "(", "any", "(", "CellWrapper", ".", "class", ")", ",", "eq", "(", "\"\"", ")", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "asLink", "(", "any", "(", "CellWrapper", ".", "class", ")", ",", "eq", "(", "BASE_URL", "+", "\"/uri\"", ")", ",", "eq", "(", "\"/uri\"", ")", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "gray", "(", "\"200\"", ")", ";", "verifyNoMoreInteractions", "(", "mockCellFormatter", ")", ";", "}", "@", "Test", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "mustNotifyClientIfExpectedHeadersCellHasNotBeenSpecified", "(", ")", "{", "when", "(", "mockRestClient", ".", "getBaseUrl", "(", ")", ")", ".", "thenReturn", "(", "BASE_URL", ")", ";", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"GET\"", ",", "\"/uri\"", ",", "\"\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "exception", "(", "any", "(", "CellWrapper", ".", "class", ")", ",", "eq", "(", "\"\"", ")", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "asLink", "(", "any", "(", "CellWrapper", ".", "class", ")", ",", "eq", "(", "BASE_URL", "+", "\"/uri\"", ")", ",", "eq", "(", "\"/uri\"", ")", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "gray", "(", "\"200\"", ")", ";", "verifyNoMoreInteractions", "(", "mockCellFormatter", ")", ";", "}", "@", "Test", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "mustNotifyClientIfExpectedStatusCodeCellHasNotBeenSpecified", "(", ")", "{", "when", "(", "mockRestClient", ".", "getBaseUrl", "(", ")", ")", ".", "thenReturn", "(", "BASE_URL", ")", ";", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"GET\"", ",", "\"/uri\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "exception", "(", "any", "(", "CellWrapper", ".", "class", ")", ",", "eq", "(", "\"\"", ")", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "asLink", "(", "any", "(", "CellWrapper", ".", "class", ")", ",", "eq", "(", "BASE_URL", "+", "\"/uri\"", ")", ",", "eq", "(", "\"/uri\"", ")", ")", ";", "verifyNoMoreInteractions", "(", "mockCellFormatter", ")", ";", "}", "@", "Test", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "mustExecuteVerbByOverridingBaseUriIfRowResourceIsAbsoluteUri", "(", ")", "{", "when", "(", "mockBodyTypeAdapter", ".", "toString", "(", ")", ")", ".", "thenReturn", "(", "\"\"", ")", ";", "when", "(", "mockLastRequest", ".", "getQuery", "(", ")", ")", ".", "thenReturn", "(", "\"a=b\"", ")", ";", "when", "(", "mockRestClient", ".", "getBaseUrl", "(", ")", ")", ".", "thenReturn", "(", "\"\"", ")", ";", "lastResponse", ".", "setResource", "(", "\"\"", ")", ";", "lastResponse", ".", "addHeader", "(", "\"Header\"", ",", "\"some/thing\"", ")", ";", "lastResponse", ".", "setBody", "(", "\"<body", "/>\"", ")", ";", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"GET\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "addHeaders", "(", "fixture", ".", "getHeaders", "(", ")", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "setMethod", "(", "Method", ".", "Get", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "setResource", "(", "\"\"", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "setQuery", "(", "\"a=b\"", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "setMultipartFileParameterName", "(", "\"file\"", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "getQuery", "(", ")", ";", "verify", "(", "mockRestClient", ")", ".", "setBaseUrl", "(", "\"\"", ")", ";", "verify", "(", "mockRestClient", ")", ".", "getBaseUrl", "(", ")", ";", "verify", "(", "mockRestClient", ")", ".", "execute", "(", "mockLastRequest", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "asLink", "(", "any", "(", "CellWrapper", ".", "class", ")", ",", "eq", "(", "\"\"", ")", ",", "eq", "(", "\"\"", ")", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "gray", "(", "\"200\"", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "gray", "(", "\"\"", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "gray", "(", "\"\"", ")", ";", "verify", "(", "mockBodyTypeAdapter", ")", ".", "setContext", "(", "isA", "(", "Map", ".", "class", ")", ")", ";", "verify", "(", "mockBodyTypeAdapter", ")", ".", "set", "(", "\"<body", "/>\"", ")", ";", "verifyNoMoreInteractions", "(", "mockRestClient", ")", ";", "verifyNoMoreInteractions", "(", "mockCellFormatter", ")", ";", "verifyNoMoreInteractions", "(", "mockBodyTypeAdapter", ")", ";", "}", "@", "Test", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "mustExecuteVerbOnAUriWithNoExcpectationsOnRestResponseParts", "(", ")", "{", "when", "(", "mockBodyTypeAdapter", ".", "toString", "(", ")", ")", ".", "thenReturn", "(", "\"\"", ")", ";", "when", "(", "mockLastRequest", ".", "getQuery", "(", ")", ")", ".", "thenReturn", "(", "\"a=b\"", ")", ";", "when", "(", "mockRestClient", ".", "getBaseUrl", "(", ")", ")", ".", "thenReturn", "(", "BASE_URL", ")", ";", "lastResponse", ".", "setResource", "(", "\"/uri\"", ")", ";", "lastResponse", ".", "addHeader", "(", "\"Header\"", ",", "\"some/thing\"", ")", ";", "lastResponse", ".", "setBody", "(", "\"<body", "/>\"", ")", ";", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"GET\"", ",", "\"/uri?a=b\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "addHeaders", "(", "fixture", ".", "getHeaders", "(", ")", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "setMethod", "(", "Method", ".", "Get", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "setResource", "(", "\"/uri\"", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "setQuery", "(", "\"a=b\"", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "setMultipartFileParameterName", "(", "\"file\"", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "getQuery", "(", ")", ";", "verify", "(", "mockRestClient", ")", ".", "setBaseUrl", "(", "fixture", ".", "getBaseUrl", "(", ")", ")", ";", "verify", "(", "mockRestClient", ")", ".", "getBaseUrl", "(", ")", ";", "verify", "(", "mockRestClient", ")", ".", "execute", "(", "mockLastRequest", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "asLink", "(", "any", "(", "CellWrapper", ".", "class", ")", ",", "eq", "(", "BASE_URL", "+", "\"/uri?a=b\"", ")", ",", "eq", "(", "\"/uri?a=b\"", ")", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "gray", "(", "\"200\"", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "gray", "(", "\"\"", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "gray", "(", "\"\"", ")", ";", "verify", "(", "mockBodyTypeAdapter", ")", ".", "setContext", "(", "isA", "(", "Map", ".", "class", ")", ")", ";", "verify", "(", "mockBodyTypeAdapter", ")", ".", "set", "(", "\"<body", "/>\"", ")", ";", "verifyNoMoreInteractions", "(", "mockRestClient", ")", ";", "verifyNoMoreInteractions", "(", "mockCellFormatter", ")", ";", "verifyNoMoreInteractions", "(", "mockBodyTypeAdapter", ")", ";", "}", "@", "Test", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "mustExecutePOSTWithFileUploadWhenFileParamNameIsDefault", "(", ")", "throws", "Exception", "{", "String", "body", "=", "\"\"", ";", "when", "(", "mockBodyTypeAdapter", ".", "toString", "(", ")", ")", ".", "thenReturn", "(", "body", ")", ";", "when", "(", "mockBodyTypeAdapter", ".", "parse", "(", "body", ")", ")", ".", "thenReturn", "(", "body", ")", ";", "when", "(", "mockBodyTypeAdapter", ".", "equals", "(", "body", ",", "body", ")", ")", ".", "thenReturn", "(", "true", ")", ";", "when", "(", "mockLastRequest", ".", "getQuery", "(", ")", ")", ".", "thenReturn", "(", "\"\"", ")", ";", "when", "(", "mockRestClient", ".", "getBaseUrl", "(", ")", ")", ".", "thenReturn", "(", "BASE_URL", ")", ";", "lastResponse", ".", "setStatusCode", "(", "202", ")", ";", "lastResponse", ".", "addHeader", "(", "\"Content-Type\"", ",", "\"\"", ")", ";", "lastResponse", ".", "addHeader", "(", "\"\"", ",", "\"chunked\"", ")", ";", "lastResponse", ".", "setBody", "(", "body", ")", ";", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"POST\"", ",", "\"/uri\"", ",", "\"\"", ",", "\"\"", ",", "body", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "addHeaders", "(", "fixture", ".", "getHeaders", "(", ")", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "getQuery", "(", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "setMethod", "(", "Method", ".", "Post", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "setResource", "(", "\"/uri\"", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "setBody", "(", "\"\"", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "setMultipartFileParameterName", "(", "\"file\"", ")", ";", "verify", "(", "mockRestClient", ")", ".", "setBaseUrl", "(", "fixture", ".", "getBaseUrl", "(", ")", ")", ";", "verify", "(", "mockRestClient", ")", ".", "getBaseUrl", "(", ")", ";", "verify", "(", "mockRestClient", ")", ".", "execute", "(", "mockLastRequest", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "asLink", "(", "any", "(", "CellWrapper", ".", "class", ")", ",", "eq", "(", "BASE_URL", "+", "\"/uri\"", ")", ",", "eq", "(", "\"/uri\"", ")", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "gray", "(", "\"202\"", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "right", "(", "isA", "(", "CellWrapper", ".", "class", ")", ",", "eq", "(", "mockBodyTypeAdapter", ")", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "gray", "(", "\"\"", ")", ";", "verify", "(", "mockBodyTypeAdapter", ")", ".", "setContext", "(", "isA", "(", "Map", ".", "class", ")", ")", ";", "verify", "(", "mockBodyTypeAdapter", ")", ".", "set", "(", "body", ")", ";", "verify", "(", "mockBodyTypeAdapter", ")", ".", "parse", "(", "body", ")", ";", "verify", "(", "mockBodyTypeAdapter", ")", ".", "equals", "(", "body", ",", "body", ")", ";", "verifyNoMoreInteractions", "(", "mockBodyTypeAdapter", ")", ";", "verifyNoMoreInteractions", "(", "mockLastRequest", ")", ";", "verifyNoMoreInteractions", "(", "mockRestClient", ")", ";", "verifyNoMoreInteractions", "(", "mockCellFormatter", ")", ";", "}", "@", "Test", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "mustExecuteVerbOnAUriWithExcpectationsSetOnEachResponsePart_ExpectationsMatched", "(", ")", "throws", "Exception", "{", "when", "(", "mockBodyTypeAdapter", ".", "toString", "(", ")", ")", ".", "thenReturn", "(", "\"\"", ")", ";", "when", "(", "mockLastRequest", ".", "getQuery", "(", ")", ")", ".", "thenReturn", "(", "\"a=b\"", ")", ";", "when", "(", "mockRestClient", ".", "getBaseUrl", "(", ")", ")", ".", "thenReturn", "(", "BASE_URL", ")", ";", "when", "(", "mockBodyTypeAdapter", ".", "parse", "(", "\"//body\"", ")", ")", ".", "thenReturn", "(", "\"//body\"", ")", ";", "when", "(", "mockBodyTypeAdapter", ".", "equals", "(", "\"//body\"", ",", "\"<body", "/>\"", ")", ")", ".", "thenReturn", "(", "true", ")", ";", "lastResponse", ".", "setResource", "(", "\"/uri\"", ")", ";", "lastResponse", ".", "addHeader", "(", "\"Header\"", ",", "\"some/thing\"", ")", ";", "lastResponse", ".", "setBody", "(", "\"<body", "/>\"", ")", ";", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"GET\"", ",", "\"/uri?a=b\"", ",", "\"200\"", ",", "\"\"", ",", "\"//body\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "addHeaders", "(", "fixture", ".", "getHeaders", "(", ")", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "setMethod", "(", "Method", ".", "Get", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "setResource", "(", "\"/uri\"", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "setQuery", "(", "\"a=b\"", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "setMultipartFileParameterName", "(", "\"file\"", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "getQuery", "(", ")", ";", "verify", "(", "mockRestClient", ")", ".", "setBaseUrl", "(", "fixture", ".", "getBaseUrl", "(", ")", ")", ";", "verify", "(", "mockRestClient", ")", ".", "getBaseUrl", "(", ")", ";", "verify", "(", "mockRestClient", ")", ".", "execute", "(", "mockLastRequest", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "asLink", "(", "isA", "(", "CellWrapper", ".", "class", ")", ",", "eq", "(", "BASE_URL", "+", "\"/uri?a=b\"", ")", ",", "eq", "(", "\"/uri?a=b\"", ")", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "right", "(", "isA", "(", "CellWrapper", ".", "class", ")", ",", "isA", "(", "StatusCodeTypeAdapter", ".", "class", ")", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "right", "(", "isA", "(", "CellWrapper", ".", "class", ")", ",", "isA", "(", "HeadersTypeAdapter", ".", "class", ")", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "right", "(", "isA", "(", "CellWrapper", ".", "class", ")", ",", "eq", "(", "mockBodyTypeAdapter", ")", ")", ";", "verify", "(", "mockBodyTypeAdapter", ")", ".", "setContext", "(", "isA", "(", "Map", ".", "class", ")", ")", ";", "verify", "(", "mockBodyTypeAdapter", ")", ".", "set", "(", "\"<body", "/>\"", ")", ";", "verify", "(", "mockBodyTypeAdapter", ")", ".", "parse", "(", "\"//body\"", ")", ";", "verify", "(", "mockBodyTypeAdapter", ")", ".", "equals", "(", "\"//body\"", ",", "\"<body", "/>\"", ")", ";", "verifyNoMoreInteractions", "(", "mockBodyTypeAdapter", ")", ";", "verifyNoMoreInteractions", "(", "mockRestClient", ")", ";", "verifyNoMoreInteractions", "(", "mockCellFormatter", ")", ";", "verifyNoMoreInteractions", "(", "mockLastRequest", ")", ";", "}", "@", "Test", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "mustExecuteVerbOnAUriWithExcpectationsSetOnEachResponsePart_ExpectationsNotMatched", "(", ")", "throws", "Exception", "{", "when", "(", "mockLastRequest", ".", "getQuery", "(", ")", ")", ".", "thenReturn", "(", "\"a=b\"", ")", ";", "when", "(", "mockRestClient", ".", "getBaseUrl", "(", ")", ")", ".", "thenReturn", "(", "BASE_URL", ")", ";", "when", "(", "mockBodyTypeAdapter", ".", "parse", "(", "\"//count\"", ")", ")", ".", "thenReturn", "(", "\"//count\"", ")", ";", "when", "(", "mockBodyTypeAdapter", ".", "equals", "(", "\"//count\"", ",", "\"<body", "/>\"", ")", ")", ".", "thenReturn", "(", "false", ")", ";", "lastResponse", ".", "setResource", "(", "\"/uri\"", ")", ";", "lastResponse", ".", "addHeader", "(", "\"Header\"", ",", "\"some/thing\"", ")", ";", "lastResponse", ".", "setBody", "(", "\"<body", "/>\"", ")", ";", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"GET\"", ",", "\"/uri?a=b\"", ",", "\"201\"", ",", "\"\"", ",", "\"//count\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "addHeaders", "(", "fixture", ".", "getHeaders", "(", ")", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "setMethod", "(", "Method", ".", "Get", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "setResource", "(", "\"/uri\"", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "setQuery", "(", "\"a=b\"", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "setMultipartFileParameterName", "(", "\"file\"", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "getQuery", "(", ")", ";", "verify", "(", "mockRestClient", ")", ".", "setBaseUrl", "(", "fixture", ".", "getBaseUrl", "(", ")", ")", ";", "verify", "(", "mockRestClient", ")", ".", "getBaseUrl", "(", ")", ";", "verify", "(", "mockRestClient", ")", ".", "execute", "(", "mockLastRequest", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "asLink", "(", "isA", "(", "CellWrapper", ".", "class", ")", ",", "eq", "(", "BASE_URL", "+", "\"/uri?a=b\"", ")", ",", "eq", "(", "\"/uri?a=b\"", ")", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "wrong", "(", "isA", "(", "CellWrapper", ".", "class", ")", ",", "isA", "(", "StatusCodeTypeAdapter", ".", "class", ")", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "wrong", "(", "isA", "(", "CellWrapper", ".", "class", ")", ",", "isA", "(", "HeadersTypeAdapter", ".", "class", ")", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "wrong", "(", "isA", "(", "CellWrapper", ".", "class", ")", ",", "eq", "(", "mockBodyTypeAdapter", ")", ")", ";", "verify", "(", "mockBodyTypeAdapter", ")", ".", "setContext", "(", "isA", "(", "Map", ".", "class", ")", ")", ";", "verify", "(", "mockBodyTypeAdapter", ")", ".", "set", "(", "\"<body", "/>\"", ")", ";", "verify", "(", "mockBodyTypeAdapter", ")", ".", "parse", "(", "\"//count\"", ")", ";", "verify", "(", "mockBodyTypeAdapter", ")", ".", "equals", "(", "\"//count\"", ",", "\"<body", "/>\"", ")", ";", "verifyNoMoreInteractions", "(", "mockBodyTypeAdapter", ")", ";", "verifyNoMoreInteractions", "(", "mockRestClient", ")", ";", "verifyNoMoreInteractions", "(", "mockCellFormatter", ")", ";", "verifyNoMoreInteractions", "(", "mockLastRequest", ")", ";", "}", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "@", "Test", "public", "void", "mustMatchRequestsWithNoBodyExpressedAsNoBodyString", "(", ")", "throws", "Exception", "{", "when", "(", "mockBodyTypeAdapter", ".", "parse", "(", "\"no-body\"", ")", ")", ".", "thenReturn", "(", "\"no-body\"", ")", ";", "when", "(", "mockBodyTypeAdapter", ".", "equals", "(", "\"no-body\"", ",", "\"\"", ")", ")", ".", "thenReturn", "(", "true", ")", ";", "when", "(", "mockRestClient", ".", "getBaseUrl", "(", ")", ")", ".", "thenReturn", "(", "BASE_URL", ")", ";", "lastResponse", ".", "setResource", "(", "\"/uri\"", ")", ";", "lastResponse", ".", "setBody", "(", "\"\"", ")", ";", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"DELETE\"", ",", "\"/uri\"", ",", "\"\"", ",", "\"\"", ",", "\"no-body\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "setMethod", "(", "Method", ".", "Delete", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "addHeaders", "(", "fixture", ".", "getHeaders", "(", ")", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "setResource", "(", "\"/uri\"", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "setMultipartFileParameterName", "(", "\"file\"", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "getQuery", "(", ")", ";", "verify", "(", "mockRestClient", ")", ".", "setBaseUrl", "(", "fixture", ".", "getBaseUrl", "(", ")", ")", ";", "verify", "(", "mockRestClient", ")", ".", "getBaseUrl", "(", ")", ";", "verify", "(", "mockRestClient", ")", ".", "execute", "(", "mockLastRequest", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "asLink", "(", "any", "(", "CellWrapper", ".", "class", ")", ",", "eq", "(", "BASE_URL", "+", "\"/uri\"", ")", ",", "eq", "(", "\"/uri\"", ")", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "gray", "(", "\"200\"", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "right", "(", "isA", "(", "CellWrapper", ".", "class", ")", ",", "eq", "(", "mockBodyTypeAdapter", ")", ")", ";", "verify", "(", "mockBodyTypeAdapter", ")", ".", "setContext", "(", "isA", "(", "Map", ".", "class", ")", ")", ";", "verify", "(", "mockBodyTypeAdapter", ")", ".", "set", "(", "\"\"", ")", ";", "verify", "(", "mockBodyTypeAdapter", ")", ".", "parse", "(", "\"no-body\"", ")", ";", "verify", "(", "mockBodyTypeAdapter", ")", ".", "equals", "(", "\"no-body\"", ",", "\"\"", ")", ";", "verifyNoMoreInteractions", "(", "mockBodyTypeAdapter", ")", ";", "verifyNoMoreInteractions", "(", "mockCellFormatter", ")", ";", "verifyNoMoreInteractions", "(", "mockRestClient", ")", ";", "verifyNoMoreInteractions", "(", "mockLastRequest", ")", ";", "}", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "@", "Test", "public", "void", "mustExecuteVerbOnAUriWithExcpectationsSetOnHeaders", "(", ")", "{", "when", "(", "mockLastRequest", ".", "getQuery", "(", ")", ")", ".", "thenReturn", "(", "\"\"", ")", ";", "when", "(", "mockRestClient", ".", "getBaseUrl", "(", ")", ")", ".", "thenReturn", "(", "BASE_URL", ")", ";", "lastResponse", ".", "setResource", "(", "\"/uri\"", ")", ";", "lastResponse", ".", "addHeader", "(", "\"Header1\"", ",", "\"some/thing/1\"", ")", ";", "lastResponse", ".", "addHeader", "(", "\"Header2\"", ",", "\"some/thing/2\"", ")", ";", "lastResponse", ".", "addHeader", "(", "\"Header3\"", ",", "\"some/thing/3\"", ")", ";", "lastResponse", ".", "setBody", "(", "\"<body", "/>\"", ")", ";", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"GET\"", ",", "\"/uri\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "right", "(", "isA", "(", "CellWrapper", ".", "class", ")", ",", "isA", "(", "HeadersTypeAdapter", ".", "class", ")", ")", ";", "}", "@", "Test", "public", "void", "mustExpectOnlySupportedVerbOnFirstCell", "(", ")", "{", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"GET\"", ",", "\"/uri\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "setMethod", "(", "Method", ".", "Get", ")", ";", "row", "=", "helper", ".", "createTestRow", "(", "\"DELETE\"", ",", "\"/uri\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "setMethod", "(", "Method", ".", "Delete", ")", ";", "row", "=", "helper", ".", "createTestRow", "(", "\"setBody\"", ",", "\"<body", "/>\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "row", "=", "helper", ".", "createTestRow", "(", "\"POST\"", ",", "\"/uri\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "setMethod", "(", "Method", ".", "Post", ")", ";", "row", "=", "helper", ".", "createTestRow", "(", "\"PUT\"", ",", "\"/uri\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "setMethod", "(", "Method", ".", "Put", ")", ";", "}", "@", "Test", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "mustExecuteVerbOnAUriWithExcpectationsSetOnBody_XML", "(", ")", "throws", "Exception", "{", "when", "(", "mockBodyTypeAdapter", ".", "parse", "(", "\"//body\"", ")", ")", ".", "thenReturn", "(", "\"//body\"", ")", ";", "when", "(", "mockBodyTypeAdapter", ".", "equals", "(", "\"//body\"", ",", "\"<body", "/>\"", ")", ")", ".", "thenReturn", "(", "true", ")", ";", "when", "(", "mockLastRequest", ".", "getQuery", "(", ")", ")", ".", "thenReturn", "(", "\"\"", ")", ";", "when", "(", "mockRestClient", ".", "getBaseUrl", "(", ")", ")", ".", "thenReturn", "(", "BASE_URL", ")", ";", "lastResponse", ".", "setResource", "(", "\"/uri\"", ")", ";", "lastResponse", ".", "addHeader", "(", "\"Content-Type\"", ",", "\"\"", ")", ";", "lastResponse", ".", "setBody", "(", "\"<body", "/>\"", ")", ";", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"GET\"", ",", "\"/uri\"", ",", "\"\"", ",", "\"\"", ",", "\"//body\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "right", "(", "isA", "(", "CellWrapper", ".", "class", ")", ",", "eq", "(", "mockBodyTypeAdapter", ")", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "asLink", "(", "isA", "(", "CellWrapper", ".", "class", ")", ",", "eq", "(", "\"\"", ")", ",", "eq", "(", "\"/uri\"", ")", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "gray", "(", "\"200\"", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "gray", "(", "\"\"", ")", ";", "verify", "(", "mockBodyTypeAdapter", ")", ".", "setContext", "(", "isA", "(", "Map", ".", "class", ")", ")", ";", "verify", "(", "mockBodyTypeAdapter", ")", ".", "set", "(", "\"<body", "/>\"", ")", ";", "verify", "(", "mockBodyTypeAdapter", ")", ".", "parse", "(", "\"//body\"", ")", ";", "verify", "(", "mockBodyTypeAdapter", ")", ".", "equals", "(", "\"//body\"", ",", "\"<body", "/>\"", ")", ";", "verifyNoMoreInteractions", "(", "mockBodyTypeAdapter", ")", ";", "verifyNoMoreInteractions", "(", "mockCellFormatter", ")", ";", "}", "@", "Test", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "mustExecuteVerbOnAUriWithExcpectationsSetOnBody_TEXT", "(", ")", "throws", "Exception", "{", "String", "regex", "=", "\"\"", ";", "String", "content", "=", "\"\"", ";", "when", "(", "mockBodyTypeAdapter", ".", "parse", "(", "regex", ")", ")", ".", "thenReturn", "(", "regex", ")", ";", "when", "(", "mockBodyTypeAdapter", ".", "equals", "(", "regex", ",", "content", ")", ")", ".", "thenReturn", "(", "true", ")", ";", "when", "(", "mockLastRequest", ".", "getQuery", "(", ")", ")", ".", "thenReturn", "(", "\"\"", ")", ";", "when", "(", "mockRestClient", ".", "getBaseUrl", "(", ")", ")", ".", "thenReturn", "(", "BASE_URL", ")", ";", "lastResponse", ".", "setResource", "(", "\"/uri\"", ")", ";", "lastResponse", ".", "addHeader", "(", "\"Content-Type\"", ",", "\"text/plain\"", ")", ";", "lastResponse", ".", "setBody", "(", "content", ")", ";", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"GET\"", ",", "\"/uri\"", ",", "\"\"", ",", "\"\"", ",", "regex", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "right", "(", "isA", "(", "CellWrapper", ".", "class", ")", ",", "eq", "(", "mockBodyTypeAdapter", ")", ")", ";", "verify", "(", "mockBodyTypeAdapter", ")", ".", "setContext", "(", "isA", "(", "Map", ".", "class", ")", ")", ";", "verify", "(", "mockBodyTypeAdapter", ")", ".", "set", "(", "content", ")", ";", "verify", "(", "mockBodyTypeAdapter", ")", ".", "parse", "(", "regex", ")", ";", "verify", "(", "mockBodyTypeAdapter", ")", ".", "equals", "(", "regex", ",", "content", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "asLink", "(", "isA", "(", "CellWrapper", ".", "class", ")", ",", "eq", "(", "BASE_URL", "+", "\"/uri\"", ")", ",", "eq", "(", "\"/uri\"", ")", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "gray", "(", "\"200\"", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "gray", "(", "\"\"", ")", ";", "verifyNoMoreInteractions", "(", "mockBodyTypeAdapter", ")", ";", "verifyNoMoreInteractions", "(", "mockCellFormatter", ")", ";", "}", "@", "Test", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "mustExecuteVerbOnAUriWithExcpectationsSetOnBody_TEXTWithHtml", "(", ")", "throws", "Exception", "{", "String", "regex", "=", "\"\"", ";", "String", "content", "=", "\"\"", ";", "when", "(", "mockBodyTypeAdapter", ".", "parse", "(", "regex", ")", ")", ".", "thenReturn", "(", "regex", ")", ";", "when", "(", "mockBodyTypeAdapter", ".", "equals", "(", "regex", ",", "content", ")", ")", ".", "thenReturn", "(", "true", ")", ";", "when", "(", "mockLastRequest", ".", "getQuery", "(", ")", ")", ".", "thenReturn", "(", "\"\"", ")", ";", "when", "(", "mockRestClient", ".", "getBaseUrl", "(", ")", ")", ".", "thenReturn", "(", "BASE_URL", ")", ";", "lastResponse", ".", "setResource", "(", "\"/uri\"", ")", ";", "lastResponse", ".", "addHeader", "(", "\"Content-Type\"", ",", "\"text/plain\"", ")", ";", "lastResponse", ".", "setBody", "(", "content", ")", ";", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"GET\"", ",", "\"/uri\"", ",", "\"\"", ",", "\"\"", ",", "regex", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "right", "(", "isA", "(", "CellWrapper", ".", "class", ")", ",", "eq", "(", "mockBodyTypeAdapter", ")", ")", ";", "verify", "(", "mockBodyTypeAdapter", ")", ".", "setContext", "(", "isA", "(", "Map", ".", "class", ")", ")", ";", "verify", "(", "mockBodyTypeAdapter", ")", ".", "set", "(", "content", ")", ";", "verify", "(", "mockBodyTypeAdapter", ")", ".", "parse", "(", "regex", ")", ";", "verify", "(", "mockBodyTypeAdapter", ")", ".", "equals", "(", "regex", ",", "content", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "asLink", "(", "isA", "(", "CellWrapper", ".", "class", ")", ",", "eq", "(", "BASE_URL", "+", "\"/uri\"", ")", ",", "eq", "(", "\"/uri\"", ")", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "gray", "(", "\"200\"", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "gray", "(", "\"\"", ")", ";", "verifyNoMoreInteractions", "(", "mockBodyTypeAdapter", ")", ";", "verifyNoMoreInteractions", "(", "mockCellFormatter", ")", ";", "}", "@", "Test", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "mustExecuteVerbOnAUriWithExcpectationsSetOnBody_JSON", "(", ")", "throws", "Exception", "{", "String", "json", "=", "\"\"", ";", "String", "xpath", "=", "\"\"", ";", "when", "(", "mockBodyTypeAdapter", ".", "parse", "(", "xpath", ")", ")", ".", "thenReturn", "(", "xpath", ")", ";", "when", "(", "mockBodyTypeAdapter", ".", "equals", "(", "xpath", ",", "json", ")", ")", ".", "thenReturn", "(", "true", ")", ";", "when", "(", "mockLastRequest", ".", "getQuery", "(", ")", ")", ".", "thenReturn", "(", "\"\"", ")", ";", "when", "(", "mockRestClient", ".", "getBaseUrl", "(", ")", ")", ".", "thenReturn", "(", "BASE_URL", ")", ";", "lastResponse", ".", "setResource", "(", "\"/uri\"", ")", ";", "lastResponse", ".", "addHeader", "(", "\"Content-Type\"", ",", "\"\"", ")", ";", "lastResponse", ".", "setBody", "(", "json", ")", ";", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"GET\"", ",", "\"/uri\"", ",", "\"\"", ",", "\"\"", ",", "xpath", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "right", "(", "isA", "(", "CellWrapper", ".", "class", ")", ",", "eq", "(", "mockBodyTypeAdapter", ")", ")", ";", "}", "@", "Test", "public", "void", "mustUseValueOnSymbolMapEvenIfNotSetViaVariables", "(", ")", "{", "when", "(", "mockLastRequest", ".", "getQuery", "(", ")", ")", ".", "thenReturn", "(", "\"\"", ")", ";", "when", "(", "mockRestClient", ".", "getBaseUrl", "(", ")", ")", ".", "thenReturn", "(", "BASE_URL", ")", ";", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"GET\"", ",", "\"/uri/%fred%\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ")", ";", "Fixture", ".", "setSymbol", "(", "\"fred\"", ",", "\"bloggs\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "setResource", "(", "\"/uri/bloggs\"", ")", ";", "}", "@", "Test", "public", "void", "mustSetValueOnSymbolMapIfVariableNameStartsWith$", "(", ")", "{", "when", "(", "mockLastRequest", ".", "getQuery", "(", ")", ")", ".", "thenReturn", "(", "\"\"", ")", ";", "when", "(", "mockRestClient", ".", "getBaseUrl", "(", ")", ")", ".", "thenReturn", "(", "BASE_URL", ")", ";", "lastResponse", ".", "setBody", "(", "\"\"", ")", ";", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"GET\"", ",", "\"/uri\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "row", "=", "helper", ".", "createTestRow", "(", "\"let\"", ",", "\"$content\"", ",", "\"body\"", ",", "\"/body/text()\"", ",", "\"text\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "assertEquals", "(", "\"text\"", ",", "variables", ".", "get", "(", "\"content\"", ")", ")", ";", "assertEquals", "(", "\"text\"", ",", "variables", ".", "get", "(", "\"$content\"", ")", ")", ";", "assertEquals", "(", "\"text\"", ",", "Fixture", ".", "getSymbol", "(", "\"content\"", ")", ")", ";", "}", "@", "Test", "public", "void", "mustReplaceVariablesInExpectedContentOfLetCell", "(", ")", "{", "when", "(", "mockLastRequest", ".", "getQuery", "(", ")", ")", ".", "thenReturn", "(", "\"\"", ")", ";", "when", "(", "mockRestClient", ".", "getBaseUrl", "(", ")", ")", ".", "thenReturn", "(", "BASE_URL", ")", ";", "lastResponse", ".", "setBody", "(", "\"\"", ")", ";", "variables", ".", "put", "(", "\"the_content\"", ",", "\"text\"", ")", ";", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"GET\"", ",", "\"/uri\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "row", "=", "helper", ".", "createTestRow", "(", "\"let\"", ",", "\"$content\"", ",", "\"body\"", ",", "\"/body/text()\"", ",", "\"\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "verify", "(", "row", ".", "getCell", "(", "4", ")", ")", ".", "body", "(", ")", ";", "verify", "(", "row", ".", "getCell", "(", "4", ")", ")", ".", "body", "(", "\"text\"", ")", ";", "verifyNoMoreInteractions", "(", "row", ".", "getCell", "(", "4", ")", ")", ";", "}", "@", "Test", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "mustSetValueOnSymbolMapAsXmlStringIfSourceIsBodyAsXml", "(", ")", "throws", "Exception", "{", "String", "xmlString", "=", "\"\"", ";", "when", "(", "mockBodyTypeAdapter", ".", "toString", "(", ")", ")", ".", "thenReturn", "(", "xmlString", ")", ";", "when", "(", "mockBodyTypeAdapter", ".", "parse", "(", "xmlString", ")", ")", ".", "thenReturn", "(", "xmlString", ")", ";", "when", "(", "mockLastRequest", ".", "getQuery", "(", ")", ")", ".", "thenReturn", "(", "\"\"", ")", ";", "when", "(", "mockRestClient", ".", "getBaseUrl", "(", ")", ")", ".", "thenReturn", "(", "BASE_URL", ")", ";", "lastResponse", ".", "setBody", "(", "xmlString", ")", ";", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"GET\"", ",", "\"/uri\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "row", "=", "helper", ".", "createTestRow", "(", "\"let\"", ",", "\"$content\"", ",", "\"body:xml\"", ",", "\"/\"", ",", "\"\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "asLink", "(", "isA", "(", "CellWrapper", ".", "class", ")", ",", "eq", "(", "\"\"", ")", ",", "eq", "(", "\"/uri\"", ")", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "gray", "(", "eq", "(", "\"200\"", ")", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "gray", "(", "eq", "(", "\"/\"", ")", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "gray", "(", "eq", "(", "xmlString", ")", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "check", "(", "isA", "(", "CellWrapper", ".", "class", ")", ",", "isA", "(", "StringTypeAdapter", ".", "class", ")", ")", ";", "verify", "(", "mockBodyTypeAdapter", ")", ".", "set", "(", "xmlString", ")", ";", "verify", "(", "mockBodyTypeAdapter", ")", ".", "setContext", "(", "isA", "(", "Map", ".", "class", ")", ")", ";", "assertEquals", "(", "xmlString", ",", "clean", "(", "variables", ".", "get", "(", "\"content\"", ")", ")", ")", ";", "assertEquals", "(", "xmlString", ",", "clean", "(", "variables", ".", "get", "(", "\"$content\"", ")", ")", ")", ";", "assertEquals", "(", "xmlString", ",", "clean", "(", "Fixture", ".", "getSymbol", "(", "\"content\"", ")", ".", "toString", "(", ")", ")", ")", ";", "verifyNoMoreInteractions", "(", "mockBodyTypeAdapter", ")", ";", "verifyNoMoreInteractions", "(", "mockCellFormatter", ")", ";", "}", "@", "Test", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "mustSetValiueOnSymbolMapAsJsonStringIfSourceIsJs", "(", ")", "throws", "Exception", "{", "String", "jsonString", "=", "\"\"", ";", "when", "(", "mockBodyTypeAdapter", ".", "toString", "(", ")", ")", ".", "thenReturn", "(", "jsonString", ")", ";", "when", "(", "mockBodyTypeAdapter", ".", "parse", "(", "jsonString", ")", ")", ".", "thenReturn", "(", "jsonString", ")", ";", "when", "(", "mockLastRequest", ".", "getQuery", "(", ")", ")", ".", "thenReturn", "(", "\"\"", ")", ";", "when", "(", "mockRestClient", ".", "getBaseUrl", "(", ")", ")", ".", "thenReturn", "(", "BASE_URL", ")", ";", "lastResponse", ".", "setBody", "(", "jsonString", ")", ";", "lastResponse", ".", "addHeader", "(", "\"Content-Type\"", ",", "ContentType", ".", "JSON", ".", "toMime", "(", ")", ".", "get", "(", "0", ")", ")", ";", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"GET\"", ",", "\"/uri\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "row", "=", "helper", ".", "createTestRow", "(", "\"let\"", ",", "\"name\"", ",", "\"js\"", ",", "\"\"", ",", "\"\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "row", "=", "helper", ".", "createTestRow", "(", "\"let\"", ",", "\"age\"", ",", "\"js\"", ",", "\"\"", ",", "\"\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "asLink", "(", "isA", "(", "CellWrapper", ".", "class", ")", ",", "eq", "(", "\"\"", ")", ",", "eq", "(", "\"/uri\"", ")", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "gray", "(", "eq", "(", "\"200\"", ")", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "gray", "(", "eq", "(", "\"\"", ")", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "gray", "(", "eq", "(", "jsonString", ")", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "gray", "(", "eq", "(", "\"\"", ")", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "gray", "(", "eq", "(", "\"\"", ")", ")", ";", "verify", "(", "mockCellFormatter", ",", "times", "(", "2", ")", ")", ".", "check", "(", "isA", "(", "CellWrapper", ".", "class", ")", ",", "isA", "(", "StringTypeAdapter", ".", "class", ")", ")", ";", "assertEquals", "(", "\"fred\"", ",", "variables", ".", "get", "(", "\"name\"", ")", ")", ";", "assertEquals", "(", "\"20\"", ",", "variables", ".", "get", "(", "\"age\"", ")", ")", ";", "verifyNoMoreInteractions", "(", "mockCellFormatter", ")", ";", "}", "public", "void", "mustRenderCommentMessagesWithSubstitutedLabels", "(", ")", "{", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"let\"", ",", "\"seven\"", ",", "\"js\"", ",", "\"3", "+", "4\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "row", "=", "helper", ".", "createTestRow", "(", "\"comment\"", ",", "\"\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "gray", "(", "\"\"", ")", ";", "verifyNoMoreInteractions", "(", "mockCellFormatter", ")", ";", "}", "@", "Test", "public", "void", "mustAllowRegexesWhenLetIsInvokedOnHeaders", "(", ")", "{", "when", "(", "mockLastRequest", ".", "getQuery", "(", ")", ")", ".", "thenReturn", "(", "\"\"", ")", ";", "when", "(", "mockLastRequest", ".", "getBody", "(", ")", ")", ".", "thenReturn", "(", "\"<bovver", "/>\"", ")", ";", "when", "(", "mockRestClient", ".", "getBaseUrl", "(", ")", ")", ".", "thenReturn", "(", "BASE_URL", ")", ";", "lastResponse", ".", "setBody", "(", "\"\"", ")", ";", "lastResponse", ".", "addHeader", "(", "\"Location\"", ",", "\"/res/12321\"", ")", ";", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"POST\"", ",", "\"/res\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "row", "=", "helper", ".", "createTestRow", "(", "\"let\"", ",", "\"id\"", ",", "\"header\"", ",", "\"\"", ",", "\"\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "assertEquals", "(", "\"12321\"", ",", "variables", ".", "get", "(", "\"id\"", ")", ")", ";", "}", "@", "Test", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "mustReportToTheUserIfLetCantFindTheHandlerToHandleTheDesiredExpression", "(", ")", "{", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"let\"", ",", "\"$content\"", ",", "\"\"", ",", "\"-\"", ",", "\"\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "exception", "(", "isA", "(", "CellWrapper", ".", "class", ")", ",", "isA", "(", "String", ".", "class", ")", ")", ";", "verifyNoMoreInteractions", "(", "mockCellFormatter", ")", ";", "}", "private", "String", "clean", "(", "String", "s", ")", "{", "return", "s", ".", "trim", "(", ")", ".", "replaceAll", "(", "\"n\"", ",", "\"\"", ")", ".", "replaceAll", "(", "\"r\"", ",", "\"\"", ")", ";", "}", "@", "Test", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "mustCaptureErrorsOnExpectationsAndDisplayThemInTheSameCell", "(", ")", "{", "when", "(", "mockLastRequest", ".", "getQuery", "(", ")", ")", ".", "thenReturn", "(", "\"\"", ")", ";", "when", "(", "mockRestClient", ".", "getBaseUrl", "(", ")", ")", ".", "thenReturn", "(", "BASE_URL", ")", ";", "lastResponse", ".", "setStatusCode", "(", "201", ")", ";", "lastResponse", ".", "setStatusText", "(", "\"OK\"", ")", ";", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"GET\"", ",", "\"/uri\"", ",", "\"404\"", ",", "\"\"", ",", "\"\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "wrong", "(", "isA", "(", "CellWrapper", ".", "class", ")", ",", "isA", "(", "StatusCodeTypeAdapter", ".", "class", ")", ")", ";", "}", "@", "Test", "public", "void", "mustAllowGlobalStorageOfValuesExtractedViaXPathFromBody", "(", ")", "{", "when", "(", "mockRestClient", ".", "getBaseUrl", "(", ")", ")", ".", "thenReturn", "(", "BASE_URL", ")", ";", "lastResponse", ".", "setBody", "(", "\"\"", ")", ";", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"GET\"", ",", "\"/uri\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "row", "=", "helper", ".", "createTestRow", "(", "\"let\"", ",", "\"$content\"", ",", "\"body\"", ",", "\"/body/text()\"", ",", "\"text\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "assertEquals", "(", "\"text\"", ",", "Fixture", ".", "getSymbol", "(", "\"content\"", ")", ")", ";", "row", "=", "helper", ".", "createTestRow", "(", "\"let\"", ",", "\"content\"", ",", "\"body\"", ",", "\"/body/text()\"", ",", "\"text\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "assertEquals", "(", "\"text\"", ",", "variables", ".", "get", "(", "\"content\"", ")", ")", ";", "}", "@", "Test", "public", "void", "mustAllowStorageOfValuesExtractedViaXPathsReturningStringValues", "(", ")", "{", "when", "(", "mockRestClient", ".", "getBaseUrl", "(", ")", ")", ".", "thenReturn", "(", "BASE_URL", ")", ";", "lastResponse", ".", "setBody", "(", "\"\"", ")", ";", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"GET\"", ",", "\"/uri\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "row", "=", "helper", ".", "createTestRow", "(", "\"let\"", ",", "\"$count\"", ",", "\"body\"", ",", "\"count(body)\"", ",", "\"1\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "assertEquals", "(", "\"1\"", ",", "Fixture", ".", "getSymbol", "(", "\"count\"", ")", ")", ";", "row", "=", "helper", ".", "createTestRow", "(", "\"let\"", ",", "\"count\"", ",", "\"body\"", ",", "\"count(body)\"", ",", "\"1\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "assertEquals", "(", "\"1\"", ",", "variables", ".", "get", "(", "\"count\"", ")", ")", ";", "}", "@", "Test", "public", "void", "mustAllowGlobalStorageOfValuesExtractedViaRegexFromHeader", "(", ")", "{", "when", "(", "mockRestClient", ".", "getBaseUrl", "(", ")", ")", ".", "thenReturn", "(", "BASE_URL", ")", ";", "lastResponse", ".", "setBody", "(", "\"\"", ")", ";", "lastResponse", ".", "addHeader", "(", "\"header\"", ",", "\"value1\"", ")", ";", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"GET\"", ",", "\"/uri\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "row", "=", "helper", ".", "createTestRow", "(", "\"let\"", ",", "\"keytovalue\"", ",", "\"header\"", ",", "\"\"", ",", "\"value1\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "assertEquals", "(", "\"value1\"", ",", "variables", ".", "get", "(", "\"keytovalue\"", ")", ")", ";", "}", "@", "Test", "public", "void", "mustAllowSetOfFileNameForFileUpload", "(", ")", "{", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"setFileName\"", ",", "\"\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "assertEquals", "(", "\"\"", ",", "fixture", ".", "getFileName", "(", ")", ")", ";", "}", "@", "Test", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "mustReportAsExceptionWhenSettingMissingFileName", "(", ")", "{", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"setFileName\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "exception", "(", "isA", "(", "CellWrapper", ".", "class", ")", ",", "isA", "(", "String", ".", "class", ")", ")", ";", "verifyNoMoreInteractions", "(", "mockCellFormatter", ")", ";", "}", "@", "Test", "public", "void", "mustAllowSetOfMultipartFileNameForFileUpload", "(", ")", "{", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"\"", ",", "\"\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "assertEquals", "(", "\"\"", ",", "fixture", ".", "getMultipartFileName", "(", ")", ")", ";", "}", "@", "Test", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "mustReportAsExceptionWhenAttemptingToSetMissingMultipartFileName", "(", ")", "{", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"\"", ")", ";", "when", "(", "row", ".", "getCell", "(", "1", ")", ")", ".", "thenReturn", "(", "null", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "exception", "(", "isA", "(", "CellWrapper", ".", "class", ")", ",", "isA", "(", "String", ".", "class", ")", ")", ";", "verifyNoMoreInteractions", "(", "mockCellFormatter", ")", ";", "}", "@", "Test", "public", "void", "mustAllowSetOfMultipartFileParameterNameForFileUpload", "(", ")", "{", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"\"", ",", "\"thefile\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "assertEquals", "(", "\"thefile\"", ",", "fixture", ".", "getMultipartFileParameterName", "(", ")", ")", ";", "}", "@", "Test", "public", "void", "mustExecuteVariableSubstitutionOnBodyForNextRequest", "(", ")", "{", "variables", ".", "put", "(", "\"content\"", ",", "\"<xml", "/>\"", ")", ";", "when", "(", "mockCellFormatter", ".", "fromRaw", "(", "\"%content%\"", ")", ")", ".", "thenReturn", "(", "\"%content%\"", ")", ";", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"setBody\"", ",", "\"%content%\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "row", "=", "helper", ".", "createTestRow", "(", "\"POST\"", ",", "\"/uri\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "setMethod", "(", "Method", ".", "Post", ")", ";", "verify", "(", "mockLastRequest", ")", ".", "setBody", "(", "\"<xml", "/>\"", ")", ";", "}", "@", "Test", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "mustEvalJavascriptStringsWithEval", "(", ")", "{", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"evalJs\"", ",", "\"\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "right", "(", "isA", "(", "CellWrapper", ".", "class", ")", ",", "isA", "(", "StringTypeAdapter", ".", "class", ")", ")", ";", "assertThat", "(", "fixture", ".", "getLastEvaluation", "(", ")", ",", "is", "(", "equalTo", "(", "\"3.0\"", ")", ")", ")", ";", "verifyNoMoreInteractions", "(", "mockCellFormatter", ")", ";", "}", "@", "Test", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "mustNotifyExceptionsWhenEvalJavascriptStrings", "(", ")", "{", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"evalJs\"", ",", "\"a=\"", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "exception", "(", "isA", "(", "CellWrapper", ".", "class", ")", ",", "isA", "(", "JavascriptException", ".", "class", ")", ")", ";", "assertThat", "(", "fixture", ".", "getLastEvaluation", "(", ")", ",", "is", "(", "nullValue", "(", ")", ")", ")", ";", "verifyNoMoreInteractions", "(", "mockCellFormatter", ")", ";", "}", "@", "Test", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "mustReportAsRTEWhenSettingMissingMultipartFileParameterName", "(", ")", "{", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"\"", ")", ";", "when", "(", "row", ".", "getCell", "(", "1", ")", ")", ".", "thenReturn", "(", "null", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "exception", "(", "isA", "(", "CellWrapper", ".", "class", ")", ",", "eq", "(", "\"\"", ")", ")", ";", "verifyNoMoreInteractions", "(", "mockCellFormatter", ")", ";", "}", "@", "Test", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "mustReportAsRTEWhenSettingAMissingBody", "(", ")", "{", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"setBody\"", ")", ";", "when", "(", "row", ".", "getCell", "(", "1", ")", ")", ".", "thenReturn", "(", "null", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "exception", "(", "isA", "(", "CellWrapper", ".", "class", ")", ",", "eq", "(", "\"\"", ")", ")", ";", "verifyNoMoreInteractions", "(", "mockCellFormatter", ")", ";", "}", "@", "Test", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "mustReportAsRTEWhenSettingAMissingHeader", "(", ")", "{", "RowWrapper", "<", "?", ">", "row", "=", "helper", ".", "createTestRow", "(", "\"setHeader\"", ")", ";", "when", "(", "row", ".", "getCell", "(", "1", ")", ")", ".", "thenReturn", "(", "null", ")", ";", "fixture", ".", "processRow", "(", "row", ")", ";", "verify", "(", "mockCellFormatter", ")", ".", "exception", "(", "isA", "(", "CellWrapper", ".", "class", ")", ",", "eq", "(", "\"\"", ")", ")", ";", "verifyNoMoreInteractions", "(", "mockCellFormatter", ")", ";", "}", "@", "Test", "public", "void", "constructingWithOneArgShoudlBeTheSUTUri", "(", ")", "{", "String", "uri", "=", "\"\"", ";", "RestFixture", "f", "=", "new", "RestFixture", "(", "uri", ")", ";", "assertEquals", "(", "uri", ",", "f", ".", "getBaseUrl", "(", ")", ")", ";", "}", "@", "Test", "public", "void", "constructingWithOneArgShoudlStripAnyTagAndSetTheSUTUri", "(", ")", "{", "String", "uri", "=", "\"\"", ";", "String", "taggedUri", "=", "\"\"", "+", "uri", "+", "\"</sometag>\"", ";", "RestFixture", "f", "=", "new", "RestFixture", "(", "taggedUri", ")", ";", "assertEquals", "(", "uri", ",", "f", ".", "getBaseUrl", "(", ")", ")", ";", "}", "@", "Test", "public", "void", "constructingWithOneFailsIfArgIsNotAnUri", "(", ")", "{", "String", "uri", "=", "\"rubbish\"", ";", "try", "{", "new", "RestFixture", "(", "uri", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "}", "}", "}", "</s>" ]
12,850
[ "<s>", "package", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "equalTo", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "instanceOf", ";", "import", "static", "org", ".", "hamcrest", ".", "CoreMatchers", ".", "is", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "assertThat", ";", "import", "java", ".", "lang", ".", "reflect", ".", "InvocationTargetException", ";", "import", "java", ".", "lang", ".", "reflect", ".", "Method", ";", "import", "org", ".", "apache", ".", "commons", ".", "httpclient", ".", "HttpURL", ";", "import", "org", ".", "apache", ".", "commons", ".", "httpclient", ".", "URI", ";", "import", "org", ".", "apache", ".", "commons", ".", "httpclient", ".", "URIException", ";", "import", "org", ".", "junit", ".", "Before", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "smartrics", ".", "rest", ".", "client", ".", "RestClient", ";", "import", "smartrics", ".", "rest", ".", "client", ".", "RestRequest", ";", "import", "smartrics", ".", "rest", ".", "fitnesse", ".", "fixture", ".", "support", ".", "Config", ";", "public", "class", "PartsFactoryTest", "{", "private", "PartsFactory", "f", ";", "@", "Before", "public", "void", "setUp", "(", ")", "{", "Config", "c", "=", "Config", ".", "getConfig", "(", ")", ";", "c", ".", "add", "(", "\"\"", ",", "\"false\"", ")", ";", "f", "=", "new", "PartsFactory", "(", ")", ";", "}", "@", "Test", "public", "void", "cannotBuildACellFormatterForANullRunner", "(", ")", "{", "try", "{", "f", ".", "buildCellFormatter", "(", "null", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "assertThat", "(", "e", ".", "getMessage", "(", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "}", "}", "@", "Test", "public", "void", "buildsRestRequest", "(", ")", "{", "assertThat", "(", "f", ".", "buildRestRequest", "(", ")", ",", "is", "(", "instanceOf", "(", "RestRequest", ".", "class", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "buildsRestClientWithStandardUri", "(", ")", "throws", "Exception", "{", "Config", "c", "=", "Config", ".", "getConfig", "(", ")", ";", "RestClient", "restClient", "=", "f", ".", "buildRestClient", "(", "c", ")", ";", "assertThat", "(", "restClient", ",", "is", "(", "instanceOf", "(", "RestClient", ".", "class", ")", ")", ")", ";", "Method", "m", "=", "getCreateUriMethod", "(", "restClient", ")", ";", "m", ".", "setAccessible", "(", "true", ")", ";", "Object", "r", "=", "m", ".", "invoke", "(", "restClient", ",", "\"\"", ",", "false", ")", ";", "assertThat", "(", "r", ",", "is", "(", "instanceOf", "(", "URI", ".", "class", ")", ")", ")", ";", "assertThat", "(", "r", ".", "toString", "(", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "buildsRestClientWithoutSquareBracketsInUri", "(", ")", "throws", "Exception", "{", "Config", "c", "=", "Config", ".", "getConfig", "(", ")", ";", "RestClient", "restClient", "=", "f", ".", "buildRestClient", "(", "c", ")", ";", "assertThat", "(", "restClient", ",", "is", "(", "instanceOf", "(", "RestClient", ".", "class", ")", ")", ")", ";", "Method", "m", "=", "getCreateUriMethod", "(", "restClient", ")", ";", "m", ".", "setAccessible", "(", "true", ")", ";", "try", "{", "m", ".", "invoke", "(", "restClient", ",", "\"\"", ",", "true", ")", ";", "}", "catch", "(", "InvocationTargetException", "e", ")", "{", "assertThat", "(", "e", ".", "getCause", "(", ")", ",", "is", "(", "instanceOf", "(", "URIException", ".", "class", ")", ")", ")", ";", "}", "}", "@", "Test", "public", "void", "buildsRestClientWithEscapedSquareBracketsInUri", "(", ")", "throws", "Exception", "{", "Config", "c", "=", "Config", ".", "getConfig", "(", ")", ";", "RestClient", "restClient", "=", "f", ".", "buildRestClient", "(", "c", ")", ";", "assertThat", "(", "restClient", ",", "is", "(", "instanceOf", "(", "RestClient", ".", "class", ")", ")", ")", ";", "Method", "m", "=", "getCreateUriMethod", "(", "restClient", ")", ";", "m", ".", "setAccessible", "(", "true", ")", ";", "Object", "r", "=", "m", ".", "invoke", "(", "restClient", ",", "\"\"", ",", "false", ")", ";", "assertThat", "(", "r", ",", "is", "(", "instanceOf", "(", "URI", ".", "class", ")", ")", ")", ";", "assertThat", "(", "r", ".", "toString", "(", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "buildsRestClientWithSquareBracketsInUri", "(", ")", "throws", "Exception", "{", "Config", "c", "=", "Config", ".", "getConfig", "(", ")", ";", "c", ".", "add", "(", "\"\"", ",", "\"true\"", ")", ";", "RestClient", "restClient", "=", "f", ".", "buildRestClient", "(", "c", ")", ";", "assertThat", "(", "restClient", ",", "is", "(", "instanceOf", "(", "RestClient", ".", "class", ")", ")", ")", ";", "Method", "m", "=", "getCreateUriMethod", "(", "restClient", ")", ";", "m", ".", "setAccessible", "(", "true", ")", ";", "Object", "r", "=", "m", ".", "invoke", "(", "restClient", ",", "\"\"", ",", "false", ")", ";", "assertThat", "(", "r", ",", "is", "(", "instanceOf", "(", "HttpURL", ".", "class", ")", ")", ")", ";", "HttpURL", "u", "=", "(", "HttpURL", ")", "r", ";", "assertThat", "(", "u", ".", "getQuery", "(", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "buildsRestClientWithDefaultURIFactory", "(", ")", "throws", "Exception", "{", "Config", "c", "=", "Config", ".", "getConfig", "(", ")", ";", "RestClient", "restClient", "=", "f", ".", "buildRestClient", "(", "c", ")", ";", "assertThat", "(", "restClient", ",", "is", "(", "instanceOf", "(", "RestClient", ".", "class", ")", ")", ")", ";", "Method", "m", "=", "getGetMethodClassnameFromMethodNameMethod", "(", "restClient", ")", ";", "m", ".", "setAccessible", "(", "true", ")", ";", "Object", "r", "=", "m", ".", "invoke", "(", "restClient", ",", "\"Some\"", ")", ";", "assertThat", "(", "r", ".", "toString", "(", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "buildsRestClientWithNewURIFactory", "(", ")", "throws", "Exception", "{", "Config", "c", "=", "Config", ".", "getConfig", "(", ")", ";", "c", ".", "add", "(", "\"\"", ",", "\"true\"", ")", ";", "RestClient", "restClient", "=", "f", ".", "buildRestClient", "(", "c", ")", ";", "assertThat", "(", "restClient", ",", "is", "(", "instanceOf", "(", "RestClient", ".", "class", ")", ")", ")", ";", "Method", "m", "=", "getGetMethodClassnameFromMethodNameMethod", "(", "restClient", ")", ";", "m", ".", "setAccessible", "(", "true", ")", ";", "Object", "r", "=", "m", ".", "invoke", "(", "restClient", ",", "\"Some\"", ")", ";", "assertThat", "(", "r", ".", "toString", "(", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "cantBuildACellFormatterForNonFitOrSlimRunner", "(", ")", "{", "try", "{", "f", ".", "buildCellFormatter", "(", "RestFixture", ".", "Runner", ".", "OTHER", ")", ";", "}", "catch", "(", "IllegalStateException", "e", ")", "{", "assertThat", "(", "e", ".", "getMessage", "(", ")", ",", "is", "(", "equalTo", "(", "\"\"", ")", ")", ")", ";", "}", "}", "@", "Test", "public", "void", "buildsASlimFormatterForSLIMRunner", "(", ")", "{", "assertThat", "(", "f", ".", "buildCellFormatter", "(", "RestFixture", ".", "Runner", ".", "SLIM", ")", ",", "is", "(", "instanceOf", "(", "SlimFormatter", ".", "class", ")", ")", ")", ";", "}", "@", "Test", "public", "void", "buildsASlimFormatterForFITRunner", "(", ")", "{", "assertThat", "(", "f", ".", "buildCellFormatter", "(", "RestFixture", ".", "Runner", ".", "FIT", ")", ",", "is", "(", "instanceOf", "(", "FitFormatter", ".", "class", ")", ")", ")", ";", "}", "private", "Method", "getCreateUriMethod", "(", "RestClient", "client", ")", "{", "try", "{", "return", "client", ".", "getClass", "(", ")", ".", "getDeclaredMethod", "(", "\"createUri\"", ",", "String", ".", "class", ",", "boolean", ".", "class", ")", ";", "}", "catch", "(", "SecurityException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "}", "catch", "(", "NoSuchMethodException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "}", "}", "private", "Method", "getGetMethodClassnameFromMethodNameMethod", "(", "RestClient", "client", ")", "{", "try", "{", "return", "client", ".", "getClass", "(", ")", ".", "getMethod", "(", "\"\"", ",", "String", ".", "class", ")", ";", "}", "catch", "(", "SecurityException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "}", "catch", "(", "NoSuchMethodException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "}", "}", "}", "</s>" ]
12,851
[ "<s>", "package", "smartrics", ".", "rest", ".", "support", ".", "fitnesse", ";", "import", "static", "org", ".", "mockito", ".", "Mockito", ".", "mock", ";", "import", "static", "org", ".", "mockito", ".", "Mockito", ".", "verifyNoMoreInteractions", ";", "import", "static", "org", ".", "mockito", ".", "Mockito", ".", "when", ";", "import", "java", ".", "net", ".", "Socket", ";", "import", "fitnesse", ".", "ComponentFactory", ";", "import", "fitnesse", ".", "FitNesseContext", ";", "import", "fitnesse", ".", "Responder", ";", "import", "fitnesse", ".", "VelocityFactory", ";", "import", "fitnesse", ".", "WikiPageFactory", ";", "import", "fitnesse", ".", "http", ".", "Request", ";", "import", "fitnesse", ".", "http", ".", "Response", ";", "import", "fitnesse", ".", "http", ".", "ResponseSender", ";", "import", "fitnesse", ".", "responders", ".", "ResponderFactory", ";", "import", "fitnesse", ".", "wiki", ".", "WikiPage", ";", "public", "class", "InProcessRunner", "{", "private", "static", "String", "SRC", "=", "\"\"", ";", "private", "static", "String", "SUITE_ROOT", "=", "\"\"", ";", "private", "static", "String", "FITNESSE_ROOT_PAGE", "=", "\"FitNesseRoot\"", ";", "public", "static", "void", "main", "(", "String", "...", "args", ")", "throws", "Exception", "{", "ResponderFactory", "rFac", "=", "new", "ResponderFactory", "(", "SRC", ")", ";", "ComponentFactory", "componentFactory", "=", "new", "ComponentFactory", "(", ")", ";", "WikiPageFactory", "pFac", "=", "new", "WikiPageFactory", "(", ")", ";", "WikiPage", "root", "=", "pFac", ".", "makeRootPage", "(", "SRC", ",", "FITNESSE_ROOT_PAGE", ",", "componentFactory", ")", ";", "Request", "request", "=", "mock", "(", "Request", ".", "class", ")", ";", "when", "(", "request", ".", "getResource", "(", ")", ")", ".", "thenReturn", "(", "SUITE_ROOT", ")", ";", "when", "(", "request", ".", "getQueryString", "(", ")", ")", ".", "thenReturn", "(", "\"\"", ")", ";", "verifyNoMoreInteractions", "(", "request", ")", ";", "Responder", "responder", "=", "rFac", ".", "makeResponder", "(", "request", ",", "root", ")", ";", "FitNesseContext", "context", "=", "new", "FitNesseContext", "(", "root", ")", ";", "context", ".", "rootDirectoryName", "=", "FITNESSE_ROOT_PAGE", ";", "context", ".", "rootPath", "=", "SRC", ";", "context", ".", "doNotChunk", "=", "true", ";", "context", ".", "setRootPagePath", "(", ")", ";", "VelocityFactory", ".", "makeVelocityFactory", "(", "context", ")", ";", "Response", "response", "=", "responder", ".", "makeResponse", "(", "context", ",", "request", ")", ";", "final", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "ResponseSender", "sender", "=", "new", "ResponseSender", "(", ")", "{", "@", "Override", "public", "void", "send", "(", "byte", "[", "]", "bytes", ")", "{", "sb", ".", "append", "(", "new", "String", "(", "bytes", ")", ")", ";", "}", "@", "Override", "public", "void", "close", "(", ")", "{", "}", "@", "Override", "public", "Socket", "getSocket", "(", ")", "{", "return", "null", ";", "}", "}", ";", "response", ".", "readyToSend", "(", "sender", ")", ";", "System", ".", "out", ".", "println", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "20", ";", "i", "++", ")", "{", "System", ".", "out", ".", "print", "(", "sb", ".", "toString", "(", ")", ")", ";", "Thread", ".", "sleep", "(", "1000", ")", ";", "if", "(", "sb", ".", "toString", "(", ")", ".", "indexOf", "(", "\"Exit-Code\"", ")", ">", "0", ")", "{", "System", ".", "out", ".", "println", "(", ")", ";", "break", ";", "}", "}", "System", ".", "out", ".", "println", "(", "sb", ".", "toString", "(", ")", ")", ";", "}", "}", "</s>" ]
12,852
[ "<s>", "package", "smartrics", ".", "rest", ".", "support", ".", "fitnesse", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "FileInputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "InputStream", ";", "import", "java", ".", "util", ".", "regex", ".", "Matcher", ";", "import", "java", ".", "util", ".", "regex", ".", "Pattern", ";", "public", "class", "FitnesseResultVerifier", "{", "private", "static", "String", "FITNESSE_RESULTS_REGEX", "=", "\"\"", ";", "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "if", "(", "args", ".", "length", "!=", "1", ")", "throw", "new", "RuntimeException", "(", "\"\"", ")", ";", "try", "{", "FitnesseResultVerifier", "verifier", "=", "new", "FitnesseResultVerifier", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"Processing", "\"", "+", "args", "[", "0", "]", ")", ";", "String", "content", "=", "verifier", ".", "readFile", "(", "args", "[", "0", "]", ")", ";", "Pattern", "p", "=", "Pattern", ".", "compile", "(", "FITNESSE_RESULTS_REGEX", ")", ";", "Matcher", "m", "=", "p", ".", "matcher", "(", "content", ")", ";", "int", "count", "=", "m", ".", "groupCount", "(", ")", ";", "if", "(", "count", "!=", "8", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "FITNESSE_RESULTS_REGEX", ")", ";", "}", "int", "tRight", "=", "-", "1", ";", "int", "tWrong", "=", "-", "1", ";", "int", "tIgnored", "=", "-", "1", ";", "int", "tExc", "=", "-", "1", ";", "int", "aRight", "=", "-", "1", ";", "int", "aWrong", "=", "-", "1", ";", "int", "aIgnored", "=", "-", "1", ";", "int", "aExc", "=", "-", "1", ";", "boolean", "found", "=", "m", ".", "find", "(", ")", ";", "if", "(", "!", "found", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "FITNESSE_RESULTS_REGEX", ")", ";", "}", "else", "{", "tRight", "=", "verifier", ".", "toInt", "(", "\"Tests", "right\"", ",", "m", ".", "group", "(", "1", ")", ")", ";", "tWrong", "=", "verifier", ".", "toInt", "(", "\"Tests", "wrong\"", ",", "m", ".", "group", "(", "2", ")", ")", ";", "tIgnored", "=", "verifier", ".", "toInt", "(", "\"\"", ",", "m", ".", "group", "(", "3", ")", ")", ";", "tExc", "=", "verifier", ".", "toInt", "(", "\"\"", ",", "m", ".", "group", "(", "4", ")", ")", ";", "aRight", "=", "verifier", ".", "toInt", "(", "\"\"", ",", "m", ".", "group", "(", "5", ")", ")", ";", "aWrong", "=", "verifier", ".", "toInt", "(", "\"\"", ",", "m", ".", "group", "(", "6", ")", ")", ";", "aIgnored", "=", "verifier", ".", "toInt", "(", "\"\"", ",", "m", ".", "group", "(", "7", ")", ")", ";", "aExc", "=", "verifier", ".", "toInt", "(", "\"\"", ",", "m", ".", "group", "(", "8", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\"Results:\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "tRight", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "tWrong", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "tIgnored", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "tExc", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "aRight", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "aWrong", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "aIgnored", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "aExc", ")", ";", "}", "System", ".", "exit", "(", "tWrong", "+", "tExc", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "args", "[", "0", "]", ")", ";", "e", ".", "printStackTrace", "(", "System", ".", "out", ")", ";", "System", ".", "exit", "(", "-", "1", ")", ";", "}", "}", "private", "int", "toInt", "(", "String", "text", ",", "String", "num", ")", "{", "try", "{", "return", "Integer", ".", "parseInt", "(", "num", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "System", ".", "out", ".", "println", "(", "text", "+", "\"\"", "+", "num", ")", ";", "return", "-", "1", ";", "}", "}", "private", "String", "readFile", "(", "String", "fileLocation", ")", "throws", "Exception", "{", "FileInputStream", "fis", "=", "null", ";", "try", "{", "File", "f", "=", "new", "File", "(", "fileLocation", ")", ";", "if", "(", "!", "f", ".", "exists", "(", ")", ")", "throw", "new", "RuntimeException", "(", "\"File", "'\"", "+", "f", ".", "getAbsolutePath", "(", ")", "+", "\"\"", ")", ";", "fis", "=", "new", "FileInputStream", "(", "f", ")", ";", "String", "content", "=", "toString", "(", "fis", ")", ";", "return", "content", ";", "}", "finally", "{", "if", "(", "fis", "!=", "null", ")", "{", "try", "{", "fis", ".", "close", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "}", "}", "}", "}", "private", "String", "toString", "(", "InputStream", "is", ")", "throws", "IOException", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "byte", "[", "]", "buff", "=", "new", "byte", "[", "1024", "]", ";", "while", "(", "true", ")", "{", "int", "r", "=", "is", ".", "read", "(", "buff", ")", ";", "if", "(", "r", "==", "-", "1", ")", "break", ";", "sb", ".", "append", "(", "new", "String", "(", "buff", ",", "0", ",", "r", ")", ")", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
12,853
[ "<s>", "package", "smartrics", ".", "rest", ".", "support", ".", "fitnesse", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "FileInputStream", ";", "import", "java", ".", "io", ".", "FileOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "InputStream", ";", "import", "org", ".", "apache", ".", "commons", ".", "codec", ".", "binary", ".", "Base64", ";", "public", "class", "FitnesseResultSanitiser", "{", "private", "static", "String", "FITNESSE_CSS_TAG", "=", "\"\"", ";", "private", "static", "String", "FITNESSE_JS_TAG", "=", "\"\"", ";", "private", "static", "String", "FITNESSE_PRINT_CSS_TAG", "=", "\"\"", ";", "private", "String", "alreadyImported", ";", "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "try", "{", "if", "(", "args", ".", "length", "!=", "2", ")", "{", "throw", "new", "RuntimeException", "(", "\"\"", ")", ";", "}", "FitnesseResultSanitiser", "sanitiser", "=", "new", "FitnesseResultSanitiser", "(", ")", ";", "String", "content", "=", "sanitiser", ".", "readFile", "(", "args", "[", "0", "]", ")", ";", "content", "=", "sanitiser", ".", "removeNonHtmlGarbage", "(", "content", ")", ";", "content", "=", "sanitiser", ".", "removeLinksToExternalPages", "(", "content", ")", ";", "if", "(", "content", "==", "null", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "args", "[", "0", "]", ")", ";", "System", ".", "exit", "(", "1", ")", ";", "}", "String", "fitnesseRootLocation", "=", "args", "[", "1", "]", ";", "content", "=", "sanitiser", ".", "injectCssAndJs", "(", "fitnesseRootLocation", ",", "content", ")", ";", "content", "=", "sanitiser", ".", "embedPictures", "(", "fitnesseRootLocation", ",", "content", ")", ";", "String", "newName", "=", "sanitiser", ".", "generateNewName", "(", "args", "[", "0", "]", ")", ";", "sanitiser", ".", "writeFile", "(", "newName", ",", "content", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "newName", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "args", "[", "0", "]", ")", ";", "e", ".", "printStackTrace", "(", "System", ".", "out", ")", ";", "}", "}", "private", "String", "removeLinksToExternalPages", "(", "String", "content", ")", "{", "if", "(", "content", "==", "null", ")", "{", "return", "null", ";", "}", "content", "=", "content", ".", "replace", "(", "\"\"", ",", "\"\"", ")", ";", "int", "pos", "=", "content", ".", "indexOf", "(", "\"\"", ")", ";", "if", "(", "pos", ">=", "0", ")", "{", "int", "endPos", "=", "content", ".", "indexOf", "(", "\"</div>\"", ",", "pos", ")", "+", "6", ";", "content", "=", "content", ".", "substring", "(", "0", ",", "pos", "-", "1", ")", "+", "content", ".", "substring", "(", "endPos", "+", "1", ")", ";", "}", "return", "content", ";", "}", "private", "String", "generateNewName", "(", "String", "name", ")", "{", "int", "pos", "=", "name", ".", "lastIndexOf", "(", "'.'", ")", ";", "final", "String", "suffix", "=", "\"_sanitised\"", ";", "if", "(", "pos", "==", "-", "1", ")", "return", "name", "+", "suffix", ";", "String", "p0", "=", "name", ".", "substring", "(", "0", ",", "pos", "-", "1", ")", ";", "String", "p1", "=", "name", ".", "substring", "(", "pos", ")", ";", "return", "p0", "+", "suffix", "+", "p1", ";", "}", "private", "String", "writeFile", "(", "String", "name", ",", "String", "content", ")", "throws", "Exception", "{", "FileOutputStream", "fos", "=", "null", ";", "try", "{", "fos", "=", "new", "FileOutputStream", "(", "new", "File", "(", "name", ")", ")", ";", "fos", ".", "write", "(", "content", ".", "getBytes", "(", ")", ")", ";", "fos", ".", "flush", "(", ")", ";", "}", "finally", "{", "if", "(", "fos", "!=", "null", ")", "{", "fos", ".", "close", "(", ")", ";", "}", "}", "return", "name", ";", "}", "private", "String", "injectCssAndJs", "(", "String", "fitnesseRootLocation", ",", "String", "content", ")", "throws", "Exception", "{", "String", "replContent", "=", "doReplacement", "(", "fitnesseRootLocation", ",", "FITNESSE_CSS_TAG", ",", "\"<style>n\"", ",", "\"n</style>n\"", ",", "content", ")", ";", "replContent", "=", "doReplacement", "(", "fitnesseRootLocation", ",", "FITNESSE_PRINT_CSS_TAG", ",", "\"<style>n\"", ",", "\"n</style>n\"", ",", "replContent", ")", ";", "replContent", "=", "doReplacement", "(", "fitnesseRootLocation", ",", "FITNESSE_JS_TAG", ",", "\"\"", ",", "\"n</script>n\"", ",", "replContent", ")", ";", "return", "replContent", ";", "}", "private", "String", "doReplacement", "(", "String", "filesRootLoc", ",", "String", "link", ",", "String", "pre", ",", "String", "post", ",", "String", "content", ")", "throws", "Exception", "{", "int", "len", "=", "link", ".", "length", "(", ")", ";", "int", "pos", "=", "content", ".", "indexOf", "(", "link", ")", ";", "if", "(", "pos", "<", "0", ")", "return", "content", ";", "String", "part1", "=", "content", ".", "substring", "(", "0", ",", "pos", "-", "1", ")", ";", "String", "part2", "=", "content", ".", "substring", "(", "pos", "+", "len", ")", ";", "String", "pattern", "=", "\"href=\\\"\"", ";", "int", "sPos", "=", "link", ".", "indexOf", "(", "pattern", ")", ";", "if", "(", "sPos", "==", "-", "1", ")", "{", "pattern", "=", "\"src=\\\"\"", ";", "sPos", "=", "link", ".", "indexOf", "(", "pattern", ")", ";", "}", "if", "(", "sPos", "==", "-", "1", ")", "{", "return", "content", ";", "}", "int", "ePos", "=", "link", ".", "indexOf", "(", "\"\\\"\"", ",", "sPos", "+", "1", "+", "pattern", ".", "length", "(", ")", ")", ";", "String", "resName", "=", "link", ".", "substring", "(", "sPos", "+", "pattern", ".", "length", "(", ")", ",", "ePos", ")", ";", "String", "fileName", "=", "filesRootLoc", "+", "resName", ";", "String", "resContent", "=", "readFile", "(", "fileName", ")", ";", "if", "(", "resContent", ".", "indexOf", "(", "\"@import", "url\"", ")", ">=", "0", ")", "{", "resContent", "=", "resolveImport", "(", "filesRootLoc", ",", "resContent", ")", ";", "}", "return", "part1", "+", "pre", "+", "resContent", "+", "post", "+", "part2", ";", "}", "private", "String", "resolveImport", "(", "String", "rootLoc", ",", "String", "content", ")", "throws", "Exception", "{", "String", "newContent", "=", "\"\"", ";", "final", "String", "pattern", "=", "\"@import", "url\"", ";", "int", "sPos", "=", "content", ".", "indexOf", "(", "pattern", ")", ";", "int", "ePos", "=", "content", ".", "indexOf", "(", "\"n\"", ",", "sPos", ")", ";", "if", "(", "ePos", "==", "-", "1", ")", "ePos", "=", "content", ".", "length", "(", ")", ";", "String", "importString", "=", "content", ".", "substring", "(", "sPos", ",", "ePos", ")", ";", "int", "iPos", "=", "importString", ".", "indexOf", "(", "\"\\\"\"", ")", ";", "int", "lPos", "=", "importString", ".", "indexOf", "(", "\"\\\"\"", ",", "iPos", "+", "1", ")", ";", "String", "imported", "=", "importString", ".", "substring", "(", "iPos", "+", "1", ",", "lPos", ")", ";", "if", "(", "alreadyImported", "==", "null", "||", "!", "imported", ".", "equals", "(", "alreadyImported", ")", ")", "{", "String", "importedContent", "=", "readFile", "(", "rootLoc", "+", "imported", ")", ";", "String", "part1", "=", "content", ".", "substring", "(", "0", ",", "sPos", ")", ";", "String", "part2", "=", "content", ".", "substring", "(", "ePos", ",", "content", ".", "length", "(", ")", ")", ";", "newContent", "=", "part1", "+", "importedContent", "+", "part2", "+", "\"n\"", ";", "return", "newContent", ";", "}", "else", "{", "return", "content", ";", "}", "}", "private", "String", "removeNonHtmlGarbage", "(", "String", "content", ")", "{", "int", "pos", "=", "content", ".", "indexOf", "(", "\"<html>\"", ")", ";", "int", "endPos", "=", "content", ".", "indexOf", "(", "\"</html>\"", ")", ";", "if", "(", "pos", ">", "-", "1", "&&", "endPos", ">", "-", "1", ")", "{", "endPos", "=", "endPos", "+", "7", ";", "}", "else", "{", "return", "null", ";", "}", "content", "=", "content", ".", "substring", "(", "pos", ",", "endPos", ")", ";", "return", "content", ";", "}", "private", "String", "readFile", "(", "String", "fileLocation", ")", "throws", "Exception", "{", "FileInputStream", "fis", "=", "null", ";", "try", "{", "File", "f", "=", "new", "File", "(", "fileLocation", ")", ";", "if", "(", "!", "f", ".", "exists", "(", ")", ")", "throw", "new", "RuntimeException", "(", "\"File", "'\"", "+", "f", ".", "getAbsolutePath", "(", ")", "+", "\"\"", ")", ";", "fis", "=", "new", "FileInputStream", "(", "f", ")", ";", "String", "content", "=", "toString", "(", "fis", ")", ";", "return", "content", ";", "}", "finally", "{", "if", "(", "fis", "!=", "null", ")", "{", "try", "{", "fis", ".", "close", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "}", "}", "}", "}", "private", "String", "toString", "(", "InputStream", "is", ")", "throws", "IOException", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "byte", "[", "]", "buff", "=", "new", "byte", "[", "1024", "]", ";", "while", "(", "true", ")", "{", "int", "r", "=", "is", ".", "read", "(", "buff", ")", ";", "if", "(", "r", "==", "-", "1", ")", "break", ";", "sb", ".", "append", "(", "new", "String", "(", "buff", ",", "0", ",", "r", ")", ")", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}", "private", "String", "embedPictures", "(", "String", "filesRootLoc", ",", "String", "content", ")", "{", "boolean", "foundAll", "=", "false", ";", "int", "posEnd", "=", "0", ";", "while", "(", "!", "foundAll", ")", "{", "int", "pos", "=", "content", ".", "indexOf", "(", "\"<img\"", ",", "posEnd", ")", ";", "foundAll", "=", "pos", "<", "0", ";", "if", "(", "!", "foundAll", ")", "{", "posEnd", "=", "content", ".", "indexOf", "(", "\"/>\"", ",", "pos", ")", "+", "1", ";", "String", "pre", "=", "content", ".", "substring", "(", "0", ",", "pos", "-", "1", ")", ";", "String", "tag", "=", "content", ".", "substring", "(", "pos", ",", "posEnd", ")", ".", "trim", "(", ")", ";", "String", "post", "=", "content", ".", "substring", "(", "posEnd", "+", "1", ")", ";", "if", "(", "post", ".", "startsWith", "(", "\"", "\"", ")", ")", "{", "post", "=", "post", ".", "substring", "(", "1", ")", ";", "}", "content", "=", "pre", "+", "generateTagWithEmbeddedImage", "(", "filesRootLoc", ",", "tag", ")", "+", "post", ";", "}", "}", "return", "content", ";", "}", "@", "SuppressWarnings", "(", "\"unused\"", ")", "private", "String", "generateEncodedImgFromFileName", "(", "String", "matchingString", ",", "String", "filesRootLoc", ",", "String", "content", ")", "{", "int", "pos", "=", "content", ".", "indexOf", "(", "matchingString", ")", ";", "pos", "=", "content", ".", "indexOf", "(", "\"\\\"\"", ",", "pos", ")", "+", "1", ";", "int", "posEnd", "=", "content", ".", "indexOf", "(", "'\"'", ",", "pos", ")", ";", "String", "pre", "=", "content", ".", "substring", "(", "0", ",", "pos", "-", "1", ")", ";", "String", "fileName", "=", "content", ".", "substring", "(", "pos", ",", "posEnd", ")", ";", "String", "post", "=", "content", ".", "substring", "(", "posEnd", "+", "1", ")", ";", "String", "enc", "=", "encodeBase64", "(", "filesRootLoc", "+", "fileName", ")", ";", "content", "=", "pre", "+", "enc", "+", "post", ";", "return", "content", ";", "}", "private", "String", "generateTagWithEmbeddedImage", "(", "String", "filesRootLoc", ",", "String", "imgTag", ")", "{", "int", "pos", "=", "imgTag", ".", "indexOf", "(", "\"src=\\\"\"", ")", ";", "if", "(", "pos", "==", "-", "1", ")", "{", "pos", "=", "imgTag", ".", "indexOf", "(", "\"src='\"", ")", ";", "}", "pos", "=", "pos", "+", "5", ";", "int", "posEnd", "=", "imgTag", ".", "indexOf", "(", "\"\\\"\"", ",", "pos", "+", "1", ")", ";", "if", "(", "posEnd", "==", "-", "1", ")", "{", "posEnd", "=", "imgTag", ".", "indexOf", "(", "\"'\"", ",", "pos", "+", "1", ")", ";", "}", "String", "file", "=", "imgTag", ".", "substring", "(", "pos", ",", "posEnd", ")", ";", "String", "fileName", "=", "filesRootLoc", "+", "file", ";", "String", "encoded", "=", "encodeBase64", "(", "fileName", ")", ";", "if", "(", "null", "!=", "encoded", ")", "return", "encoded", ";", "return", "imgTag", ";", "}", "private", "String", "encodeBase64", "(", "String", "fileName", ")", "{", "int", "extPos", "=", "fileName", ".", "lastIndexOf", "(", "'.'", ")", "+", "1", ";", "String", "ext", "=", "fileName", ".", "substring", "(", "extPos", ")", ";", "try", "{", "String", "content", "=", "readFile", "(", "fileName", ")", ";", "String", "encoded", "=", "new", "String", "(", "Base64", ".", "encodeBase64", "(", "content", ".", "getBytes", "(", ")", ")", ")", ";", "return", "\"\"", "+", "ext", "+", "\";base64,\"", "+", "encoded", "+", "\"\\\"/>\"", ";", "}", "catch", "(", "Exception", "e", ")", "{", "System", ".", "err", ".", "println", "(", "e", ".", "getMessage", "(", ")", ")", ";", "}", "return", "null", ";", "}", "}", "</s>" ]
12,854
[ "<s>", "package", "smartrics", ".", "rest", ".", "test", ".", "fitnesse", ".", "drivers", ";", "import", "org", ".", "junit", ".", "Before", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "fitnesse", ".", "junit", ".", "JUnitHelper", ";", "public", "class", "RunFromJUnitTest", "{", "private", "JUnitHelper", "helper", ";", "@", "Before", "public", "void", "setup", "(", ")", "{", "helper", "=", "new", "JUnitHelper", "(", "\"\"", ",", "\"build/output\"", ")", ";", "}", "@", "Test", "public", "void", "run_RestFixtureTests_SlimTests", "(", ")", "throws", "Exception", "{", "helper", ".", "assertTestPasses", "(", "\"\"", ")", ";", "}", "@", "Test", "public", "void", "run_RestFixtureTests_FitTests", "(", ")", "throws", "Exception", "{", "helper", ".", "assertTestPasses", "(", "\"\"", ")", ";", "}", "}", "</s>" ]
12,855
[ "<s>", "package", "smartrics", ".", "rest", ".", "test", ".", "fitnesse", ".", "drivers", ";", "import", "org", ".", "apache", ".", "commons", ".", "httpclient", ".", "HttpClient", ";", "import", "smartrics", ".", "rest", ".", "client", ".", "RestClient", ";", "import", "smartrics", ".", "rest", ".", "client", ".", "RestClientImpl", ";", "import", "smartrics", ".", "rest", ".", "client", ".", "RestRequest", ";", "import", "smartrics", ".", "rest", ".", "client", ".", "RestRequest", ".", "Method", ";", "import", "smartrics", ".", "rest", ".", "client", ".", "RestResponse", ";", "public", "class", "ClientDriver", "{", "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "postForm", "(", "args", ")", ";", "}", "public", "static", "void", "postForm", "(", "String", "[", "]", "args", ")", "{", "RestClient", "c", "=", "new", "RestClientImpl", "(", "new", "HttpClient", "(", ")", ")", ";", "RestRequest", "req", "=", "new", "RestRequest", "(", ")", ";", "req", ".", "setBody", "(", "\"\"", ")", ";", "req", ".", "setResource", "(", "\"/resources/\"", ")", ";", "req", ".", "setMethod", "(", "Method", ".", "Post", ")", ";", "req", ".", "addHeader", "(", "\"Content-Type\"", ",", "\"\"", ")", ";", "RestResponse", "res", "=", "c", ".", "execute", "(", "\"\"", ",", "req", ")", ";", "System", ".", "out", ".", "println", "(", "\"=======>n\"", "+", "res", "+", "\"n<=======\"", ")", ";", "}", "public", "static", "void", "postXml", "(", "String", "[", "]", "args", ")", "{", "RestClient", "c", "=", "new", "RestClientImpl", "(", "new", "HttpClient", "(", ")", ")", ";", "RestRequest", "req", "=", "new", "RestRequest", "(", ")", ";", "req", ".", "setBody", "(", "\"\"", ")", ";", "req", ".", "setResource", "(", "\"/resources/\"", ")", ";", "req", ".", "setMethod", "(", "Method", ".", "Post", ")", ";", "RestResponse", "res", "=", "c", ".", "execute", "(", "\"\"", ",", "req", ")", ";", "System", ".", "out", ".", "println", "(", "\"=======>n\"", "+", "res", "+", "\"n<=======\"", ")", ";", "String", "loc", "=", "res", ".", "getHeader", "(", "\"Location\"", ")", ".", "get", "(", "0", ")", ".", "getValue", "(", ")", ";", "req", ".", "setResource", "(", "loc", "+", "\".json\"", ")", ";", "req", ".", "setMethod", "(", "Method", ".", "Get", ")", ";", "res", "=", "c", ".", "execute", "(", "\"\"", ",", "req", ")", ";", "System", ".", "out", ".", "println", "(", "\"=======>n\"", "+", "res", "+", "\"n<=======\"", ")", ";", "req", ".", "setMethod", "(", "Method", ".", "Put", ")", ";", "req", ".", "setBody", "(", "\"\"", ")", ";", "res", "=", "c", ".", "execute", "(", "\"\"", ",", "req", ")", ";", "System", ".", "out", ".", "println", "(", "\"=======>n\"", "+", "res", "+", "\"n<=======\"", ")", ";", "req", ".", "setResource", "(", "\"/resources/\"", ")", ";", "req", ".", "setMethod", "(", "Method", ".", "Get", ")", ";", "res", "=", "c", ".", "execute", "(", "\"\"", ",", "req", ")", ";", "System", ".", "out", ".", "println", "(", "\"=======>n\"", "+", "res", "+", "\"n<=======\"", ")", ";", "req", ".", "setMethod", "(", "Method", ".", "Delete", ")", ";", "req", ".", "setResource", "(", "loc", ")", ";", "res", "=", "c", ".", "execute", "(", "\"\"", ",", "req", ")", ";", "System", ".", "out", ".", "println", "(", "\"=======>n\"", "+", "res", "+", "\"n<=======\"", ")", ";", "}", "}", "</s>" ]
12,856
[ "<s>", "package", "smartrics", ".", "rest", ".", "test", ".", "fitnesse", ".", "drivers", ";", "import", "smartrics", ".", "rest", ".", "test", ".", "fitnesse", ".", "fixture", ".", "HttpServer", ";", "import", "smartrics", ".", "rest", ".", "test", ".", "fitnesse", ".", "fixture", ".", "ResourcesServlet", ";", "public", "class", "ServerDriver", "{", "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "HttpServer", "server", "=", "new", "HttpServer", "(", "8765", ")", ";", "server", ".", "addServlet", "(", "new", "ResourcesServlet", "(", ")", ",", "\"/\"", ")", ";", "server", ".", "start", "(", ")", ";", "server", ".", "join", "(", ")", ";", "}", "}", "</s>" ]
12,857
[ "<s>", "package", "smartrics", ".", "rest", ".", "test", ".", "fitnesse", ".", "fixture", ";", "public", "class", "Resource", "{", "private", "String", "payload", ";", "private", "String", "id", ";", "private", "boolean", "deleted", ";", "public", "Resource", "(", "String", "id", ",", "String", "payload", ")", "{", "this", ".", "payload", "=", "payload", ";", "this", ".", "id", "=", "id", ";", "}", "public", "Resource", "(", "String", "xmlContent", ")", "{", "this", "(", "null", ",", "xmlContent", ")", ";", "}", "public", "void", "setPayload", "(", "String", "payload", ")", "{", "this", ".", "payload", "=", "payload", ";", "}", "public", "String", "getPayload", "(", ")", "{", "return", "payload", ";", "}", "public", "String", "getId", "(", ")", "{", "return", "id", ";", "}", "public", "void", "setId", "(", "String", "id", ")", "{", "this", ".", "id", "=", "id", ";", "}", "public", "boolean", "isDeleted", "(", ")", "{", "return", "deleted", ";", "}", "public", "void", "setDeleted", "(", "boolean", "deleted", ")", "{", "this", ".", "deleted", "=", "deleted", ";", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "if", "(", "getPayload", "(", ")", "==", "null", ")", "{", "return", "\"\"", ";", "}", "return", "getPayload", "(", ")", ";", "}", "}", "</s>" ]
12,858
[ "<s>", "package", "smartrics", ".", "rest", ".", "test", ".", "fitnesse", ".", "fixture", ";", "import", "static", "smartrics", ".", "rest", ".", "test", ".", "fitnesse", ".", "fixture", ".", "ServletUtils", ".", "sanitiseUri", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "InputStream", ";", "import", "java", ".", "nio", ".", "charset", ".", "Charset", ";", "import", "java", ".", "util", ".", "List", ";", "import", "javax", ".", "servlet", ".", "ServletException", ";", "import", "javax", ".", "servlet", ".", "http", ".", "HttpServlet", ";", "import", "javax", ".", "servlet", ".", "http", ".", "HttpServletRequest", ";", "import", "javax", ".", "servlet", ".", "http", ".", "HttpServletResponse", ";", "import", "org", ".", "apache", ".", "commons", ".", "httpclient", ".", "Header", ";", "import", "org", ".", "apache", ".", "commons", ".", "httpclient", ".", "HttpParser", ";", "import", "org", ".", "apache", ".", "commons", ".", "logging", ".", "Log", ";", "import", "org", ".", "apache", ".", "commons", ".", "logging", ".", "LogFactory", ";", "import", "smartrics", ".", "rest", ".", "client", ".", "RestResponse", ";", "public", "class", "StubsServlet", "extends", "HttpServlet", "{", "private", "static", "final", "long", "serialVersionUID", "=", "5557300437355123426L", ";", "private", "static", "final", "Log", "LOG", "=", "LogFactory", ".", "getLog", "(", "StubsServlet", ".", "class", ")", ";", "public", "static", "final", "String", "CONTEXT_ROOT", "=", "\"/stubs\"", ";", "private", "static", "RestResponse", "nextResponse", ";", "public", "StubsServlet", "(", ")", "{", "}", "protected", "void", "service", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "resp", ")", "throws", "ServletException", ",", "IOException", "{", "String", "method", "=", "req", ".", "getMethod", "(", ")", ";", "String", "uri", "=", "sanitiseUri", "(", "req", ".", "getRequestURI", "(", ")", ")", ";", "if", "(", "method", ".", "equals", "(", "\"POST\"", ")", "&&", "uri", ".", "endsWith", "(", "\"/responses\"", ")", ")", "{", "nextResponse", "=", "new", "RestResponse", "(", ")", ";", "InputStream", "is", "=", "req", ".", "getInputStream", "(", ")", ";", "String", "line", "=", "HttpParser", ".", "readLine", "(", "is", ",", "Charset", ".", "defaultCharset", "(", ")", ".", "name", "(", ")", ")", ";", "String", "[", "]", "incipit", "=", "line", ".", "split", "(", "\"", "\"", ")", ";", "nextResponse", ".", "setStatusCode", "(", "Integer", ".", "valueOf", "(", "incipit", "[", "0", "]", ")", ")", ";", "Header", "[", "]", "headers", "=", "HttpParser", ".", "parseHeaders", "(", "is", ",", "Charset", ".", "defaultCharset", "(", ")", ".", "name", "(", ")", ")", ";", "for", "(", "Header", "h", ":", "headers", ")", "{", "nextResponse", ".", "addHeader", "(", "h", ".", "getName", "(", ")", ",", "h", ".", "getValue", "(", ")", ")", ";", "}", "line", "=", "HttpParser", ".", "readLine", "(", "is", ",", "Charset", ".", "defaultCharset", "(", ")", ".", "name", "(", ")", ")", ";", "while", "(", "line", ".", "trim", "(", ")", ".", "length", "(", ")", "<", "1", ")", "{", "line", "=", "HttpParser", ".", "readLine", "(", "is", ",", "Charset", ".", "defaultCharset", "(", ")", ".", "name", "(", ")", ")", ";", "}", "List", "<", "smartrics", ".", "rest", ".", "client", ".", "RestData", ".", "Header", ">", "cl", "=", "nextResponse", ".", "getHeader", "(", "\"\"", ")", ";", "int", "len", "=", "0", ";", "if", "(", "cl", ".", "size", "(", ")", ">", "0", ")", "{", "len", "=", "Integer", ".", "valueOf", "(", "cl", ".", "get", "(", "0", ")", ".", "getValue", "(", ")", ")", ";", "}", "if", "(", "len", ">", "0", ")", "{", "String", "content", "=", "getContent", "(", "req", ".", "getInputStream", "(", ")", ")", ";", "nextResponse", ".", "setBody", "(", "line", "+", "\"n\"", "+", "content", ")", ";", "}", "}", "else", "{", "resp", ".", "setStatus", "(", "nextResponse", ".", "getStatusCode", "(", ")", ")", ";", "List", "<", "smartrics", ".", "rest", ".", "client", ".", "RestData", ".", "Header", ">", "headers", "=", "nextResponse", ".", "getHeaders", "(", ")", ";", "for", "(", "smartrics", ".", "rest", ".", "client", ".", "RestData", ".", "Header", "h", ":", "headers", ")", "{", "resp", ".", "addHeader", "(", "h", ".", "getName", "(", ")", ",", "h", ".", "getValue", "(", ")", ")", ";", "}", "resp", ".", "getOutputStream", "(", ")", ".", "write", "(", "nextResponse", ".", "getBody", "(", ")", ".", "getBytes", "(", ")", ")", ";", "}", "}", "private", "String", "sanitise", "(", "String", "rUri", ")", "{", "String", "uri", "=", "rUri", ";", "if", "(", "uri", ".", "endsWith", "(", "\"/\"", ")", ")", "{", "uri", "=", "uri", ".", "substring", "(", "0", ",", "uri", ".", "length", "(", ")", "-", "1", ")", ";", "}", "return", "uri", ";", "}", "private", "String", "getContent", "(", "InputStream", "is", ")", "throws", "IOException", "{", "StringBuffer", "sBuff", "=", "new", "StringBuffer", "(", ")", ";", "int", "c", ";", "while", "(", "(", "c", "=", "is", ".", "read", "(", ")", ")", "!=", "-", "1", ")", "{", "sBuff", ".", "append", "(", "(", "char", ")", "c", ")", ";", "}", "String", "content", "=", "sBuff", ".", "toString", "(", ")", ";", "return", "content", ";", "}", "}", "</s>" ]
12,859
[ "<s>", "package", "smartrics", ".", "rest", ".", "test", ".", "fitnesse", ".", "fixture", ";", "import", "org", ".", "apache", ".", "commons", ".", "logging", ".", "Log", ";", "import", "org", ".", "apache", ".", "commons", ".", "logging", ".", "LogFactory", ";", "import", "fit", ".", "ActionFixture", ";", "public", "class", "HttpServerFixture", "extends", "ActionFixture", "{", "private", "static", "final", "Log", "LOG", "=", "LogFactory", ".", "getLog", "(", "HttpServerFixture", ".", "class", ")", ";", "private", "int", "port", ";", "private", "static", "HttpServer", "server", ";", "public", "HttpServerFixture", "(", ")", "throws", "Exception", "{", "super", "(", ")", ";", "}", "public", "void", "startServer", "(", "String", "port", ")", "{", "startServer", "(", "Integer", ".", "parseInt", "(", "port", ")", ")", ";", "}", "private", "void", "startServer", "(", "int", "port", ")", "{", "if", "(", "server", "==", "null", ")", "{", "this", ".", "port", "=", "port", ";", "LOG", ".", "info", "(", "\"\"", "+", "port", ")", ";", "server", "=", "new", "HttpServer", "(", "port", ")", ";", "server", ".", "addServlet", "(", "new", "ResourcesServlet", "(", ")", ",", "\"/\"", ")", ";", "server", ".", "start", "(", ")", ";", "}", "else", "{", "LOG", ".", "info", "(", "\"\"", "+", "port", ")", ";", "}", "}", "public", "boolean", "isStarted", "(", ")", "{", "return", "server", "!=", "null", "&&", "server", ".", "isStarted", "(", ")", ";", "}", "public", "boolean", "isStopped", "(", ")", "{", "return", "server", "!=", "null", "&&", "server", ".", "isStopped", "(", ")", ";", "}", "public", "void", "stopServer", "(", ")", "{", "if", "(", "server", "!=", "null", ")", "{", "LOG", ".", "info", "(", "\"\"", "+", "port", ")", ";", "server", ".", "stop", "(", ")", ";", "}", "else", "{", "if", "(", "port", "==", "0", ")", "{", "LOG", ".", "info", "(", "\"\"", ")", ";", "}", "else", "{", "LOG", ".", "info", "(", "\"\"", "+", "port", ")", ";", "}", "}", "}", "public", "void", "join", "(", ")", "{", "server", ".", "join", "(", ")", ";", "}", "public", "boolean", "resetResourcesDatabase", "(", ")", "{", "Resources", ".", "getInstance", "(", ")", ".", "reset", "(", ")", ";", "return", "true", ";", "}", "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "Exception", "{", "HttpServerFixture", "f", "=", "new", "HttpServerFixture", "(", ")", ";", "f", ".", "startServer", "(", "8765", ")", ";", "f", ".", "join", "(", ")", ";", "}", "}", "</s>" ]
12,860
[ "<s>", "package", "smartrics", ".", "rest", ".", "test", ".", "fitnesse", ".", "fixture", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "FileWriter", ";", "import", "fit", ".", "ActionFixture", ";", "public", "class", "FileUtilFixture", "extends", "ActionFixture", "{", "private", "String", "fileContents", ";", "private", "String", "fileName", ";", "public", "FileUtilFixture", "(", ")", "throws", "Exception", "{", "super", "(", ")", ";", "}", "public", "void", "content", "(", "String", "fileContents", ")", "{", "this", ".", "fileContents", "=", "fileContents", ";", "}", "public", "void", "name", "(", "String", "fileName", ")", "{", "this", ".", "fileName", "=", "fileName", ";", "}", "public", "boolean", "create", "(", ")", "throws", "Exception", "{", "File", "f", "=", "new", "File", "(", "fileName", ")", ";", "int", "pos", "=", "f", ".", "getPath", "(", ")", ".", "indexOf", "(", "f", ".", "getName", "(", ")", ")", ";", "new", "File", "(", "f", ".", "getPath", "(", ")", ".", "substring", "(", "0", ",", "pos", ")", ")", ".", "mkdirs", "(", ")", ";", "FileWriter", "fw", "=", "new", "FileWriter", "(", "f", ")", ";", "fw", ".", "write", "(", "fileContents", ")", ";", "fw", ".", "close", "(", ")", ";", "return", "true", ";", "}", "public", "boolean", "delete", "(", ")", "throws", "Exception", "{", "new", "File", "(", "fileName", ")", ".", "delete", "(", ")", ";", "return", "true", ";", "}", "public", "boolean", "exists", "(", ")", "throws", "Exception", "{", "return", "new", "File", "(", "fileName", ")", ".", "exists", "(", ")", ";", "}", "}", "</s>" ]
12,861
[ "<s>", "package", "smartrics", ".", "rest", ".", "test", ".", "fitnesse", ".", "fixture", ";", "import", "java", ".", "io", ".", "ByteArrayOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "InputStream", ";", "import", "java", ".", "io", ".", "PrintWriter", ";", "import", "java", ".", "io", ".", "UnsupportedEncodingException", ";", "import", "java", ".", "net", ".", "URLDecoder", ";", "import", "javax", ".", "servlet", ".", "ServletException", ";", "import", "javax", ".", "servlet", ".", "http", ".", "HttpServlet", ";", "import", "javax", ".", "servlet", ".", "http", ".", "HttpServletRequest", ";", "import", "javax", ".", "servlet", ".", "http", ".", "HttpServletResponse", ";", "import", "org", ".", "apache", ".", "commons", ".", "logging", ".", "Log", ";", "import", "org", ".", "apache", ".", "commons", ".", "logging", ".", "LogFactory", ";", "import", "com", ".", "oreilly", ".", "servlet", ".", "multipart", ".", "FilePart", ";", "import", "com", ".", "oreilly", ".", "servlet", ".", "multipart", ".", "MultipartParser", ";", "import", "com", ".", "oreilly", ".", "servlet", ".", "multipart", ".", "ParamPart", ";", "import", "com", ".", "oreilly", ".", "servlet", ".", "multipart", ".", "Part", ";", "public", "class", "ResourcesServlet", "extends", "HttpServlet", "{", "private", "static", "final", "Log", "LOG", "=", "LogFactory", ".", "getLog", "(", "ResourcesServlet", ".", "class", ")", ";", "public", "static", "final", "String", "CONTEXT_ROOT", "=", "\"/resources\"", ";", "private", "static", "final", "long", "serialVersionUID", "=", "-", "7012866414216034826L", ";", "private", "static", "final", "String", "DEF_CHARSET", "=", "\"ISO-8859-1\"", ";", "private", "final", "Resources", "resources", "=", "Resources", ".", "getInstance", "(", ")", ";", "public", "ResourcesServlet", "(", ")", "{", "LOG", ".", "info", "(", "\"Resources:", "\"", "+", "resources", ".", "toString", "(", ")", ")", ";", "}", "@", "Override", "protected", "void", "doGet", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "resp", ")", "throws", "ServletException", ",", "IOException", "{", "LOG", ".", "debug", "(", "\"\"", "+", "req", ".", "toString", "(", ")", ")", ";", "String", "uri", "=", "sanitise", "(", "req", ".", "getRequestURI", "(", ")", ")", ";", "String", "id", "=", "getId", "(", "uri", ")", ";", "String", "type", "=", "getType", "(", "uri", ")", ";", "String", "extension", "=", "getExtension", "(", "uri", ")", ";", "echoHeader", "(", "req", ",", "resp", ")", ";", "echoQString", "(", "req", ",", "resp", ")", ";", "try", "{", "if", "(", "id", "==", "null", ")", "{", "list", "(", "resp", ",", "type", ",", "extension", ")", ";", "headers", "(", "resp", ",", "extension", ",", "DEF_CHARSET", ")", ";", "}", "else", "if", "(", "resources", ".", "get", "(", "type", ",", "id", ")", "==", "null", ")", "{", "notFound", "(", "resp", ")", ";", "}", "else", "{", "if", "(", "resources", ".", "get", "(", "type", ",", "id", ")", ".", "isDeleted", "(", ")", ")", "{", "notFound", "(", "resp", ")", ";", "}", "else", "{", "found", "(", "resp", ",", "type", ",", "id", ")", ";", "headers", "(", "resp", ",", "extension", ",", "DEF_CHARSET", ")", ";", "}", "}", "}", "catch", "(", "RuntimeException", "e", ")", "{", "resp", ".", "sendError", "(", "HttpServletResponse", ".", "SC_BAD_REQUEST", ")", ";", "}", "finally", "{", "LOG", ".", "debug", "(", "\"\"", "+", "resp", ".", "toString", "(", ")", ")", ";", "}", "}", "private", "void", "echoQString", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "resp", ")", "{", "String", "qstring", "=", "req", ".", "getQueryString", "(", ")", ";", "if", "(", "qstring", "!=", "null", ")", "{", "resp", ".", "setHeader", "(", "\"Query-String\"", ",", "qstring", ")", ";", "}", "}", "private", "String", "sanitise", "(", "String", "rUri", ")", "{", "String", "uri", "=", "rUri", ";", "if", "(", "uri", ".", "endsWith", "(", "\"/\"", ")", ")", "{", "uri", "=", "uri", ".", "substring", "(", "0", ",", "uri", ".", "length", "(", ")", "-", "1", ")", ";", "}", "return", "uri", ";", "}", "private", "void", "headers", "(", "HttpServletResponse", "resp", ",", "String", "extension", ",", "String", "optCharset", ")", "{", "resp", ".", "setStatus", "(", "HttpServletResponse", ".", "SC_OK", ")", ";", "String", "s", "=", "\"\"", ";", "if", "(", "optCharset", "!=", "null", ")", "{", "s", "=", "\";charset=\"", "+", "optCharset", ";", "}", "resp", ".", "addHeader", "(", "\"Content-Type\"", ",", "\"application/\"", "+", "extension", "+", "s", ")", ";", "}", "private", "void", "list", "(", "HttpServletResponse", "resp", ",", "String", "type", ",", "String", "extension", ")", "throws", "IOException", "{", "if", "(", "type", ".", "contains", "(", "\"root-context\"", ")", ")", "{", "list", "(", "resp", ",", "extension", ")", ";", "}", "else", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "String", "slashremoved", "=", "type", ".", "substring", "(", "1", ")", ";", "if", "(", "\"json\"", ".", "equals", "(", "extension", ")", ")", "{", "buffer", ".", "append", "(", "\"{", "\\\"\"", "+", "slashremoved", "+", "\"\\\"", ":", "\"", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "\"<\"", "+", "slashremoved", "+", "\">\"", ")", ";", "}", "for", "(", "Resource", "r", ":", "resources", ".", "asCollection", "(", "type", ")", ")", "{", "buffer", ".", "append", "(", "r", ".", "getPayload", "(", ")", ")", ";", "}", "if", "(", "\"json\"", ".", "equals", "(", "extension", ")", ")", "{", "buffer", ".", "append", "(", "\"}\"", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "\"</\"", "+", "slashremoved", "+", "\">\"", ")", ";", "}", "resp", ".", "getOutputStream", "(", ")", ".", "write", "(", "buffer", ".", "toString", "(", ")", ".", "getBytes", "(", ")", ")", ";", "}", "}", "private", "void", "list", "(", "HttpServletResponse", "resp", ",", "String", "extension", ")", "throws", "IOException", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "if", "(", "\"json\"", ".", "equals", "(", "extension", ")", ")", "{", "buffer", ".", "append", "(", "\"\"", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "\"\"", ")", ";", "}", "resp", ".", "getOutputStream", "(", ")", ".", "write", "(", "buffer", ".", "toString", "(", ")", ".", "getBytes", "(", ")", ")", ";", "for", "(", "String", "s", ":", "resources", ".", "contexts", "(", ")", ")", "{", "list", "(", "resp", ",", "s", ",", "extension", ")", ";", "}", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "if", "(", "\"json\"", ".", "equals", "(", "extension", ")", ")", "{", "buffer", ".", "append", "(", "\"}\"", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "\"\"", ")", ";", "}", "resp", ".", "getOutputStream", "(", ")", ".", "write", "(", "buffer", ".", "toString", "(", ")", ".", "getBytes", "(", ")", ")", ";", "}", "private", "String", "getExtension", "(", "String", "uri", ")", "{", "int", "extensionPoint", "=", "uri", ".", "lastIndexOf", "(", "\".\"", ")", ";", "if", "(", "extensionPoint", "!=", "-", "1", ")", "{", "return", "uri", ".", "substring", "(", "extensionPoint", "+", "1", ")", ";", "}", "else", "{", "return", "\"xml\"", ";", "}", "}", "private", "void", "found", "(", "HttpServletResponse", "resp", ",", "String", "type", ",", "String", "id", ")", "throws", "IOException", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "Resource", "r", "=", "resources", ".", "get", "(", "type", ",", "id", ")", ";", "buffer", ".", "append", "(", "r", ")", ";", "resp", ".", "getOutputStream", "(", ")", ".", "write", "(", "buffer", ".", "toString", "(", ")", ".", "getBytes", "(", ")", ")", ";", "}", "private", "String", "getType", "(", "String", "uri", ")", "{", "if", "(", "uri", ".", "length", "(", ")", "<=", "1", ")", "{", "return", "\"\"", ";", "}", "int", "pos", "=", "uri", ".", "substring", "(", "1", ")", ".", "indexOf", "(", "'/'", ")", ";", "String", "ret", "=", "uri", ";", "if", "(", "pos", ">=", "0", ")", "{", "ret", "=", "uri", ".", "substring", "(", "0", ",", "pos", "+", "1", ")", ";", "}", "return", "ret", ";", "}", "private", "void", "notFound", "(", "HttpServletResponse", "resp", ")", "throws", "IOException", "{", "resp", ".", "getOutputStream", "(", ")", ".", "write", "(", "\"\"", ".", "getBytes", "(", ")", ")", ";", "resp", ".", "setStatus", "(", "HttpServletResponse", ".", "SC_NOT_FOUND", ")", ";", "}", "private", "void", "echoHeader", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "resp", ")", "{", "String", "s", "=", "req", ".", "getHeader", "(", "\"Echo-Header\"", ")", ";", "if", "(", "s", "!=", "null", ")", "{", "resp", ".", "setHeader", "(", "\"Echo-Header\"", ",", "s", ")", ";", "}", "}", "@", "Override", "protected", "void", "doDelete", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "resp", ")", "throws", "ServletException", ",", "IOException", "{", "LOG", ".", "debug", "(", "\"\"", "+", "req", ".", "toString", "(", ")", ")", ";", "String", "uri", "=", "sanitise", "(", "req", ".", "getRequestURI", "(", ")", ")", ";", "String", "type", "=", "getType", "(", "uri", ")", ";", "echoHeader", "(", "req", ",", "resp", ")", ";", "String", "id", "=", "getId", "(", "uri", ")", ";", "Resource", "resource", "=", "resources", ".", "get", "(", "type", ",", "id", ")", ";", "if", "(", "resource", "!=", "null", ")", "{", "resources", ".", "remove", "(", "type", ",", "id", ")", ";", "resp", ".", "getOutputStream", "(", ")", ".", "write", "(", "\"\"", ".", "getBytes", "(", ")", ")", ";", "resp", ".", "setStatus", "(", "HttpServletResponse", ".", "SC_OK", ")", ";", "}", "else", "{", "notFound", "(", "resp", ")", ";", "}", "resp", ".", "getOutputStream", "(", ")", ".", "write", "(", "\"\"", ".", "getBytes", "(", ")", ")", ";", "resp", ".", "setStatus", "(", "HttpServletResponse", ".", "SC_NO_CONTENT", ")", ";", "LOG", ".", "debug", "(", "\"\"", "+", "req", ".", "toString", "(", ")", ")", ";", "}", "@", "Override", "protected", "void", "doPut", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "resp", ")", "throws", "ServletException", ",", "IOException", "{", "LOG", ".", "debug", "(", "\"\"", "+", "req", ".", "toString", "(", ")", ")", ";", "echoHeader", "(", "req", ",", "resp", ")", ";", "String", "uri", "=", "sanitise", "(", "req", ".", "getRequestURI", "(", ")", ")", ";", "String", "id", "=", "getId", "(", "uri", ")", ";", "String", "type", "=", "getType", "(", "uri", ")", ";", "String", "content", "=", "getContent", "(", "req", ".", "getInputStream", "(", ")", ")", ";", "Resource", "resource", "=", "resources", ".", "get", "(", "type", ",", "id", ")", ";", "if", "(", "resource", "!=", "null", ")", "{", "resource", ".", "setPayload", "(", "content", ")", ";", "resp", ".", "getOutputStream", "(", ")", ".", "write", "(", "\"\"", ".", "getBytes", "(", ")", ")", ";", "resp", ".", "setStatus", "(", "HttpServletResponse", ".", "SC_OK", ")", ";", "}", "else", "{", "notFound", "(", "resp", ")", ";", "}", "LOG", ".", "debug", "(", "\"\"", "+", "req", ".", "toString", "(", ")", ")", ";", "}", "private", "String", "getId", "(", "String", "uri", ")", "{", "if", "(", "uri", ".", "length", "(", ")", "<=", "1", ")", "{", "return", "null", ";", "}", "int", "pos", "=", "uri", ".", "substring", "(", "1", ")", ".", "lastIndexOf", "(", "\"/\"", ")", ";", "String", "sId", "=", "null", ";", "if", "(", "pos", ">", "0", ")", "{", "sId", "=", "uri", ".", "substring", "(", "pos", "+", "2", ")", ";", "}", "if", "(", "sId", "!=", "null", ")", "{", "int", "pos2", "=", "sId", ".", "lastIndexOf", "(", "'.'", ")", ";", "if", "(", "pos2", ">=", "0", ")", "{", "sId", "=", "sId", ".", "substring", "(", "0", ",", "pos2", ")", ";", "}", "}", "return", "sId", ";", "}", "private", "void", "processMultiPart", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "resp", ")", "throws", "IOException", "{", "PrintWriter", "out", "=", "resp", ".", "getWriter", "(", ")", ";", "resp", ".", "setContentType", "(", "\"text/plain\"", ")", ";", "MultipartParser", "mp", "=", "new", "MultipartParser", "(", "req", ",", "2048", ")", ";", "Part", "part", "=", "null", ";", "while", "(", "(", "part", "=", "mp", ".", "readNextPart", "(", ")", ")", "!=", "null", ")", "{", "String", "name", "=", "part", ".", "getName", "(", ")", ".", "trim", "(", ")", ";", "if", "(", "part", ".", "isParam", "(", ")", ")", "{", "ParamPart", "paramPart", "=", "(", "ParamPart", ")", "part", ";", "String", "value", "=", "paramPart", ".", "getStringValue", "(", ")", ".", "trim", "(", ")", ";", "LOG", ".", "info", "(", "\"param;", "name=\"", "+", "name", "+", "\",", "value=\"", "+", "value", ")", ";", "out", ".", "print", "(", "\"param;", "name=\"", "+", "name", "+", "\",", "value=\"", "+", "value", ")", ";", "}", "else", "if", "(", "part", ".", "isFile", "(", ")", ")", "{", "FilePart", "filePart", "=", "(", "FilePart", ")", "part", ";", "String", "fileName", "=", "filePart", ".", "getFileName", "(", ")", ";", "if", "(", "fileName", "!=", "null", ")", "{", "ByteArrayOutputStream", "baos", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "long", "size", "=", "filePart", ".", "writeTo", "(", "baos", ")", ";", "LOG", ".", "info", "(", "\"file;", "name=\"", "+", "name", "+", "\";", "filename=\"", "+", "fileName", "+", "\",", "filePath=\"", "+", "filePart", ".", "getFilePath", "(", ")", "+", "\"\"", "+", "filePart", ".", "getContentType", "(", ")", "+", "\",", "size=\"", "+", "size", ")", ";", "out", ".", "print", "(", "String", ".", "format", "(", "\"%s:", "%s\"", ",", "name", ",", "new", "String", "(", "baos", ".", "toByteArray", "(", ")", ")", ".", "trim", "(", ")", ")", ")", ";", "}", "else", "{", "LOG", ".", "info", "(", "\"file;", "name=\"", "+", "name", "+", "\";", "EMPTY\"", ")", ";", "}", "out", ".", "flush", "(", ")", ";", "}", "}", "resp", ".", "setStatus", "(", "HttpServletResponse", ".", "SC_OK", ")", ";", "}", "@", "Override", "protected", "void", "doPost", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "resp", ")", "throws", "ServletException", ",", "IOException", "{", "LOG", ".", "debug", "(", "\"\"", "+", "req", ".", "toString", "(", ")", ")", ";", "echoHeader", "(", "req", ",", "resp", ")", ";", "String", "uri", "=", "sanitise", "(", "req", ".", "getRequestURI", "(", ")", ")", ";", "String", "type", "=", "getType", "(", "uri", ")", ";", "try", "{", "String", "contentType", "=", "req", ".", "getContentType", "(", ")", ";", "if", "(", "contentType", ".", "equals", "(", "\"\"", ")", ")", "{", "LOG", ".", "debug", "(", "\"\"", ")", ";", "processFileUpload", "(", "req", ",", "resp", ")", ";", "}", "else", "if", "(", "contentType", ".", "startsWith", "(", "\"multipart\"", ")", ")", "{", "LOG", ".", "debug", "(", "\"\"", ")", ";", "processMultiPart", "(", "req", ",", "resp", ")", ";", "}", "else", "{", "String", "content", "=", "getContent", "(", "req", ".", "getInputStream", "(", ")", ")", ";", "if", "(", "contentType", ".", "contains", "(", "\"\"", ")", ")", "{", "try", "{", "generateResponse", "(", "resp", ",", "type", ",", "noddyKvpToXml", "(", "content", ",", "\"UTF-8\"", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "LOG", ".", "warn", "(", "\"\"", "+", "content", ")", ";", "resp", ".", "sendError", "(", "HttpServletResponse", ".", "SC_BAD_REQUEST", ")", ";", "}", "}", "else", "if", "(", "content", ".", "trim", "(", ")", ".", "startsWith", "(", "\"<\"", ")", "||", "content", ".", "trim", "(", ")", ".", "endsWith", "(", "\"}\"", ")", ")", "{", "generateResponse", "(", "resp", ",", "type", ",", "content", ")", ";", "}", "else", "{", "resp", ".", "sendError", "(", "HttpServletResponse", ".", "SC_BAD_REQUEST", ")", ";", "}", "}", "}", "catch", "(", "RuntimeException", "e", ")", "{", "resp", ".", "sendError", "(", "HttpServletResponse", ".", "SC_INTERNAL_SERVER_ERROR", ")", ";", "}", "LOG", ".", "debug", "(", "\"\"", "+", "req", ".", "toString", "(", ")", ")", ";", "}", "private", "String", "noddyKvpToXml", "(", "String", "content", ",", "String", "encoding", ")", "throws", "UnsupportedEncodingException", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "sb", ".", "append", "(", "\"<resource>\"", ")", ".", "append", "(", "\"n\"", ")", ";", "String", "[", "]", "kvpArray", "=", "content", ".", "split", "(", "\"&\"", ")", ";", "for", "(", "String", "e", ":", "kvpArray", ")", "{", "String", "[", "]", "kvp", "=", "e", ".", "split", "(", "\"=\"", ")", ";", "sb", ".", "append", "(", "\"<\"", ")", ".", "append", "(", "kvp", "[", "0", "]", ")", ".", "append", "(", "\">\"", ")", ";", "if", "(", "kvp", ".", "length", ">", "1", ")", "{", "sb", ".", "append", "(", "URLDecoder", ".", "decode", "(", "kvp", "[", "1", "]", ",", "encoding", ")", ")", ";", "}", "sb", ".", "append", "(", "\"</\"", ")", ".", "append", "(", "kvp", "[", "0", "]", ")", ".", "append", "(", "\">\"", ")", ".", "append", "(", "\"n\"", ")", ";", "}", "sb", ".", "append", "(", "\"</resource>\"", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}", "private", "void", "generateResponse", "(", "HttpServletResponse", "resp", ",", "String", "type", ",", "String", "content", ")", "{", "Resource", "newResource", "=", "new", "Resource", "(", "content", ")", ";", "resources", ".", "add", "(", "type", ",", "newResource", ")", ";", "resp", ".", "setStatus", "(", "HttpServletResponse", ".", "SC_CREATED", ")", ";", "resp", ".", "addHeader", "(", "\"Location\"", ",", "type", "+", "\"/\"", "+", "newResource", ".", "getId", "(", ")", ")", ";", "}", "private", "void", "processFileUpload", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "resp", ")", "throws", "IOException", "{", "InputStream", "is", "=", "req", ".", "getInputStream", "(", ")", ";", "PrintWriter", "out", "=", "resp", ".", "getWriter", "(", ")", ";", "resp", ".", "setContentType", "(", "\"text/plain\"", ")", ";", "String", "fileContents", "=", "getContent", "(", "is", ")", ";", "out", ".", "print", "(", "fileContents", ".", "trim", "(", ")", ")", ";", "out", ".", "flush", "(", ")", ";", "resp", ".", "setStatus", "(", "HttpServletResponse", ".", "SC_OK", ")", ";", "}", "private", "String", "getContent", "(", "InputStream", "is", ")", "throws", "IOException", "{", "StringBuffer", "sBuff", "=", "new", "StringBuffer", "(", ")", ";", "int", "c", ";", "while", "(", "(", "c", "=", "is", ".", "read", "(", ")", ")", "!=", "-", "1", ")", "{", "sBuff", ".", "append", "(", "(", "char", ")", "c", ")", ";", "}", "String", "content", "=", "sBuff", ".", "toString", "(", ")", ";", "return", "content", ";", "}", "}", "</s>" ]
12,862
[ "<s>", "package", "smartrics", ".", "rest", ".", "test", ".", "fitnesse", ".", "fixture", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "InputStream", ";", "public", "final", "class", "ServletUtils", "{", "private", "ServletUtils", "(", ")", "{", "}", "public", "static", "String", "sanitiseUri", "(", "String", "rUri", ")", "{", "String", "uri", "=", "rUri", ";", "if", "(", "uri", ".", "endsWith", "(", "\"/\"", ")", ")", "{", "uri", "=", "uri", ".", "substring", "(", "0", ",", "uri", ".", "length", "(", ")", "-", "1", ")", ";", "}", "return", "uri", ";", "}", "public", "static", "String", "getContent", "(", "InputStream", "is", ")", "throws", "IOException", "{", "StringBuffer", "sBuff", "=", "new", "StringBuffer", "(", ")", ";", "int", "c", ";", "while", "(", "(", "c", "=", "is", ".", "read", "(", ")", ")", "!=", "-", "1", ")", "{", "sBuff", ".", "append", "(", "(", "char", ")", "c", ")", ";", "}", "String", "content", "=", "sBuff", ".", "toString", "(", ")", ";", "return", "content", ";", "}", "}", "</s>" ]
12,863
[ "<s>", "package", "smartrics", ".", "rest", ".", "test", ".", "fitnesse", ".", "fixture", ";", "import", "fit", ".", "ActionFixture", ";", "import", "fit", ".", "Fixture", ";", "public", "class", "LetTestActionFixture", "extends", "ActionFixture", "{", "private", "String", "symbolName", ";", "public", "void", "symbolName", "(", "String", "name", ")", "{", "this", ".", "symbolName", "=", "name", ";", "}", "public", "String", "symbolValue", "(", ")", "{", "return", "(", "String", ")", "Fixture", ".", "getSymbol", "(", "symbolName", ")", ";", "}", "public", "void", "symbolValue", "(", "String", "val", ")", "{", "Fixture", ".", "setSymbol", "(", "symbolName", ",", "val", ")", ";", "}", "}", "</s>" ]
12,864
[ "<s>", "package", "smartrics", ".", "rest", ".", "test", ".", "fitnesse", ".", "fixture", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Collection", ";", "import", "java", ".", "util", ".", "Collections", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "java", ".", "util", ".", "Map", ".", "Entry", ";", "import", "java", ".", "util", ".", "Vector", ";", "public", "class", "Resources", "{", "private", "final", "Map", "<", "String", ",", "Map", "<", "String", ",", "Resource", ">", ">", "resourceDb", "=", "Collections", ".", "synchronizedMap", "(", "new", "HashMap", "<", "String", ",", "Map", "<", "String", ",", "Resource", ">", ">", "(", ")", ")", ";", "private", "static", "Resources", "instance", "=", "new", "Resources", "(", ")", ";", "private", "int", "counter", "=", "0", ";", "public", "static", "Resources", "getInstance", "(", ")", "{", "return", "instance", ";", "}", "public", "void", "clear", "(", ")", "{", "for", "(", "String", "c", ":", "resourceDb", ".", "keySet", "(", ")", ")", "{", "resourceDb", ".", "get", "(", "c", ")", ".", "clear", "(", ")", ";", "}", "resourceDb", ".", "clear", "(", ")", ";", "}", "public", "Collection", "<", "Resource", ">", "asCollection", "(", "String", "context", ")", "{", "Collection", "<", "Resource", ">", "c", "=", "new", "Vector", "<", "Resource", ">", "(", ")", ";", "Map", "<", "String", ",", "Resource", ">", "m", "=", "resourceDb", ".", "get", "(", "context", ")", ";", "if", "(", "m", "!=", "null", ")", "{", "for", "(", "Entry", "<", "String", ",", "Resource", ">", "e", ":", "m", ".", "entrySet", "(", ")", ")", "{", "String", "s", "=", "e", ".", "getKey", "(", ")", ";", "c", ".", "add", "(", "m", ".", "get", "(", "s", ")", ")", ";", "}", "}", "return", "c", ";", "}", "public", "List", "<", "String", ">", "contexts", "(", ")", "{", "List", "<", "String", ">", "ctxKeys", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "ctxKeys", ".", "addAll", "(", "resourceDb", ".", "keySet", "(", ")", ")", ";", "return", "ctxKeys", ";", "}", "public", "void", "add", "(", "String", "context", ",", "Resource", "r", ")", "{", "if", "(", "r", ".", "getId", "(", ")", "==", "null", ")", "{", "r", ".", "setId", "(", "Integer", ".", "toString", "(", "newCounter", "(", ")", ")", ")", ";", "}", "Map", "<", "String", ",", "Resource", ">", "m", "=", "getMapForContext", "(", "context", ")", ";", "m", ".", "put", "(", "r", ".", "getId", "(", ")", ",", "r", ")", ";", "}", "private", "Map", "<", "String", ",", "Resource", ">", "getMapForContext", "(", "String", "context", ")", "{", "Map", "<", "String", ",", "Resource", ">", "m", "=", "resourceDb", ".", "get", "(", "context", ")", ";", "if", "(", "m", "==", "null", ")", "{", "m", "=", "new", "HashMap", "<", "String", ",", "Resource", ">", "(", ")", ";", "resourceDb", ".", "put", "(", "context", ",", "m", ")", ";", "}", "return", "m", ";", "}", "public", "Resource", "get", "(", "String", "context", ",", "String", "i", ")", "{", "return", "getMapForContext", "(", "context", ")", ".", "get", "(", "i", ")", ";", "}", "public", "int", "size", "(", "String", "context", ")", "{", "return", "getMapForContext", "(", "context", ")", ".", "size", "(", ")", ";", "}", "public", "Resource", "remove", "(", "String", "context", ",", "String", "index", ")", "{", "return", "getMapForContext", "(", "context", ")", ".", "remove", "(", "index", ")", ";", "}", "public", "void", "remove", "(", "String", "context", ",", "Resource", "o", ")", "{", "remove", "(", "context", ",", "o", ".", "getId", "(", ")", ")", ";", "}", "public", "void", "reset", "(", ")", "{", "clear", "(", ")", ";", "counter", "=", "0", ";", "add", "(", "\"/resources\"", ",", "new", "Resource", "(", "\"\"", "+", "\"\"", "+", "\"n</resource>\"", ")", ")", ";", "add", "(", "\"/resources\"", ",", "new", "Resource", "(", "\"\"", "+", "\"\"", ")", ")", ";", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "sb", ".", "append", "(", "\"<resource>n\"", ")", ";", "sb", ".", "append", "(", "\"\"", ")", ";", "sb", ".", "append", "(", "\"\"", ")", ";", "sb", ".", "append", "(", "\"\"", ")", ";", "sb", ".", "append", "(", "\"\"", ")", ";", "sb", ".", "append", "(", "\"\"", ")", ";", "sb", ".", "append", "(", "\"\"", ")", ";", "sb", ".", "append", "(", "\"\"", ")", ";", "sb", ".", "append", "(", "\"\"", ")", ";", "sb", ".", "append", "(", "\"\"", ")", ";", "sb", ".", "append", "(", "\"\"", ")", ";", "sb", ".", "append", "(", "\"", "<data>n\"", ")", ";", "sb", ".", "append", "(", "\"\"", ")", ";", "sb", ".", "append", "(", "\"\"", ")", ";", "sb", ".", "append", "(", "\"\"", ")", ";", "sb", ".", "append", "(", "\"\"", ")", ";", "sb", ".", "append", "(", "\"\"", ")", ";", "sb", ".", "append", "(", "\"\"", ")", ";", "sb", ".", "append", "(", "\"\"", ")", ";", "sb", ".", "append", "(", "\"\"", ")", ";", "sb", ".", "append", "(", "\"\"", ")", ";", "sb", ".", "append", "(", "\"\"", ")", ";", "sb", ".", "append", "(", "\"", "</data>n\"", ")", ";", "sb", ".", "append", "(", "\"</resource>n\"", ")", ";", "add", "(", "\"/resources\"", ",", "new", "Resource", "(", "\"100\"", ",", "sb", ".", "toString", "(", ")", ")", ")", ";", "}", "private", "synchronized", "int", "newCounter", "(", ")", "{", "return", "counter", "++", ";", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "StringBuffer", "b", "=", "new", "StringBuffer", "(", ")", ";", "String", "nl", "=", "System", ".", "getProperty", "(", "\"\"", ")", ";", "b", ".", "append", "(", "\"Resources:[\"", ")", ".", "append", "(", "nl", ")", ";", "for", "(", "String", "c", ":", "resourceDb", ".", "keySet", "(", ")", ")", "{", "b", ".", "append", "(", "\"", "Context(\"", ")", ".", "append", "(", "c", ")", ".", "append", "(", "\"):[\"", ")", ".", "append", "(", "nl", ")", ";", "for", "(", "Resource", "r", ":", "asCollection", "(", "c", ")", ")", "{", "b", ".", "append", "(", "r", ")", ".", "append", "(", "nl", ")", ";", "}", "b", ".", "append", "(", "\"", "]\"", ")", ".", "append", "(", "nl", ")", ";", "}", "b", ".", "append", "(", "\"]\"", ")", ".", "append", "(", "nl", ")", ";", "return", "b", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
12,865
[ "<s>", "package", "smartrics", ".", "rest", ".", "test", ".", "fitnesse", ".", "fixture", ";", "import", "javax", ".", "servlet", ".", "http", ".", "HttpServlet", ";", "import", "org", ".", "apache", ".", "commons", ".", "logging", ".", "Log", ";", "import", "org", ".", "apache", ".", "commons", ".", "logging", ".", "LogFactory", ";", "import", "org", ".", "apache", ".", "log4j", ".", "BasicConfigurator", ";", "import", "org", ".", "mortbay", ".", "jetty", ".", "Connector", ";", "import", "org", ".", "mortbay", ".", "jetty", ".", "Server", ";", "import", "org", ".", "mortbay", ".", "jetty", ".", "bio", ".", "SocketConnector", ";", "import", "org", ".", "mortbay", ".", "jetty", ".", "servlet", ".", "Context", ";", "import", "org", ".", "mortbay", ".", "jetty", ".", "servlet", ".", "ServletHolder", ";", "public", "class", "HttpServer", "{", "private", "static", "final", "Log", "LOG", "=", "LogFactory", ".", "getLog", "(", "HttpServer", ".", "class", ")", ";", "private", "Server", "server", "=", "null", ";", "private", "int", "port", ";", "public", "HttpServer", "(", "int", "port", ")", "{", "BasicConfigurator", ".", "configure", "(", ")", ";", "server", "=", "new", "Server", "(", ")", ";", "server", ".", "setStopAtShutdown", "(", "true", ")", ";", "setPort", "(", "port", ")", ";", "}", "protected", "Server", "getServer", "(", ")", "{", "return", "server", ";", "}", "public", "String", "stop", "(", ")", "{", "String", "ret", "=", "null", ";", "LOG", ".", "debug", "(", "\"\"", "+", "getPort", "(", ")", ")", ";", "try", "{", "getServer", "(", ")", ".", "stop", "(", ")", ";", "int", "watchdog", "=", "30", ";", "while", "(", "!", "getServer", "(", ")", ".", "isStopped", "(", ")", "&&", "watchdog", ">", "0", ")", "{", "Thread", ".", "sleep", "(", "100", ")", ";", "watchdog", "--", ";", "}", "ret", "=", "\"OK\"", ";", "}", "catch", "(", "Exception", "e", ")", "{", "ret", "=", "\"\"", "+", "e", ".", "getMessage", "(", ")", ";", "}", "if", "(", "!", "getServer", "(", ")", ".", "isStopped", "(", ")", ")", "{", "ret", "=", "\"\"", ";", "}", "return", "ret", ";", "}", "private", "void", "setPort", "(", "int", "port", ")", "{", "LOG", ".", "debug", "(", "\"\"", "+", "port", ")", ";", "Connector", "connector", "=", "createHttpConnector", "(", "port", ")", ";", "addConnector", "(", "port", ",", "connector", ")", ";", "this", ".", "port", "=", "port", ";", "}", "private", "void", "addConnector", "(", "int", "port", ",", "Connector", "connector", ")", "{", "boolean", "found", "=", "false", ";", "Connector", "[", "]", "cArray", "=", "getServer", "(", ")", ".", "getConnectors", "(", ")", ";", "if", "(", "cArray", "!=", "null", ")", "{", "for", "(", "Connector", "c", ":", "cArray", ")", "{", "if", "(", "c", ".", "getPort", "(", ")", "==", "port", ")", "{", "found", "=", "true", ";", "break", ";", "}", "}", "}", "if", "(", "!", "found", ")", "{", "getServer", "(", ")", ".", "addConnector", "(", "connector", ")", ";", "}", "}", "private", "Connector", "createHttpConnector", "(", "int", "port", ")", "{", "Connector", "connector", "=", "new", "SocketConnector", "(", ")", ";", "connector", ".", "setPort", "(", "port", ")", ";", "return", "connector", ";", "}", "public", "int", "getPort", "(", ")", "{", "return", "port", ";", "}", "public", "String", "start", "(", ")", "{", "String", "ret", "=", "null", ";", "LOG", ".", "debug", "(", "\"\"", "+", "getPort", "(", ")", ")", ";", "try", "{", "getServer", "(", ")", ".", "start", "(", ")", ";", "int", "watchdog", "=", "30", ";", "while", "(", "!", "getServer", "(", ")", ".", "isRunning", "(", ")", "&&", "!", "getServer", "(", ")", ".", "isStarted", "(", ")", "&&", "watchdog", ">", "0", ")", "{", "Thread", ".", "sleep", "(", "100", ")", ";", "watchdog", "--", ";", "}", "ret", "=", "\"OK\"", ";", "}", "catch", "(", "Exception", "e", ")", "{", "ret", "=", "\"\"", "+", "e", ".", "getMessage", "(", ")", ";", "LOG", ".", "error", "(", "ret", ",", "e", ")", ";", "}", "if", "(", "!", "getServer", "(", ")", ".", "isRunning", "(", ")", ")", "{", "ret", "=", "\"\"", ";", "}", "return", "ret", ";", "}", "public", "boolean", "isStarted", "(", ")", "{", "return", "server", ".", "isStarted", "(", ")", ";", "}", "public", "boolean", "isStopped", "(", ")", "{", "return", "server", ".", "isStopped", "(", ")", ";", "}", "public", "void", "join", "(", ")", "{", "try", "{", "getServer", "(", ")", ".", "join", "(", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "\"\"", ",", "e", ")", ";", "}", "}", "public", "void", "addServlet", "(", "HttpServlet", "servlet", ",", "String", "ctxRoot", ")", "{", "Context", "ctx", "=", "new", "Context", "(", "server", ",", "ctxRoot", ",", "Context", ".", "SESSIONS", ")", ";", "ctx", ".", "addServlet", "(", "new", "ServletHolder", "(", "servlet", ")", ",", "\"/*\"", ")", ";", "}", "}", "</s>" ]
12,866
[ "<s>", "package", "cz", ".", "festomat", ".", "server", ".", "servlets", ";", "import", "javax", ".", "jdo", ".", "JDOHelper", ";", "import", "javax", ".", "jdo", ".", "PersistenceManager", ";", "import", "javax", ".", "jdo", ".", "PersistenceManagerFactory", ";", "public", "class", "PMF", "{", "private", "static", "final", "PersistenceManagerFactory", "pmfInstance", "=", "JDOHelper", ".", "getPersistenceManagerFactory", "(", "\"\"", ")", ";", "private", "PMF", "(", ")", "{", "}", "public", "static", "PersistenceManager", "getManager", "(", ")", "{", "return", "PMF", ".", "pmfInstance", ".", "getPersistenceManager", "(", ")", ";", "}", "}", "</s>" ]
12,867
[ "<s>", "package", "cz", ".", "festomat", ".", "server", ".", "servlets", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "PrintWriter", ";", "import", "java", ".", "text", ".", "Normalizer", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Collection", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "javax", ".", "jdo", ".", "PersistenceManager", ";", "import", "javax", ".", "jdo", ".", "Query", ";", "import", "javax", ".", "servlet", ".", "ServletException", ";", "import", "javax", ".", "servlet", ".", "http", ".", "HttpServlet", ";", "import", "javax", ".", "servlet", ".", "http", ".", "HttpServletRequest", ";", "import", "javax", ".", "servlet", ".", "http", ".", "HttpServletResponse", ";", "import", "com", ".", "google", ".", "appengine", ".", "api", ".", "datastore", ".", "KeyFactory", ";", "import", "com", ".", "google", ".", "gson", ".", "Gson", ";", "import", "cz", ".", "festomat", ".", "server", ".", "bean", ".", "CommentBean", ";", "import", "cz", ".", "festomat", ".", "server", ".", "bean", ".", "FestivalBean", ";", "import", "cz", ".", "festomat", ".", "server", ".", "bean", ".", "FestivalListBean", ";", "import", "cz", ".", "festomat", ".", "server", ".", "model", ".", "Comment", ";", "import", "cz", ".", "festomat", ".", "server", ".", "model", ".", "Festival", ";", "public", "class", "FestivalOperator", "extends", "HttpServlet", "{", "private", "static", "final", "long", "serialVersionUID", "=", "491455767310850876L", ";", "private", "final", "String", "uriFestivalDetail", "=", "\"\"", ";", "private", "final", "String", "uriFestivalComments", "=", "\"\"", ";", "private", "final", "String", "uriFestivalList", "=", "\"^/list$\"", ";", "private", "final", "String", "uriFestivalCommentNew", "=", "\"\"", ";", "private", "static", "final", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "FestivalOperator", ".", "class", ".", "getName", "(", ")", ")", ";", "@", "Override", "protected", "void", "doGet", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "resp", ")", "throws", "ServletException", ",", "IOException", "{", "String", "uri", "=", "req", ".", "getRequestURI", "(", ")", ";", "PrintWriter", "out", "=", "resp", ".", "getWriter", "(", ")", ";", "log", ".", "info", "(", "uri", ")", ";", "resp", ".", "setContentType", "(", "\"\"", ")", ";", "if", "(", "uri", ".", "matches", "(", "uriFestivalComments", ")", ")", "{", "Festival", "f", "=", "PMF", ".", "getManager", "(", ")", ".", "getObjectById", "(", "Festival", ".", "class", ",", "KeyFactory", ".", "stringToKey", "(", "uri", ".", "split", "(", "\"/\"", ")", "[", "1", "]", ")", ")", ";", "Collection", "<", "CommentBean", ">", "obj", "=", "new", "ArrayList", "<", "CommentBean", ">", "(", ")", ";", "for", "(", "Comment", "c", ":", "f", ".", "getKomentare", "(", ")", ")", "{", "if", "(", "req", ".", "getParameterMap", "(", ")", ".", "keySet", "(", ")", ".", "contains", "(", "\"search\"", ")", ")", "{", "if", "(", "c", ".", "getText", "(", ")", ".", "contains", "(", "req", ".", "getParameter", "(", "\"search\"", ")", ")", ")", "{", "obj", ".", "add", "(", "new", "CommentBean", "(", "c", ".", "getAutor", "(", ")", ",", "c", ".", "getTime", "(", ")", ",", "c", ".", "getText", "(", ")", ")", ")", ";", "}", "}", "else", "{", "obj", ".", "add", "(", "new", "CommentBean", "(", "c", ".", "getAutor", "(", ")", ",", "c", ".", "getTime", "(", ")", ",", "c", ".", "getText", "(", ")", ")", ")", ";", "}", "}", "Gson", "gson", "=", "new", "Gson", "(", ")", ";", "out", ".", "write", "(", "gson", ".", "toJson", "(", "obj", ")", ")", ";", "}", "else", "if", "(", "uri", ".", "matches", "(", "uriFestivalList", ")", ")", "{", "Query", "q", "=", "PMF", ".", "getManager", "(", ")", ".", "newQuery", "(", "Festival", ".", "class", ")", ";", "Collection", "<", "Festival", ">", "result", "=", "(", "Collection", ")", "q", ".", "execute", "(", ")", ";", "List", "<", "FestivalListBean", ">", "obj", "=", "new", "ArrayList", "<", "FestivalListBean", ">", "(", ")", ";", "for", "(", "Festival", "f", ":", "result", ")", "{", "obj", ".", "add", "(", "new", "FestivalListBean", "(", "KeyFactory", ".", "keyToString", "(", "f", ".", "getKey", "(", ")", ")", ",", "removeDiacritics", "(", "f", ".", "getJmeno", "(", ")", ")", ",", "normalizeMicrodegree", "(", "f", ".", "getLng", "(", ")", ")", ",", "normalizeMicrodegree", "(", "f", ".", "getLat", "(", ")", ")", ",", "f", ".", "getZacaten", "(", ")", ")", ")", ";", "}", "Gson", "gson", "=", "new", "Gson", "(", ")", ";", "out", ".", "write", "(", "gson", ".", "toJson", "(", "obj", ")", ")", ";", "}", "else", "if", "(", "uri", ".", "matches", "(", "uriFestivalDetail", ")", ")", "{", "Festival", "f", "=", "PMF", ".", "getManager", "(", ")", ".", "getObjectById", "(", "Festival", ".", "class", ",", "KeyFactory", ".", "stringToKey", "(", "uri", ".", "split", "(", "\"/\"", ")", "[", "1", "]", ")", ")", ";", "FestivalBean", "fb", "=", "new", "FestivalBean", "(", "KeyFactory", ".", "keyToString", "(", "f", ".", "getKey", "(", ")", ")", ",", "f", ".", "getAdresa", "(", ")", ",", "removeDiacritics", "(", "f", ".", "getJmeno", "(", ")", ")", ",", "normalizeMicrodegree", "(", "f", ".", "getLng", "(", ")", ")", ",", "normalizeMicrodegree", "(", "f", ".", "getLat", "(", ")", ")", ",", "f", ".", "getZacaten", "(", ")", ",", "f", ".", "getKonec", "(", ")", ",", "removeDiacritics", "(", "f", ".", "getPopis", "(", ")", ")", ")", ";", "Gson", "gson", "=", "new", "Gson", "(", ")", ";", "out", ".", "write", "(", "gson", ".", "toJson", "(", "fb", ")", ")", ";", "}", "}", "@", "Override", "protected", "void", "doPost", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "resp", ")", "throws", "ServletException", ",", "IOException", "{", "String", "uri", "=", "req", ".", "getRequestURI", "(", ")", ";", "if", "(", "uri", ".", "matches", "(", "uriFestivalCommentNew", ")", ")", "{", "Gson", "gson", "=", "new", "Gson", "(", ")", ";", "CommentBean", "cb", "=", "gson", ".", "fromJson", "(", "req", ".", "getParameter", "(", "\"comment\"", ")", ",", "CommentBean", ".", "class", ")", ";", "log", ".", "info", "(", "req", ".", "getParameter", "(", "\"comment\"", ")", ")", ";", "PersistenceManager", "pm", "=", "PMF", ".", "getManager", "(", ")", ";", "Festival", "f", "=", "pm", ".", "getObjectById", "(", "Festival", ".", "class", ",", "KeyFactory", ".", "stringToKey", "(", "uri", ".", "split", "(", "\"/\"", ")", "[", "1", "]", ")", ")", ";", "Comment", "c", "=", "new", "Comment", "(", ")", ";", "c", ".", "setTime", "(", "cb", ".", "getTime", "(", ")", ")", ";", "c", ".", "setAutor", "(", "cb", ".", "getAuthor", "(", ")", ")", ";", "c", ".", "setFestival", "(", "f", ")", ";", "c", ".", "setText", "(", "cb", ".", "getText", "(", ")", ")", ";", "try", "{", "pm", ".", "makePersistent", "(", "c", ")", ";", "}", "finally", "{", "pm", ".", "close", "(", ")", ";", "}", "}", "}", "public", "static", "String", "removeDiacritics", "(", "String", "s", ")", "{", "return", "Normalizer", ".", "normalize", "(", "s", ",", "Normalizer", ".", "Form", ".", "NFD", ")", ".", "replaceAll", "(", "\"\"", ",", "\"\"", ")", ";", "}", "private", "String", "normalizeMicrodegree", "(", "String", "degree", ")", "{", "String", "[", "]", "tokens", "=", "degree", ".", "split", "(", "\"\\\\.\"", ")", ";", "String", "part", "=", "tokens", "[", "1", "]", ".", "substring", "(", "0", ",", "Math", ".", "min", "(", "6", ",", "tokens", "[", "1", "]", ".", "length", "(", ")", ")", ")", ";", "while", "(", "part", ".", "length", "(", ")", "<", "6", ")", "{", "part", "=", "part", "+", "\"0\"", ";", "}", "return", "tokens", "[", "0", "]", "+", "\".\"", "+", "part", ";", "}", "}", "</s>" ]
12,868
[ "<s>", "package", "cz", ".", "festomat", ".", "server", ".", "servlets", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "InputStream", ";", "import", "java", ".", "net", ".", "URL", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Collection", ";", "import", "javax", ".", "jdo", ".", "PersistenceManager", ";", "import", "javax", ".", "servlet", ".", "ServletException", ";", "import", "javax", ".", "servlet", ".", "http", ".", "HttpServlet", ";", "import", "javax", ".", "servlet", ".", "http", ".", "HttpServletRequest", ";", "import", "javax", ".", "servlet", ".", "http", ".", "HttpServletResponse", ";", "import", "javax", ".", "xml", ".", "stream", ".", "XMLInputFactory", ";", "import", "javax", ".", "xml", ".", "stream", ".", "XMLStreamConstants", ";", "import", "javax", ".", "xml", ".", "stream", ".", "XMLStreamException", ";", "import", "javax", ".", "xml", ".", "stream", ".", "XMLStreamReader", ";", "import", "cz", ".", "festomat", ".", "server", ".", "model", ".", "Festival", ";", "public", "class", "ImportServlet", "extends", "HttpServlet", "{", "private", "static", "final", "long", "serialVersionUID", "=", "-", "114121341295497171L", ";", "private", "final", "String", "urlFeedu", "=", "\"\"", ";", "@", "Override", "protected", "void", "doGet", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "resp", ")", "throws", "ServletException", ",", "IOException", "{", "URL", "url", "=", "new", "URL", "(", "urlFeedu", ")", ";", "InputStream", "is", "=", "url", ".", "openStream", "(", ")", ";", "XMLInputFactory", "f", "=", "XMLInputFactory", ".", "newInstance", "(", ")", ";", "XMLStreamReader", "r", ";", "String", "text", "=", "null", ";", "Collection", "<", "Festival", ">", "festivaly", "=", "new", "ArrayList", "<", "Festival", ">", "(", ")", ";", "try", "{", "r", "=", "f", ".", "createXMLStreamReader", "(", "is", ")", ";", "while", "(", "r", ".", "hasNext", "(", ")", ")", "{", "r", ".", "next", "(", ")", ";", "if", "(", "r", ".", "getEventType", "(", ")", "==", "XMLStreamConstants", ".", "END_DOCUMENT", ")", "{", "r", ".", "close", "(", ")", ";", "break", ";", "}", "if", "(", "r", ".", "getEventType", "(", ")", "==", "XMLStreamConstants", ".", "START_ELEMENT", ")", "{", "if", "(", "r", ".", "getLocalName", "(", ")", ".", "equals", "(", "\"marker\"", ")", ")", "{", "Festival", "fest", "=", "new", "Festival", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "r", ".", "getAttributeCount", "(", ")", ";", "i", "++", ")", "{", "if", "(", "r", ".", "getAttributeName", "(", "i", ")", ".", "getLocalPart", "(", ")", ".", "equals", "(", "\"name\"", ")", ")", "{", "fest", ".", "setJmeno", "(", "r", ".", "getAttributeValue", "(", "i", ")", ")", ";", "}", "else", "if", "(", "r", ".", "getAttributeName", "(", "i", ")", ".", "getLocalPart", "(", ")", ".", "equals", "(", "\"description\"", ")", ")", "{", "fest", ".", "setPopis", "(", "r", ".", "getAttributeValue", "(", "i", ")", ")", ";", "}", "else", "if", "(", "r", ".", "getAttributeName", "(", "i", ")", ".", "getLocalPart", "(", ")", ".", "equals", "(", "\"lng\"", ")", ")", "{", "fest", ".", "setLng", "(", "r", ".", "getAttributeValue", "(", "i", ")", ")", ";", "}", "else", "if", "(", "r", ".", "getAttributeName", "(", "i", ")", ".", "getLocalPart", "(", ")", ".", "equals", "(", "\"lat\"", ")", ")", "{", "fest", ".", "setLat", "(", "r", ".", "getAttributeValue", "(", "i", ")", ")", ";", "}", "else", "if", "(", "r", ".", "getAttributeName", "(", "i", ")", ".", "getLocalPart", "(", ")", ".", "equals", "(", "\"city\"", ")", ")", "{", "fest", ".", "setAdresa", "(", "r", ".", "getAttributeValue", "(", "i", ")", ")", ";", "}", "else", "if", "(", "r", ".", "getAttributeName", "(", "i", ")", ".", "getLocalPart", "(", ")", ".", "equals", "(", "\"date\"", ")", ")", "{", "}", "}", "festivaly", ".", "add", "(", "fest", ")", ";", "}", "}", "}", "}", "catch", "(", "XMLStreamException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "PersistenceManager", "pm", "=", "PMF", ".", "getManager", "(", ")", ";", "try", "{", "for", "(", "Festival", "fest", ":", "festivaly", ")", "{", "pm", ".", "makePersistent", "(", "fest", ")", ";", "}", "}", "finally", "{", "pm", ".", "close", "(", ")", ";", "}", "}", "}", "</s>" ]
12,869
[ "<s>", "package", "cz", ".", "festomat", ".", "server", ";", "import", "com", ".", "google", ".", "appengine", ".", "api", ".", "datastore", ".", "Query", ".", "FilterOperator", ";", "import", "com", ".", "vaadin", ".", "Application", ";", "import", "com", ".", "vaadin", ".", "data", ".", "Property", ";", "import", "com", ".", "vaadin", ".", "ui", ".", "Button", ";", "import", "com", ".", "vaadin", ".", "ui", ".", "Button", ".", "ClickEvent", ";", "import", "com", ".", "vaadin", ".", "ui", ".", "Form", ";", "import", "com", ".", "vaadin", ".", "ui", ".", "HorizontalLayout", ";", "import", "com", ".", "vaadin", ".", "ui", ".", "SplitPanel", ";", "import", "com", ".", "vaadin", ".", "ui", ".", "Table", ";", "import", "com", ".", "vaadin", ".", "ui", ".", "TextField", ";", "import", "com", ".", "vaadin", ".", "ui", ".", "VerticalLayout", ";", "import", "com", ".", "vaadin", ".", "ui", ".", "Window", ";", "import", "fi", ".", "abo", ".", "GAEContainer", ".", "impl", ".", "Cache", ".", "Factory", ".", "LocalMemoryCacheConfig", ";", "import", "fi", ".", "abo", ".", "GAEContainer", ".", "impl", ".", "Cache", ".", "Factory", ".", "LocalMemoryCacheConfig", ".", "RemoveStrategy", ";", "import", "fi", ".", "abo", ".", "GAEContainer", ".", "impl", ".", "Cache", ".", "Factory", ".", "MemCacheConfig", ";", "public", "class", "Admin", "extends", "Application", "{", "private", "static", "String", "[", "]", "fields", "=", "{", "\"jmeno\"", ",", "\"adresa\"", ",", "\"lng\"", ",", "\"lat\"", ",", "\"zacatek\"", ",", "\"konec\"", ",", "\"popis\"", "}", ";", "private", "static", "String", "[", "]", "visibleCols", "=", "new", "String", "[", "]", "{", "\"jmeno\"", ",", "\"adresa\"", ",", "\"lng\"", ",", "\"lat\"", "}", ";", "private", "final", "Table", "contactList", "=", "new", "Table", "(", ")", ";", "private", "final", "Form", "contactEditor", "=", "new", "Form", "(", ")", ";", "private", "final", "HorizontalLayout", "bottomLeftCorner", "=", "new", "HorizontalLayout", "(", ")", ";", "private", "Button", "contactRemovalButton", ";", "static", "final", "LocalMemoryCacheConfig", "localMemoryCacheConfig", "=", "new", "LocalMemoryCacheConfig", ".", "Builder", "(", ")", ".", "withCacheFilteredIndexes", "(", "true", ")", ".", "withCacheFilteredSizes", "(", "true", ")", ".", "withIndexCapacity", "(", "50", ")", ".", "withIndexLifeTime", "(", "60", ")", ".", "withItemCapacity", "(", "500", ")", ".", "withItemLifeTime", "(", "60", ")", ".", "withLineSize", "(", "25", ")", ".", "withRemoveStrategy", "(", "RemoveStrategy", ".", "LRU", ")", ".", "withSizeCapacity", "(", "10", ")", ".", "withSizeLifeTime", "(", "60", ")", ".", "Build", "(", ")", ";", "static", "final", "MemCacheConfig", "memCacheConfig", "=", "new", "MemCacheConfig", ".", "Builder", "(", ")", ".", "withCacheFilteredIndexes", "(", "true", ")", ".", "withIndexLifeTime", "(", "500", ")", ".", "withItemLifeTime", "(", "500", ")", ".", "withLineSize", "(", "50", ")", ".", "Build", "(", ")", ";", "private", "final", "fi", ".", "abo", ".", "GAEContainer", ".", "impl", ".", "GAEContainer", "addressBookData", "=", "new", "fi", ".", "abo", ".", "GAEContainer", ".", "impl", ".", "GAEContainer", "(", "\"Festival\"", ",", "true", ",", "false", ")", ";", "@", "Override", "public", "void", "init", "(", ")", "{", "for", "(", "String", "p", ":", "fields", ")", "{", "addressBookData", ".", "addContainerProperty", "(", "p", ",", "String", ".", "class", ",", "\"", "\"", ")", ";", "}", "initLayout", "(", ")", ";", "initContactAddRemoveButtons", "(", ")", ";", "initAddressList", "(", ")", ";", "initFilteringControls", "(", ")", ";", "}", "private", "void", "initLayout", "(", ")", "{", "SplitPanel", "splitPanel", "=", "new", "SplitPanel", "(", "SplitPanel", ".", "ORIENTATION_HORIZONTAL", ")", ";", "setMainWindow", "(", "new", "Window", "(", "\"Festivaly\"", ",", "splitPanel", ")", ")", ";", "VerticalLayout", "left", "=", "new", "VerticalLayout", "(", ")", ";", "left", ".", "setSizeFull", "(", ")", ";", "left", ".", "addComponent", "(", "contactList", ")", ";", "contactList", ".", "setSizeFull", "(", ")", ";", "left", ".", "setExpandRatio", "(", "contactList", ",", "1", ")", ";", "splitPanel", ".", "addComponent", "(", "left", ")", ";", "VerticalLayout", "p", "=", "new", "VerticalLayout", "(", ")", ";", "p", ".", "addComponent", "(", "contactEditor", ")", ";", "splitPanel", ".", "addComponent", "(", "p", ")", ";", "contactEditor", ".", "setSizeFull", "(", ")", ";", "contactEditor", ".", "getLayout", "(", ")", ".", "setMargin", "(", "true", ")", ";", "contactEditor", ".", "setImmediate", "(", "true", ")", ";", "bottomLeftCorner", ".", "setWidth", "(", "\"100%\"", ")", ";", "left", ".", "addComponent", "(", "bottomLeftCorner", ")", ";", "}", "private", "void", "initContactAddRemoveButtons", "(", ")", "{", "bottomLeftCorner", ".", "addComponent", "(", "new", "Button", "(", "\"+\"", ",", "new", "Button", ".", "ClickListener", "(", ")", "{", "@", "Override", "public", "void", "buttonClick", "(", "ClickEvent", "event", ")", "{", "Object", "id", "=", "contactList", ".", "addItem", "(", ")", ";", "contactList", ".", "setValue", "(", "id", ")", ";", "}", "}", ")", ")", ";", "contactRemovalButton", "=", "new", "Button", "(", "\"-\"", ",", "new", "Button", ".", "ClickListener", "(", ")", "{", "@", "Override", "public", "void", "buttonClick", "(", "ClickEvent", "event", ")", "{", "contactList", ".", "removeItem", "(", "contactList", ".", "getValue", "(", ")", ")", ";", "contactList", ".", "select", "(", "null", ")", ";", "}", "}", ")", ";", "contactRemovalButton", ".", "setVisible", "(", "false", ")", ";", "bottomLeftCorner", ".", "addComponent", "(", "contactRemovalButton", ")", ";", "}", "private", "String", "[", "]", "initAddressList", "(", ")", "{", "contactList", ".", "setContainerDataSource", "(", "addressBookData", ")", ";", "contactList", ".", "setVisibleColumns", "(", "visibleCols", ")", ";", "contactList", ".", "setSelectable", "(", "true", ")", ";", "contactList", ".", "setImmediate", "(", "true", ")", ";", "contactList", ".", "addListener", "(", "new", "Property", ".", "ValueChangeListener", "(", ")", "{", "@", "Override", "public", "void", "valueChange", "(", "com", ".", "vaadin", ".", "data", ".", "Property", ".", "ValueChangeEvent", "event", ")", "{", "Object", "id", "=", "contactList", ".", "getValue", "(", ")", ";", "contactEditor", ".", "setItemDataSource", "(", "id", "==", "null", "?", "null", ":", "contactList", ".", "getItem", "(", "id", ")", ")", ";", "contactRemovalButton", ".", "setVisible", "(", "id", "!=", "null", ")", ";", "}", "}", ")", ";", "return", "visibleCols", ";", "}", "private", "void", "initFilteringControls", "(", ")", "{", "for", "(", "final", "String", "pn", ":", "visibleCols", ")", "{", "final", "TextField", "sf", "=", "new", "TextField", "(", ")", ";", "bottomLeftCorner", ".", "addComponent", "(", "sf", ")", ";", "sf", ".", "setWidth", "(", "\"100%\"", ")", ";", "sf", ".", "setInputPrompt", "(", "pn", ")", ";", "sf", ".", "setImmediate", "(", "true", ")", ";", "bottomLeftCorner", ".", "setExpandRatio", "(", "sf", ",", "1", ")", ";", "sf", ".", "addListener", "(", "new", "Property", ".", "ValueChangeListener", "(", ")", "{", "@", "Override", "public", "void", "valueChange", "(", "com", ".", "vaadin", ".", "data", ".", "Property", ".", "ValueChangeEvent", "event", ")", "{", "addressBookData", ".", "removeFilters", "(", "pn", ")", ";", "if", "(", "sf", ".", "toString", "(", ")", ".", "length", "(", ")", ">", "0", "&&", "!", "pn", ".", "equals", "(", "sf", ".", "toString", "(", ")", ")", ")", "{", "addressBookData", ".", "addFilter", "(", "pn", ",", "FilterOperator", ".", "EQUAL", ",", "sf", ".", "toString", "(", ")", ")", ";", "}", "getMainWindow", "(", ")", ".", "showNotification", "(", "\"\"", "+", "addressBookData", ".", "size", "(", ")", "+", "\"\"", ")", ";", "}", "}", ")", ";", "}", "}", "}", "</s>" ]
12,870
[ "<s>", "package", "cz", ".", "festomat", ".", "server", ".", "model", ";", "import", "java", ".", "util", ".", "Date", ";", "import", "javax", ".", "jdo", ".", "annotations", ".", "IdGeneratorStrategy", ";", "import", "javax", ".", "jdo", ".", "annotations", ".", "IdentityType", ";", "import", "javax", ".", "jdo", ".", "annotations", ".", "NullValue", ";", "import", "javax", ".", "jdo", ".", "annotations", ".", "PersistenceCapable", ";", "import", "javax", ".", "jdo", ".", "annotations", ".", "Persistent", ";", "import", "javax", ".", "jdo", ".", "annotations", ".", "PrimaryKey", ";", "import", "javax", ".", "jdo", ".", "annotations", ".", "Version", ";", "import", "javax", ".", "jdo", ".", "annotations", ".", "VersionStrategy", ";", "import", "com", ".", "google", ".", "appengine", ".", "api", ".", "datastore", ".", "Key", ";", "@", "PersistenceCapable", "(", "identityType", "=", "IdentityType", ".", "APPLICATION", ",", "detachable", "=", "\"true\"", ")", "@", "Version", "(", "strategy", "=", "VersionStrategy", ".", "VERSION_NUMBER", ")", "public", "class", "Comment", "{", "@", "PrimaryKey", "@", "Persistent", "(", "valueStrategy", "=", "IdGeneratorStrategy", ".", "IDENTITY", ")", "private", "Key", "key", ";", "@", "Persistent", "(", "nullValue", "=", "NullValue", ".", "EXCEPTION", ")", "private", "String", "autor", ";", "@", "Persistent", "(", "nullValue", "=", "NullValue", ".", "EXCEPTION", ")", "private", "Date", "time", ";", "@", "Persistent", "(", "nullValue", "=", "NullValue", ".", "EXCEPTION", ")", "private", "String", "text", ";", "@", "Persistent", "(", "nullValue", "=", "NullValue", ".", "EXCEPTION", ")", "private", "Festival", "festival", ";", "public", "Key", "getKey", "(", ")", "{", "return", "key", ";", "}", "public", "void", "setKey", "(", "Key", "key", ")", "{", "this", ".", "key", "=", "key", ";", "}", "public", "String", "getAutor", "(", ")", "{", "return", "autor", ";", "}", "public", "void", "setAutor", "(", "String", "autor", ")", "{", "this", ".", "autor", "=", "autor", ";", "}", "public", "Date", "getTime", "(", ")", "{", "return", "time", ";", "}", "public", "void", "setTime", "(", "Date", "time", ")", "{", "this", ".", "time", "=", "time", ";", "}", "public", "String", "getText", "(", ")", "{", "return", "text", ";", "}", "public", "void", "setText", "(", "String", "text", ")", "{", "this", ".", "text", "=", "text", ";", "}", "public", "Festival", "getFestival", "(", ")", "{", "return", "festival", ";", "}", "public", "void", "setFestival", "(", "Festival", "festival", ")", "{", "this", ".", "festival", "=", "festival", ";", "}", "}", "</s>" ]
12,871
[ "<s>", "package", "cz", ".", "festomat", ".", "server", ".", "model", ";", "import", "java", ".", "util", ".", "Collection", ";", "import", "java", ".", "util", ".", "Date", ";", "import", "javax", ".", "jdo", ".", "annotations", ".", "Element", ";", "import", "javax", ".", "jdo", ".", "annotations", ".", "Extension", ";", "import", "javax", ".", "jdo", ".", "annotations", ".", "IdGeneratorStrategy", ";", "import", "javax", ".", "jdo", ".", "annotations", ".", "IdentityType", ";", "import", "javax", ".", "jdo", ".", "annotations", ".", "NullValue", ";", "import", "javax", ".", "jdo", ".", "annotations", ".", "Order", ";", "import", "javax", ".", "jdo", ".", "annotations", ".", "PersistenceCapable", ";", "import", "javax", ".", "jdo", ".", "annotations", ".", "Persistent", ";", "import", "javax", ".", "jdo", ".", "annotations", ".", "PrimaryKey", ";", "import", "javax", ".", "jdo", ".", "annotations", ".", "Version", ";", "import", "javax", ".", "jdo", ".", "annotations", ".", "VersionStrategy", ";", "import", "com", ".", "google", ".", "appengine", ".", "api", ".", "datastore", ".", "Key", ";", "@", "PersistenceCapable", "(", "identityType", "=", "IdentityType", ".", "APPLICATION", ",", "detachable", "=", "\"true\"", ")", "@", "Version", "(", "strategy", "=", "VersionStrategy", ".", "VERSION_NUMBER", ")", "public", "class", "Festival", "{", "@", "PrimaryKey", "@", "Persistent", "(", "valueStrategy", "=", "IdGeneratorStrategy", ".", "IDENTITY", ")", "private", "Key", "key", ";", "@", "Persistent", "(", "nullValue", "=", "NullValue", ".", "EXCEPTION", ")", "private", "String", "jmeno", ";", "@", "Persistent", "(", "nullValue", "=", "NullValue", ".", "EXCEPTION", ")", "private", "String", "adresa", ";", "@", "Persistent", "(", "nullValue", "=", "NullValue", ".", "EXCEPTION", ")", "private", "String", "lng", ",", "lat", ";", "@", "Persistent", "(", "nullValue", "=", "NullValue", ".", "EXCEPTION", ")", "private", "String", "popis", ";", "@", "Persistent", "(", "nullValue", "=", "NullValue", ".", "EXCEPTION", ")", "private", "Date", "zacaten", ";", "@", "Persistent", "(", "nullValue", "=", "NullValue", ".", "EXCEPTION", ")", "private", "Date", "konec", ";", "@", "Persistent", "(", "mappedBy", "=", "\"festival\"", ")", "@", "Element", "(", "dependent", "=", "\"true\"", ")", "@", "Order", "(", "extensions", "=", "@", "Extension", "(", "vendorName", "=", "\"datanucleus\"", ",", "key", "=", "\"\"", ",", "value", "=", "\"time", "desc\"", ")", ")", "private", "Collection", "<", "Comment", ">", "komentare", ";", "public", "Key", "getKey", "(", ")", "{", "return", "key", ";", "}", "public", "void", "setKey", "(", "Key", "key", ")", "{", "this", ".", "key", "=", "key", ";", "}", "public", "String", "getJmeno", "(", ")", "{", "return", "jmeno", ";", "}", "public", "void", "setJmeno", "(", "String", "jmeno", ")", "{", "this", ".", "jmeno", "=", "jmeno", ";", "}", "public", "String", "getAdresa", "(", ")", "{", "return", "adresa", ";", "}", "public", "void", "setAdresa", "(", "String", "adresa", ")", "{", "this", ".", "adresa", "=", "adresa", ";", "}", "public", "String", "getPopis", "(", ")", "{", "return", "popis", ";", "}", "public", "void", "setPopis", "(", "String", "popis", ")", "{", "this", ".", "popis", "=", "popis", ";", "}", "public", "Date", "getZacaten", "(", ")", "{", "return", "zacaten", ";", "}", "public", "void", "setZacaten", "(", "Date", "zacaten", ")", "{", "this", ".", "zacaten", "=", "zacaten", ";", "}", "public", "Date", "getKonec", "(", ")", "{", "return", "konec", ";", "}", "public", "void", "setKonec", "(", "Date", "konec", ")", "{", "this", ".", "konec", "=", "konec", ";", "}", "public", "String", "getLng", "(", ")", "{", "return", "lng", ";", "}", "public", "void", "setLng", "(", "String", "lng", ")", "{", "this", ".", "lng", "=", "lng", ";", "}", "public", "String", "getLat", "(", ")", "{", "return", "lat", ";", "}", "public", "void", "setLat", "(", "String", "lat", ")", "{", "this", ".", "lat", "=", "lat", ";", "}", "public", "Collection", "<", "Comment", ">", "getKomentare", "(", ")", "{", "return", "komentare", ";", "}", "public", "void", "setKomentare", "(", "Collection", "<", "Comment", ">", "komentare", ")", "{", "this", ".", "komentare", "=", "komentare", ";", "}", "}", "</s>" ]
12,872
[ "<s>", "package", "cz", ".", "festomat", ".", "server", ".", "bean", ";", "import", "java", ".", "util", ".", "Date", ";", "public", "class", "FestivalListBean", "{", "private", "String", "id", ";", "private", "String", "name", ";", "private", "String", "lng", ",", "lat", ";", "private", "Date", "start", ";", "public", "FestivalListBean", "(", "String", "id", ",", "String", "name", ",", "String", "lng", ",", "String", "lat", ",", "Date", "start", ")", "{", "super", "(", ")", ";", "this", ".", "id", "=", "id", ";", "this", ".", "name", "=", "name", ";", "this", ".", "lng", "=", "lng", ";", "this", ".", "lat", "=", "lat", ";", "this", ".", "start", "=", "start", ";", "}", "public", "FestivalListBean", "(", ")", "{", "}", "public", "String", "getId", "(", ")", "{", "return", "id", ";", "}", "public", "void", "setId", "(", "String", "id", ")", "{", "this", ".", "id", "=", "id", ";", "}", "public", "String", "getName", "(", ")", "{", "return", "name", ";", "}", "public", "void", "setName", "(", "String", "name", ")", "{", "this", ".", "name", "=", "name", ";", "}", "public", "String", "getLng", "(", ")", "{", "return", "lng", ";", "}", "public", "void", "setLng", "(", "String", "lng", ")", "{", "this", ".", "lng", "=", "lng", ";", "}", "public", "String", "getLat", "(", ")", "{", "return", "lat", ";", "}", "public", "void", "setLat", "(", "String", "lat", ")", "{", "this", ".", "lat", "=", "lat", ";", "}", "public", "Date", "getStart", "(", ")", "{", "return", "start", ";", "}", "public", "void", "setStart", "(", "Date", "start", ")", "{", "this", ".", "start", "=", "start", ";", "}", "}", "</s>" ]
12,873
[ "<s>", "package", "cz", ".", "festomat", ".", "server", ".", "bean", ";", "import", "java", ".", "util", ".", "Date", ";", "public", "class", "FestivalBean", "{", "public", "FestivalBean", "(", "String", "id", ",", "String", "address", ",", "String", "name", ",", "String", "lng", ",", "String", "lat", ",", "Date", "start", ",", "Date", "end", ",", "String", "description", ")", "{", "super", "(", ")", ";", "this", ".", "id", "=", "id", ";", "this", ".", "address", "=", "address", ";", "this", ".", "name", "=", "name", ";", "this", ".", "lng", "=", "lng", ";", "this", ".", "lat", "=", "lat", ";", "this", ".", "start", "=", "start", ";", "this", ".", "end", "=", "end", ";", "this", ".", "description", "=", "description", ";", "}", "private", "String", "id", ";", "private", "String", "address", ";", "private", "String", "name", ";", "private", "String", "lng", ";", "private", "String", "lat", ";", "private", "Date", "start", ";", "private", "Date", "end", ";", "private", "String", "description", ";", "public", "String", "getId", "(", ")", "{", "return", "id", ";", "}", "public", "void", "setId", "(", "String", "id", ")", "{", "this", ".", "id", "=", "id", ";", "}", "public", "String", "getAddress", "(", ")", "{", "return", "address", ";", "}", "public", "void", "setAddress", "(", "String", "address", ")", "{", "this", ".", "address", "=", "address", ";", "}", "public", "String", "getName", "(", ")", "{", "return", "name", ";", "}", "public", "void", "setName", "(", "String", "name", ")", "{", "this", ".", "name", "=", "name", ";", "}", "public", "String", "getLng", "(", ")", "{", "return", "lng", ";", "}", "public", "void", "setLng", "(", "String", "lng", ")", "{", "this", ".", "lng", "=", "lng", ";", "}", "public", "String", "getLat", "(", ")", "{", "return", "lat", ";", "}", "public", "void", "setLat", "(", "String", "lat", ")", "{", "this", ".", "lat", "=", "lat", ";", "}", "public", "Date", "getStart", "(", ")", "{", "return", "start", ";", "}", "public", "void", "setStart", "(", "Date", "start", ")", "{", "this", ".", "start", "=", "start", ";", "}", "public", "Date", "getEnd", "(", ")", "{", "return", "end", ";", "}", "public", "void", "setEnd", "(", "Date", "end", ")", "{", "this", ".", "end", "=", "end", ";", "}", "public", "String", "getDescription", "(", ")", "{", "return", "description", ";", "}", "public", "void", "setDescription", "(", "String", "description", ")", "{", "this", ".", "description", "=", "description", ";", "}", "}", "</s>" ]
12,874
[ "<s>", "package", "cz", ".", "festomat", ".", "server", ".", "bean", ";", "import", "java", ".", "util", ".", "Date", ";", "public", "class", "CommentBean", "{", "private", "String", "author", ";", "private", "Date", "time", ";", "private", "String", "text", ";", "public", "CommentBean", "(", "String", "author", ",", "Date", "time", ",", "String", "text", ")", "{", "super", "(", ")", ";", "this", ".", "author", "=", "author", ";", "this", ".", "time", "=", "time", ";", "this", ".", "text", "=", "text", ";", "}", "public", "CommentBean", "(", ")", "{", "super", "(", ")", ";", "}", "public", "String", "getAuthor", "(", ")", "{", "return", "author", ";", "}", "public", "void", "setAuthor", "(", "String", "author", ")", "{", "this", ".", "author", "=", "author", ";", "}", "public", "Date", "getTime", "(", ")", "{", "return", "time", ";", "}", "public", "void", "setTime", "(", "Date", "time", ")", "{", "this", ".", "time", "=", "time", ";", "}", "public", "String", "getText", "(", ")", "{", "return", "text", ";", "}", "public", "void", "setText", "(", "String", "text", ")", "{", "this", ".", "text", "=", "text", ";", "}", "}", "</s>" ]
12,875
[ "<s>", "package", "cz", ".", "festomat", ".", "client", ".", "tabs", ";", "import", "java", ".", "io", ".", "Serializable", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "import", "android", ".", "app", ".", "ListActivity", ";", "import", "android", ".", "app", ".", "ProgressDialog", ";", "import", "android", ".", "content", ".", "Context", ";", "import", "android", ".", "content", ".", "Intent", ";", "import", "android", ".", "os", ".", "AsyncTask", ";", "import", "android", ".", "os", ".", "Bundle", ";", "import", "android", ".", "text", ".", "Editable", ";", "import", "android", ".", "text", ".", "TextWatcher", ";", "import", "android", ".", "util", ".", "Log", ";", "import", "android", ".", "view", ".", "LayoutInflater", ";", "import", "android", ".", "view", ".", "View", ";", "import", "android", ".", "view", ".", "ViewGroup", ";", "import", "android", ".", "view", ".", "inputmethod", ".", "InputMethodManager", ";", "import", "android", ".", "widget", ".", "ArrayAdapter", ";", "import", "android", ".", "widget", ".", "EditText", ";", "import", "android", ".", "widget", ".", "ListView", ";", "import", "android", ".", "widget", ".", "TextView", ";", "import", "cz", ".", "festomat", ".", "client", ".", "Festival", ";", "import", "cz", ".", "festomat", ".", "client", ".", "R", ";", "import", "cz", ".", "festomat", ".", "client", ".", "data", ".", "DataSource", ";", "import", "cz", ".", "festomat", ".", "client", ".", "data", ".", "IDataSource", ";", "import", "cz", ".", "festomat", ".", "client", ".", "data", ".", "beans", ".", "FestivalListBean", ";", "public", "class", "FestivalList", "extends", "ListActivity", "{", "public", "static", "final", "String", "TAG", "=", "\"Festomat\"", ";", "private", "List", "<", "FestivalListBean", ">", "festivals", "=", "null", ";", "private", "List", "<", "FestivalListBean", ">", "filtered", "=", "null", ";", "private", "IDataSource", "source", ";", "private", "FestAdapter", "f_adapter", ";", "private", "EditText", "search", ";", "@", "Override", "public", "void", "onCreate", "(", "Bundle", "savedInstanceState", ")", "{", "super", ".", "onCreate", "(", "savedInstanceState", ")", ";", "setContentView", "(", "R", ".", "layout", ".", "main", ")", ";", "festivals", "=", "new", "ArrayList", "<", "FestivalListBean", ">", "(", ")", ";", "filtered", "=", "new", "ArrayList", "<", "FestivalListBean", ">", "(", ")", ";", "f_adapter", "=", "new", "FestAdapter", "(", "this", ",", "android", ".", "R", ".", "layout", ".", "simple_list_item_1", ",", "filtered", ")", ";", "setListAdapter", "(", "f_adapter", ")", ";", "search", "=", "(", "(", "EditText", ")", "findViewById", "(", "R", ".", "id", ".", "search", ")", ")", ";", "search", ".", "addTextChangedListener", "(", "new", "TextWatcher", "(", ")", "{", "@", "Override", "public", "void", "afterTextChanged", "(", "Editable", "s", ")", "{", "Log", ".", "d", "(", "TAG", ",", "\"\"", ")", ";", "}", "@", "Override", "public", "void", "beforeTextChanged", "(", "CharSequence", "s", ",", "int", "start", ",", "int", "count", ",", "int", "after", ")", "{", "Log", ".", "d", "(", "TAG", ",", "\"\"", ")", ";", "}", "@", "Override", "public", "void", "onTextChanged", "(", "CharSequence", "s", ",", "int", "start", ",", "int", "before", ",", "int", "count", ")", "{", "Log", ".", "d", "(", "TAG", ",", "\"\"", ")", ";", "filterList", "(", "s", ".", "toString", "(", ")", ")", ";", "}", "}", ")", ";", "new", "LoaderTask", "(", ")", ".", "execute", "(", ")", ";", "}", "private", "void", "filterList", "(", "String", "text", ")", "{", "if", "(", "!", "text", ".", "equals", "(", "\"\"", ")", ")", "{", "filtered", ".", "clear", "(", ")", ";", "int", "i", "=", "0", ";", "for", "(", "FestivalListBean", "fb", ":", "festivals", ")", "{", "if", "(", "fb", ".", "getName", "(", ")", ".", "toLowerCase", "(", ")", ".", "contains", "(", "text", ".", "toLowerCase", "(", ")", ")", ")", "{", "filtered", ".", "add", "(", "fb", ")", ";", "}", "}", "}", "else", "{", "filtered", ".", "clear", "(", ")", ";", "filtered", ".", "addAll", "(", "festivals", ")", ";", "}", "f_adapter", "=", "new", "FestAdapter", "(", "FestivalList", ".", "this", ",", "android", ".", "R", ".", "layout", ".", "simple_list_item_1", ",", "filtered", ")", ";", "setListAdapter", "(", "f_adapter", ")", ";", "}", "public", "void", "loadFests", "(", ")", "{", "Log", ".", "i", "(", "TAG", ",", "\"loadFests\"", ")", ";", "source", "=", "DataSource", ".", "getInstance", "(", ")", ";", "filtered", "=", "new", "ArrayList", "<", "FestivalListBean", ">", "(", "festivals", "=", "source", ".", "getAllFestivalls", "(", ")", ")", ";", "}", "@", "Override", "protected", "void", "onListItemClick", "(", "ListView", "l", ",", "View", "v", ",", "int", "position", ",", "long", "id", ")", "{", "InputMethodManager", "imm", "=", "(", "InputMethodManager", ")", "getSystemService", "(", "Context", ".", "INPUT_METHOD_SERVICE", ")", ";", "imm", ".", "hideSoftInputFromWindow", "(", "search", ".", "getWindowToken", "(", ")", ",", "0", ")", ";", "Bundle", "bundle", "=", "new", "Bundle", "(", ")", ";", "bundle", ".", "putString", "(", "\"festivalId\"", ",", "(", "(", "FestivalListBean", ")", "getListAdapter", "(", ")", ".", "getItem", "(", "position", ")", ")", ".", "getId", "(", ")", ")", ";", "Intent", "i", "=", "new", "Intent", "(", "this", ",", "Festival", ".", "class", ")", ";", "i", ".", "putExtras", "(", "bundle", ")", ";", "startActivity", "(", "i", ")", ";", "super", ".", "onListItemClick", "(", "l", ",", "v", ",", "position", ",", "id", ")", ";", "}", "private", "ProgressDialog", "progressDialog", ";", "private", "class", "LoaderTask", "extends", "AsyncTask", "<", "Void", ",", "Void", ",", "Void", ">", "{", "@", "Override", "protected", "void", "onPreExecute", "(", ")", "{", "progressDialog", "=", "ProgressDialog", ".", "show", "(", "FestivalList", ".", "this", ",", "\"\"", ",", "\"Na-UNK-t-UNK-m...\"", ",", "true", ")", ";", "}", "@", "Override", "protected", "Void", "doInBackground", "(", "Void", "...", "arg0", ")", "{", "try", "{", "loadFests", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "}", "return", "null", ";", "}", "@", "Override", "protected", "void", "onPostExecute", "(", "Void", "result", ")", "{", "progressDialog", ".", "dismiss", "(", ")", ";", "f_adapter", "=", "new", "FestAdapter", "(", "FestivalList", ".", "this", ",", "android", ".", "R", ".", "layout", ".", "simple_list_item_1", ",", "filtered", ")", ";", "setListAdapter", "(", "f_adapter", ")", ";", "}", "}", "private", "class", "FestAdapter", "extends", "ArrayAdapter", "<", "FestivalListBean", ">", "{", "private", "final", "List", "<", "FestivalListBean", ">", "items", ";", "public", "FestAdapter", "(", "Context", "context", ",", "int", "textViewResourceId", ",", "List", "<", "FestivalListBean", ">", "items", ")", "{", "super", "(", "context", ",", "textViewResourceId", ",", "items", ")", ";", "this", ".", "items", "=", "items", ";", "}", "@", "Override", "public", "View", "getView", "(", "int", "position", ",", "View", "convertView", ",", "ViewGroup", "parent", ")", "{", "View", "v", "=", "convertView", ";", "if", "(", "v", "==", "null", ")", "{", "LayoutInflater", "vi", "=", "(", "LayoutInflater", ")", "getSystemService", "(", "Context", ".", "LAYOUT_INFLATER_SERVICE", ")", ";", "v", "=", "vi", ".", "inflate", "(", "android", ".", "R", ".", "layout", ".", "simple_list_item_1", ",", "null", ")", ";", "}", "FestivalListBean", "o", "=", "items", ".", "get", "(", "position", ")", ";", "if", "(", "o", "!=", "null", ")", "{", "TextView", "tt", "=", "(", "TextView", ")", "v", ".", "findViewById", "(", "android", ".", "R", ".", "id", ".", "text1", ")", ";", "if", "(", "tt", "!=", "null", ")", "{", "tt", ".", "setText", "(", "o", ".", "getName", "(", ")", ")", ";", "}", "}", "return", "v", ";", "}", "}", "@", "Override", "public", "void", "onPause", "(", ")", "{", "progressDialog", ".", "dismiss", "(", ")", ";", "Intent", "myIntent", "=", "getParent", "(", ")", ".", "getIntent", "(", ")", ";", "myIntent", ".", "putExtra", "(", "\"\"", ",", "(", "Serializable", ")", "filtered", ")", ";", "this", ".", "setIntent", "(", "myIntent", ")", ";", "super", ".", "onPause", "(", ")", ";", "}", "}", "</s>" ]
12,876
[ "<s>", "package", "cz", ".", "festomat", ".", "client", ".", "tabs", ";", "import", "java", ".", "util", ".", "List", ";", "import", "android", ".", "content", ".", "Intent", ";", "import", "android", ".", "graphics", ".", "drawable", ".", "Drawable", ";", "import", "android", ".", "os", ".", "Bundle", ";", "import", "com", ".", "google", ".", "android", ".", "maps", ".", "GeoPoint", ";", "import", "com", ".", "google", ".", "android", ".", "maps", ".", "MapActivity", ";", "import", "com", ".", "google", ".", "android", ".", "maps", ".", "MapView", ";", "import", "com", ".", "google", ".", "android", ".", "maps", ".", "Overlay", ";", "import", "com", ".", "google", ".", "android", ".", "maps", ".", "OverlayItem", ";", "import", "cz", ".", "festomat", ".", "client", ".", "R", ";", "import", "cz", ".", "festomat", ".", "client", ".", "data", ".", "beans", ".", "FestivalListBean", ";", "public", "class", "FestivalMap", "extends", "MapActivity", "{", "private", "List", "<", "FestivalListBean", ">", "festivals", ";", "private", "MapView", "mapView", ";", "@", "Override", "public", "void", "onCreate", "(", "Bundle", "savedInstanceState", ")", "{", "super", ".", "onCreate", "(", "savedInstanceState", ")", ";", "setContentView", "(", "R", ".", "layout", ".", "map", ")", ";", "mapView", "=", "(", "MapView", ")", "findViewById", "(", "R", ".", "id", ".", "mapview", ")", ";", "mapView", ".", "setBuiltInZoomControls", "(", "true", ")", ";", "}", "@", "Override", "protected", "boolean", "isRouteDisplayed", "(", ")", "{", "return", "false", ";", "}", "@", "Override", "protected", "void", "onResume", "(", ")", "{", "Intent", "myIntent", "=", "getParent", "(", ")", ".", "getIntent", "(", ")", ";", "festivals", "=", "(", "List", "<", "FestivalListBean", ">", ")", "myIntent", ".", "getSerializableExtra", "(", "\"\"", ")", ";", "if", "(", "festivals", "!=", "null", ")", "{", "List", "<", "Overlay", ">", "mapOverlays", ";", "Drawable", "drawable", ";", "FestivalItemizedOverlay", "itemizedOverlay", ";", "mapOverlays", "=", "mapView", ".", "getOverlays", "(", ")", ";", "drawable", "=", "this", ".", "getResources", "(", ")", ".", "getDrawable", "(", "R", ".", "drawable", ".", "mapmarker", ")", ";", "itemizedOverlay", "=", "new", "FestivalItemizedOverlay", "(", "drawable", ")", ";", "for", "(", "FestivalListBean", "fest", ":", "festivals", ")", "{", "int", "lat", "=", "convertToMicrodegrees", "(", "fest", ".", "getLat", "(", ")", ")", ";", "int", "lng", "=", "convertToMicrodegrees", "(", "fest", ".", "getLng", "(", ")", ")", ";", "GeoPoint", "point", "=", "new", "GeoPoint", "(", "lat", ",", "lng", ")", ";", "OverlayItem", "overlayitem", "=", "new", "OverlayItem", "(", "point", ",", "fest", ".", "getName", "(", ")", ",", "\"\"", "+", "fest", ".", "getStart", "(", ")", ")", ";", "itemizedOverlay", ".", "addOverlay", "(", "overlayitem", ")", ";", "}", "mapOverlays", ".", "clear", "(", ")", ";", "mapOverlays", ".", "add", "(", "itemizedOverlay", ")", ";", "}", "super", ".", "onResume", "(", ")", ";", "}", "protected", "int", "convertToMicrodegrees", "(", "String", "degree", ")", "{", "return", "Integer", ".", "parseInt", "(", "degree", ".", "replace", "(", "\".\"", ",", "\"\"", ")", ")", ";", "}", "}", "</s>" ]
12,877
[ "<s>", "package", "cz", ".", "festomat", ".", "client", ".", "tabs", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "android", ".", "graphics", ".", "drawable", ".", "Drawable", ";", "import", "com", ".", "google", ".", "android", ".", "maps", ".", "ItemizedOverlay", ";", "import", "com", ".", "google", ".", "android", ".", "maps", ".", "OverlayItem", ";", "public", "class", "FestivalItemizedOverlay", "extends", "ItemizedOverlay", "{", "private", "ArrayList", "<", "OverlayItem", ">", "mOverlays", "=", "new", "ArrayList", "<", "OverlayItem", ">", "(", ")", ";", "public", "FestivalItemizedOverlay", "(", "Drawable", "defaultMarker", ")", "{", "super", "(", "boundCenterBottom", "(", "defaultMarker", ")", ")", ";", "}", "public", "void", "addOverlay", "(", "OverlayItem", "overlay", ")", "{", "mOverlays", ".", "add", "(", "overlay", ")", ";", "populate", "(", ")", ";", "}", "@", "Override", "protected", "OverlayItem", "createItem", "(", "int", "i", ")", "{", "return", "mOverlays", ".", "get", "(", "i", ")", ";", "}", "@", "Override", "public", "int", "size", "(", ")", "{", "return", "mOverlays", ".", "size", "(", ")", ";", "}", "}", "</s>" ]
12,878
[ "<s>", "package", "cz", ".", "festomat", ".", "client", ".", "tabs", ";", "import", "android", ".", "app", ".", "Activity", ";", "import", "android", ".", "os", ".", "Bundle", ";", "import", "android", ".", "webkit", ".", "WebView", ";", "import", "cz", ".", "festomat", ".", "client", ".", "R", ";", "import", "cz", ".", "festomat", ".", "client", ".", "data", ".", "DataSource", ";", "import", "cz", ".", "festomat", ".", "client", ".", "data", ".", "IDataSource", ";", "import", "cz", ".", "festomat", ".", "client", ".", "data", ".", "beans", ".", "FestivalBean", ";", "class", "ProgramFetcher", "{", "private", "String", "festivalId", ";", "private", "final", "String", "descriptionHtml", ";", "private", "final", "String", "title", ";", "private", "final", "String", "programHeader", "=", "\"<html>\"", "+", "\"<body>\"", ";", "private", "final", "String", "programFooter", "=", "\"</body>\"", "+", "\"</html>\"", ";", "public", "ProgramFetcher", "(", "String", "festivalId", ")", "{", "IDataSource", "ds", "=", "DataSource", ".", "getInstance", "(", ")", ";", "FestivalBean", "festivalBean", "=", "ds", ".", "getFestivalById", "(", "festivalId", ")", ";", "festivalBean", ".", "getName", "(", ")", ";", "this", ".", "descriptionHtml", "=", "festivalBean", ".", "getDescription", "(", ")", ";", "this", ".", "title", "=", "festivalBean", ".", "getName", "(", ")", ";", "}", "public", "String", "getDescriptionHtml", "(", ")", "{", "return", "programHeader", "+", "this", ".", "descriptionHtml", "+", "programFooter", ";", "}", "public", "String", "getTitle", "(", ")", "{", "return", "this", ".", "title", ";", "}", "}", "public", "class", "Program", "extends", "Activity", "{", "@", "Override", "public", "void", "onCreate", "(", "Bundle", "savedInstanceState", ")", "{", "super", ".", "onCreate", "(", "savedInstanceState", ")", ";", "setContentView", "(", "R", ".", "layout", ".", "program", ")", ";", "Bundle", "festivalBund", "=", "getIntent", "(", ")", ".", "getExtras", "(", ")", ";", "String", "festivalId", "=", "festivalBund", ".", "getString", "(", "\"festivalId\"", ")", ";", "WebView", "programWebView", "=", "(", "WebView", ")", "findViewById", "(", "R", ".", "id", ".", "program", ")", ";", "programWebView", ".", "getSettings", "(", ")", ".", "setJavaScriptEnabled", "(", "true", ")", ";", "programWebView", ".", "setBackgroundColor", "(", "0", ")", ";", "ProgramFetcher", "pf", "=", "new", "ProgramFetcher", "(", "festivalId", ")", ";", "String", "summary", "=", "pf", ".", "getDescriptionHtml", "(", ")", ";", "String", "title", "=", "pf", ".", "getTitle", "(", ")", ";", "this", ".", "setTitle", "(", "title", ")", ";", "programWebView", ".", "loadData", "(", "summary", ",", "\"text/html\"", ",", "\"utf-8\"", ")", ";", "}", "}", "</s>" ]
12,879
[ "<s>", "package", "cz", ".", "festomat", ".", "client", ".", "tabs", ";", "import", "java", ".", "text", ".", "DateFormat", ";", "import", "java", ".", "text", ".", "SimpleDateFormat", ";", "import", "java", ".", "util", ".", "Date", ";", "import", "java", ".", "util", ".", "List", ";", "import", "android", ".", "app", ".", "ListActivity", ";", "import", "android", ".", "app", ".", "ProgressDialog", ";", "import", "android", ".", "content", ".", "Context", ";", "import", "android", ".", "os", ".", "Bundle", ";", "import", "android", ".", "view", ".", "LayoutInflater", ";", "import", "android", ".", "view", ".", "View", ";", "import", "android", ".", "view", ".", "ViewGroup", ";", "import", "android", ".", "widget", ".", "ArrayAdapter", ";", "import", "android", ".", "widget", ".", "BaseAdapter", ";", "import", "android", ".", "widget", ".", "Button", ";", "import", "android", ".", "widget", ".", "EditText", ";", "import", "android", ".", "widget", ".", "TextView", ";", "import", "cz", ".", "festomat", ".", "client", ".", "R", ";", "import", "cz", ".", "festomat", ".", "client", ".", "data", ".", "DataSource", ";", "import", "cz", ".", "festomat", ".", "client", ".", "data", ".", "IDataSource", ";", "import", "cz", ".", "festomat", ".", "client", ".", "data", ".", "beans", ".", "CommentBean", ";", "public", "class", "Chat", "extends", "ListActivity", "{", "private", "List", "<", "CommentBean", ">", "chat", "=", "null", ";", "private", "BaseAdapter", "c_adapter", ";", "private", "CharSequence", "autor", "=", "\"\"", ";", "private", "CharSequence", "text", "=", "\"\"", ";", "@", "Override", "public", "void", "onCreate", "(", "Bundle", "savedInstanceState", ")", "{", "super", ".", "onCreate", "(", "savedInstanceState", ")", ";", "showWaitDialog", "(", ")", ";", "setContentView", "(", "R", ".", "layout", ".", "chat", ")", ";", "Bundle", "festivalBund", "=", "getIntent", "(", ")", ".", "getExtras", "(", ")", ";", "final", "String", "festivalId", "=", "festivalBund", ".", "getString", "(", "\"festivalId\"", ")", ";", "final", "EditText", "aut", "=", "(", "EditText", ")", "findViewById", "(", "R", ".", "id", ".", "editTextA", ")", ";", "final", "EditText", "msg", "=", "(", "EditText", ")", "findViewById", "(", "R", ".", "id", ".", "editTextM", ")", ";", "Button", "b", "=", "(", "Button", ")", "findViewById", "(", "R", ".", "id", ".", "buttonS", ")", ";", "b", ".", "setOnClickListener", "(", "new", "View", ".", "OnClickListener", "(", ")", "{", "@", "Override", "public", "void", "onClick", "(", "View", "v", ")", "{", "autor", "=", "aut", ".", "getText", "(", ")", ";", "text", "=", "msg", ".", "getText", "(", ")", ";", "CommentBean", "bean", "=", "new", "CommentBean", "(", "autor", ".", "toString", "(", ")", ",", "new", "Date", "(", ")", ",", "text", ".", "toString", "(", ")", ")", ";", "IDataSource", "source", "=", "DataSource", ".", "getInstance", "(", ")", ";", "source", ".", "sendComment", "(", "festivalId", ",", "bean", ")", ";", "}", "}", ")", ";", "Button", "bE", "=", "(", "Button", ")", "findViewById", "(", "R", ".", "id", ".", "buttonR", ")", ";", "bE", ".", "setOnClickListener", "(", "new", "View", ".", "OnClickListener", "(", ")", "{", "@", "Override", "public", "void", "onClick", "(", "View", "v", ")", "{", "showWaitDialog", "(", ")", ";", "chat", "=", "refreshChat", "(", "festivalId", ")", ";", "c_adapter", "=", "new", "CommentAdapter", "(", "Chat", ".", "this", ",", "android", ".", "R", ".", "layout", ".", "simple_list_item_1", ",", "chat", ")", ";", "setListAdapter", "(", "c_adapter", ")", ";", "hideWaitDialog", "(", ")", ";", "}", "}", ")", ";", "chat", "=", "refreshChat", "(", "festivalId", ")", ";", "c_adapter", "=", "new", "CommentAdapter", "(", "this", ",", "android", ".", "R", ".", "layout", ".", "simple_list_item_1", ",", "chat", ")", ";", "setListAdapter", "(", "c_adapter", ")", ";", "hideWaitDialog", "(", ")", ";", "}", "public", "List", "<", "CommentBean", ">", "refreshChat", "(", "String", "idFest", ")", "{", "IDataSource", "source", "=", "DataSource", ".", "getInstance", "(", ")", ";", "return", "source", ".", "getAllComments", "(", "idFest", ")", ";", "}", "private", "class", "CommentAdapter", "extends", "ArrayAdapter", "<", "CommentBean", ">", "{", "private", "final", "List", "<", "CommentBean", ">", "items", ";", "public", "CommentAdapter", "(", "Context", "context", ",", "int", "textViewResourceId", ",", "List", "<", "CommentBean", ">", "items", ")", "{", "super", "(", "context", ",", "textViewResourceId", ",", "items", ")", ";", "this", ".", "items", "=", "items", ";", "}", "@", "Override", "public", "View", "getView", "(", "int", "position", ",", "View", "convertView", ",", "ViewGroup", "parent", ")", "{", "View", "v", "=", "convertView", ";", "if", "(", "v", "==", "null", ")", "{", "LayoutInflater", "vi", "=", "(", "LayoutInflater", ")", "getSystemService", "(", "Context", ".", "LAYOUT_INFLATER_SERVICE", ")", ";", "v", "=", "vi", ".", "inflate", "(", "R", ".", "layout", ".", "c_chat_item_layout", ",", "null", ")", ";", "}", "CommentBean", "o", "=", "items", ".", "get", "(", "position", ")", ";", "if", "(", "o", "!=", "null", ")", "{", "TextView", "tt1", "=", "(", "TextView", ")", "v", ".", "findViewById", "(", "R", ".", "id", ".", "author", ")", ";", "tt1", ".", "setText", "(", "o", ".", "getAuthor", "(", ")", ")", ";", "TextView", "tt2", "=", "(", "TextView", ")", "v", ".", "findViewById", "(", "R", ".", "id", ".", "datum", ")", ";", "tt2", ".", "setText", "(", "DateFormat", ".", "getInstance", "(", ")", ".", "format", "(", "o", ".", "getTime", "(", ")", ")", ")", ";", "TextView", "tt3", "=", "(", "TextView", ")", "v", ".", "findViewById", "(", "R", ".", "id", ".", "text", ")", ";", "tt3", ".", "setText", "(", "o", ".", "getText", "(", ")", ")", ";", "}", "return", "v", ";", "}", "}", "ProgressDialog", "progressDialog", ";", "private", "void", "showWaitDialog", "(", ")", "{", "progressDialog", "=", "ProgressDialog", ".", "show", "(", "this", ",", "\"\"", ",", "\"Na-UNK-t-UNK-m...\"", ",", "true", ")", ";", "}", "private", "void", "hideWaitDialog", "(", ")", "{", "progressDialog", ".", "dismiss", "(", ")", ";", "}", "}", "</s>" ]
12,880
[ "<s>", "package", "cz", ".", "festomat", ".", "client", ";", "import", "android", ".", "app", ".", "ProgressDialog", ";", "import", "android", ".", "app", ".", "TabActivity", ";", "import", "android", ".", "content", ".", "Intent", ";", "import", "android", ".", "content", ".", "res", ".", "Resources", ";", "import", "android", ".", "os", ".", "Bundle", ";", "import", "android", ".", "widget", ".", "TabHost", ";", "import", "cz", ".", "festomat", ".", "client", ".", "data", ".", "DataSource", ";", "import", "cz", ".", "festomat", ".", "client", ".", "tabs", ".", "Chat", ";", "import", "cz", ".", "festomat", ".", "client", ".", "tabs", ".", "Program", ";", "public", "class", "Festival", "extends", "TabActivity", "{", "private", "String", "festivalId", "=", "null", ";", "@", "Override", "public", "void", "onCreate", "(", "Bundle", "savedInstanceState", ")", "{", "super", ".", "onCreate", "(", "savedInstanceState", ")", ";", "setContentView", "(", "R", ".", "layout", ".", "festival", ")", ";", "showWaitDialog", "(", ")", ";", "festivalId", "=", "getIntent", "(", ")", ".", "getExtras", "(", ")", ".", "getString", "(", "\"festivalId\"", ")", ";", "this", ".", "setTitle", "(", "DataSource", ".", "getInstance", "(", ")", ".", "getFestivalById", "(", "festivalId", ")", ".", "getName", "(", ")", ")", ";", "Bundle", "bundle", "=", "new", "Bundle", "(", ")", ";", "bundle", ".", "putString", "(", "\"festivalId\"", ",", "festivalId", ")", ";", "Resources", "res", "=", "getResources", "(", ")", ";", "TabHost", "tabHost", "=", "getTabHost", "(", ")", ";", "TabHost", ".", "TabSpec", "spec", ";", "Intent", "intent", ";", "intent", "=", "new", "Intent", "(", ")", ".", "setClass", "(", "this", ",", "Program", ".", "class", ")", ";", "intent", ".", "putExtras", "(", "bundle", ")", ";", "spec", "=", "tabHost", ".", "newTabSpec", "(", "\"program\"", ")", ".", "setIndicator", "(", "\"Program\"", ",", "null", ")", ".", "setContent", "(", "intent", ")", ";", "tabHost", ".", "addTab", "(", "spec", ")", ";", "intent", "=", "new", "Intent", "(", ")", ".", "setClass", "(", "this", ",", "Chat", ".", "class", ")", ";", "intent", ".", "putExtras", "(", "bundle", ")", ";", "spec", "=", "tabHost", ".", "newTabSpec", "(", "\"chat\"", ")", ".", "setIndicator", "(", "\"Chat\"", ",", "null", ")", ".", "setContent", "(", "intent", ")", ";", "tabHost", ".", "addTab", "(", "spec", ")", ";", "tabHost", ".", "setCurrentTab", "(", "0", ")", ";", "hideWaitDialog", "(", ")", ";", "}", "ProgressDialog", "progressDialog", ";", "private", "void", "showWaitDialog", "(", ")", "{", "progressDialog", "=", "ProgressDialog", ".", "show", "(", "this", ",", "\"\"", ",", "\"Na-UNK-t-UNK-m...\"", ",", "true", ")", ";", "}", "private", "void", "hideWaitDialog", "(", ")", "{", "progressDialog", ".", "dismiss", "(", ")", ";", "}", "}", "</s>" ]
12,881
[ "<s>", "package", "cz", ".", "festomat", ".", "client", ";", "import", "android", ".", "app", ".", "TabActivity", ";", "import", "android", ".", "content", ".", "Intent", ";", "import", "android", ".", "content", ".", "res", ".", "Resources", ";", "import", "android", ".", "os", ".", "Bundle", ";", "import", "android", ".", "widget", ".", "TabHost", ";", "import", "cz", ".", "festomat", ".", "client", ".", "tabs", ".", "FestivalList", ";", "import", "cz", ".", "festomat", ".", "client", ".", "tabs", ".", "FestivalMap", ";", "public", "class", "FestivalSelect", "extends", "TabActivity", "{", "@", "Override", "public", "void", "onCreate", "(", "Bundle", "savedInstanceState", ")", "{", "super", ".", "onCreate", "(", "savedInstanceState", ")", ";", "setContentView", "(", "R", ".", "layout", ".", "festival", ")", ";", "Resources", "res", "=", "getResources", "(", ")", ";", "TabHost", "tabHost", "=", "getTabHost", "(", ")", ";", "TabHost", ".", "TabSpec", "spec", ";", "Intent", "intent", ";", "intent", "=", "new", "Intent", "(", ")", ".", "setClass", "(", "this", ",", "FestivalList", ".", "class", ")", ";", "spec", "=", "tabHost", ".", "newTabSpec", "(", "\"list\"", ")", ".", "setIndicator", "(", "\"Seznam\"", ",", "null", ")", ".", "setContent", "(", "intent", ")", ";", "tabHost", ".", "addTab", "(", "spec", ")", ";", "intent", "=", "new", "Intent", "(", ")", ".", "setClass", "(", "this", ",", "FestivalMap", ".", "class", ")", ";", "spec", "=", "tabHost", ".", "newTabSpec", "(", "\"map\"", ")", ".", "setIndicator", "(", "\"Maps\"", ",", "null", ")", ".", "setContent", "(", "intent", ")", ";", "tabHost", ".", "addTab", "(", "spec", ")", ";", "tabHost", ".", "setCurrentTab", "(", "0", ")", ";", "}", "}", "</s>" ]
12,882
[ "<s>", "package", "cz", ".", "festomat", ".", "client", ".", "data", ".", "beans", ";", "import", "java", ".", "util", ".", "Date", ";", "public", "class", "CommentBean", "{", "private", "String", "author", ";", "private", "Date", "time", ";", "private", "String", "text", ";", "public", "CommentBean", "(", "String", "author", ",", "Date", "time", ",", "String", "text", ")", "{", "super", "(", ")", ";", "this", ".", "author", "=", "author", ";", "this", ".", "time", "=", "time", ";", "this", ".", "text", "=", "text", ";", "}", "public", "String", "getAuthor", "(", ")", "{", "return", "author", ";", "}", "public", "void", "setAuthor", "(", "String", "author", ")", "{", "this", ".", "author", "=", "author", ";", "}", "public", "Date", "getTime", "(", ")", "{", "return", "time", ";", "}", "public", "void", "setTime", "(", "Date", "time", ")", "{", "this", ".", "time", "=", "time", ";", "}", "public", "String", "getText", "(", ")", "{", "return", "text", ";", "}", "public", "void", "setText", "(", "String", "text", ")", "{", "this", ".", "text", "=", "text", ";", "}", "}", "</s>" ]
12,883
[ "<s>", "package", "cz", ".", "festomat", ".", "client", ".", "data", ".", "beans", ";", "import", "java", ".", "util", ".", "Date", ";", "public", "class", "FestivalBean", "{", "public", "FestivalBean", "(", "String", "id", ",", "String", "address", ",", "String", "name", ",", "String", "lng", ",", "String", "lat", ",", "Date", "start", ",", "Date", "end", ",", "String", "description", ")", "{", "super", "(", ")", ";", "this", ".", "id", "=", "id", ";", "this", ".", "address", "=", "address", ";", "this", ".", "name", "=", "name", ";", "this", ".", "lng", "=", "lng", ";", "this", ".", "lat", "=", "lat", ";", "this", ".", "start", "=", "start", ";", "this", ".", "end", "=", "end", ";", "this", ".", "description", "=", "description", ";", "}", "public", "FestivalBean", "(", ")", "{", "super", "(", ")", ";", "}", "private", "String", "id", ";", "private", "String", "address", ";", "private", "String", "name", ";", "private", "String", "lng", ";", "private", "String", "lat", ";", "private", "Date", "start", ";", "private", "Date", "end", ";", "private", "String", "description", ";", "public", "String", "getId", "(", ")", "{", "return", "id", ";", "}", "public", "void", "setId", "(", "String", "id", ")", "{", "this", ".", "id", "=", "id", ";", "}", "public", "String", "getAddress", "(", ")", "{", "return", "address", ";", "}", "public", "void", "setAddress", "(", "String", "address", ")", "{", "this", ".", "address", "=", "address", ";", "}", "public", "String", "getName", "(", ")", "{", "return", "name", ";", "}", "public", "void", "setName", "(", "String", "name", ")", "{", "this", ".", "name", "=", "name", ";", "}", "public", "String", "getLng", "(", ")", "{", "return", "lng", ";", "}", "public", "void", "setLng", "(", "String", "lng", ")", "{", "this", ".", "lng", "=", "lng", ";", "}", "public", "String", "getLat", "(", ")", "{", "return", "lat", ";", "}", "public", "void", "setLat", "(", "String", "lat", ")", "{", "this", ".", "lat", "=", "lat", ";", "}", "public", "Date", "getStart", "(", ")", "{", "return", "start", ";", "}", "public", "void", "setStart", "(", "Date", "start", ")", "{", "this", ".", "start", "=", "start", ";", "}", "public", "Date", "getEnd", "(", ")", "{", "return", "end", ";", "}", "public", "void", "setEnd", "(", "Date", "end", ")", "{", "this", ".", "end", "=", "end", ";", "}", "public", "String", "getDescription", "(", ")", "{", "return", "description", ";", "}", "public", "void", "setDescription", "(", "String", "description", ")", "{", "this", ".", "description", "=", "description", ";", "}", "}", "</s>" ]
12,884
[ "<s>", "package", "cz", ".", "festomat", ".", "client", ".", "data", ".", "beans", ";", "import", "java", ".", "util", ".", "Date", ";", "public", "class", "FestivalListBean", "{", "private", "String", "id", ";", "private", "String", "name", ";", "private", "String", "lng", ",", "lat", ";", "private", "Date", "start", ";", "public", "FestivalListBean", "(", "String", "id", ",", "String", "name", ",", "String", "lng", ",", "String", "lat", ",", "Date", "start", ")", "{", "super", "(", ")", ";", "this", ".", "id", "=", "id", ";", "this", ".", "name", "=", "name", ";", "this", ".", "lng", "=", "lng", ";", "this", ".", "lat", "=", "lat", ";", "this", ".", "start", "=", "start", ";", "}", "public", "FestivalListBean", "(", ")", "{", "}", "public", "String", "getId", "(", ")", "{", "return", "id", ";", "}", "public", "void", "setId", "(", "String", "id", ")", "{", "this", ".", "id", "=", "id", ";", "}", "public", "String", "getName", "(", ")", "{", "return", "name", ";", "}", "public", "void", "setName", "(", "String", "name", ")", "{", "this", ".", "name", "=", "name", ";", "}", "public", "String", "getLng", "(", ")", "{", "return", "lng", ";", "}", "public", "void", "setLng", "(", "String", "lng", ")", "{", "this", ".", "lng", "=", "lng", ";", "}", "public", "String", "getLat", "(", ")", "{", "return", "lat", ";", "}", "public", "void", "setLat", "(", "String", "lat", ")", "{", "this", ".", "lat", "=", "lat", ";", "}", "public", "Date", "getStart", "(", ")", "{", "return", "start", ";", "}", "public", "void", "setStart", "(", "Date", "start", ")", "{", "this", ".", "start", "=", "start", ";", "}", "}", "</s>" ]
12,885
[ "<s>", "package", "cz", ".", "festomat", ".", "client", ".", "data", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Collections", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "apache", ".", "http", ".", "HttpResponse", ";", "import", "org", ".", "apache", ".", "http", ".", "NameValuePair", ";", "import", "org", ".", "apache", ".", "http", ".", "client", ".", "ClientProtocolException", ";", "import", "org", ".", "apache", ".", "http", ".", "client", ".", "HttpClient", ";", "import", "org", ".", "apache", ".", "http", ".", "client", ".", "entity", ".", "UrlEncodedFormEntity", ";", "import", "org", ".", "apache", ".", "http", ".", "client", ".", "methods", ".", "HttpPost", ";", "import", "org", ".", "apache", ".", "http", ".", "impl", ".", "client", ".", "DefaultHttpClient", ";", "import", "org", ".", "apache", ".", "http", ".", "message", ".", "BasicNameValuePair", ";", "import", "com", ".", "google", ".", "gson", ".", "Gson", ";", "import", "com", ".", "google", ".", "gson", ".", "reflect", ".", "TypeToken", ";", "import", "cz", ".", "festomat", ".", "client", ".", "data", ".", "beans", ".", "CommentBean", ";", "import", "cz", ".", "festomat", ".", "client", ".", "data", ".", "beans", ".", "FestivalBean", ";", "import", "cz", ".", "festomat", ".", "client", ".", "data", ".", "beans", ".", "FestivalListBean", ";", "public", "class", "DataSourceImpl", "implements", "IDataSource", "{", "RestClient", "rc", ";", "public", "DataSourceImpl", "(", ")", "{", "rc", "=", "new", "RestClient", "(", ")", ";", "}", "@", "Override", "public", "List", "<", "FestivalListBean", ">", "getAllFestivalls", "(", ")", "{", "return", "(", "List", "<", "FestivalListBean", ">", ")", "rc", ".", "getData", "(", "\"list\"", ",", "new", "TypeToken", "<", "List", "<", "FestivalListBean", ">", ">", "(", ")", "{", "}", ".", "getType", "(", ")", ")", ";", "}", "Map", "<", "String", ",", "FestivalBean", ">", "festivals", "=", "new", "HashMap", "<", "String", ",", "FestivalBean", ">", "(", ")", ";", "@", "Override", "public", "FestivalBean", "getFestivalById", "(", "String", "id", ")", "{", "if", "(", "!", "festivals", ".", "containsKey", "(", "id", ")", ")", "{", "FestivalBean", "fb", "=", "(", "FestivalBean", ")", "rc", ".", "getData", "(", "id", ",", "new", "TypeToken", "<", "FestivalBean", ">", "(", ")", "{", "}", ".", "getType", "(", ")", ")", ";", "festivals", ".", "put", "(", "id", ",", "fb", ")", ";", "}", "return", "festivals", ".", "get", "(", "id", ")", ";", "}", "@", "Override", "public", "List", "<", "CommentBean", ">", "getAllComments", "(", "String", "festivalId", ")", "{", "List", "<", "CommentBean", ">", "list", "=", "(", "List", "<", "CommentBean", ">", ")", "rc", ".", "getData", "(", "festivalId", "+", "\"/comments\"", ",", "new", "TypeToken", "<", "List", "<", "CommentBean", ">", ">", "(", ")", "{", "}", ".", "getType", "(", ")", ")", ";", "if", "(", "list", "==", "null", ")", "{", "list", "=", "Collections", ".", "EMPTY_LIST", ";", "}", "return", "list", ";", "}", "@", "Override", "public", "List", "<", "CommentBean", ">", "getFilteredComments", "(", "String", "festivalId", ",", "String", "needle", ")", "{", "List", "<", "CommentBean", ">", "list", "=", "(", "List", "<", "CommentBean", ">", ")", "rc", ".", "getData", "(", "festivalId", "+", "\"\"", "+", "needle", ",", "new", "TypeToken", "<", "List", "<", "CommentBean", ">", ">", "(", ")", "{", "}", ".", "getType", "(", ")", ")", ";", "if", "(", "list", "==", "null", ")", "{", "list", "=", "Collections", ".", "EMPTY_LIST", ";", "}", "return", "list", ";", "}", "@", "Override", "public", "void", "sendComment", "(", "String", "festivalId", ",", "CommentBean", "comment", ")", "{", "HttpClient", "httpclient", "=", "new", "DefaultHttpClient", "(", ")", ";", "HttpPost", "httppost", "=", "new", "HttpPost", "(", "RestClient", ".", "BASEURL", "+", "festivalId", "+", "\"/comments\"", ")", ";", "try", "{", "Gson", "gson", "=", "new", "Gson", "(", ")", ";", "List", "<", "NameValuePair", ">", "nameValuePairs", "=", "new", "ArrayList", "<", "NameValuePair", ">", "(", "2", ")", ";", "nameValuePairs", ".", "add", "(", "new", "BasicNameValuePair", "(", "\"comment\"", ",", "gson", ".", "toJson", "(", "comment", ")", ")", ")", ";", "httppost", ".", "setEntity", "(", "new", "UrlEncodedFormEntity", "(", "nameValuePairs", ")", ")", ";", "HttpResponse", "response", "=", "httpclient", ".", "execute", "(", "httppost", ")", ";", "}", "catch", "(", "ClientProtocolException", "e", ")", "{", "}", "catch", "(", "IOException", "e", ")", "{", "}", "}", "}", "</s>" ]
12,886
[ "<s>", "package", "cz", ".", "festomat", ".", "client", ".", "data", ";", "import", "java", ".", "util", ".", "List", ";", "import", "cz", ".", "festomat", ".", "client", ".", "data", ".", "beans", ".", "CommentBean", ";", "import", "cz", ".", "festomat", ".", "client", ".", "data", ".", "beans", ".", "FestivalBean", ";", "import", "cz", ".", "festomat", ".", "client", ".", "data", ".", "beans", ".", "FestivalListBean", ";", "public", "interface", "IDataSource", "{", "List", "<", "FestivalListBean", ">", "getAllFestivalls", "(", ")", ";", "FestivalBean", "getFestivalById", "(", "String", "id", ")", ";", "List", "<", "CommentBean", ">", "getAllComments", "(", "String", "festivalId", ")", ";", "List", "<", "CommentBean", ">", "getFilteredComments", "(", "String", "festivalId", ",", "String", "needle", ")", ";", "void", "sendComment", "(", "String", "festivalId", ",", "CommentBean", "comment", ")", ";", "}", "</s>" ]
12,887
[ "<s>", "package", "cz", ".", "festomat", ".", "client", ".", "data", ";", "import", "java", ".", "io", ".", "BufferedReader", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "InputStream", ";", "import", "java", ".", "io", ".", "InputStreamReader", ";", "import", "java", ".", "lang", ".", "reflect", ".", "Type", ";", "import", "org", ".", "apache", ".", "http", ".", "HttpEntity", ";", "import", "org", ".", "apache", ".", "http", ".", "HttpResponse", ";", "import", "org", ".", "apache", ".", "http", ".", "client", ".", "HttpClient", ";", "import", "org", ".", "apache", ".", "http", ".", "client", ".", "methods", ".", "HttpGet", ";", "import", "org", ".", "apache", ".", "http", ".", "impl", ".", "client", ".", "DefaultHttpClient", ";", "import", "android", ".", "util", ".", "Log", ";", "import", "com", ".", "google", ".", "gson", ".", "Gson", ";", "public", "class", "RestClient", "{", "public", "static", "final", "String", "BASEURL", "=", "\"\"", ";", "private", "String", "convertStreamToString", "(", "InputStream", "is", ")", "{", "BufferedReader", "reader", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "is", ")", ")", ";", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "String", "line", "=", "null", ";", "try", "{", "while", "(", "(", "line", "=", "reader", ".", "readLine", "(", ")", ")", "!=", "null", ")", "{", "sb", ".", "append", "(", "line", "+", "\"n\"", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "finally", "{", "try", "{", "is", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "return", "sb", ".", "toString", "(", ")", ";", "}", "public", "Object", "getData", "(", "String", "url", ",", "Type", "cls", ")", "{", "Object", "data", "=", "null", ";", "HttpClient", "httpclient", "=", "new", "DefaultHttpClient", "(", ")", ";", "HttpGet", "httpget", "=", "new", "HttpGet", "(", "BASEURL", "+", "url", ")", ";", "HttpResponse", "response", ";", "try", "{", "response", "=", "httpclient", ".", "execute", "(", "httpget", ")", ";", "HttpEntity", "entity", "=", "response", ".", "getEntity", "(", ")", ";", "if", "(", "entity", "!=", "null", ")", "{", "InputStream", "instream", "=", "entity", ".", "getContent", "(", ")", ";", "String", "json", "=", "convertStreamToString", "(", "instream", ")", ";", "Gson", "gson", "=", "new", "Gson", "(", ")", ";", "data", "=", "gson", ".", "fromJson", "(", "json", ",", "cls", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "Log", ".", "e", "(", "\"Praeda\"", ",", "e", ".", "getMessage", "(", ")", ")", ";", "}", "return", "data", ";", "}", "}", "</s>" ]
12,888
[ "<s>", "package", "cz", ".", "festomat", ".", "client", ".", "data", ";", "public", "class", "DataSource", "{", "private", "static", "IDataSource", "instance", "=", "null", ";", "private", "DataSource", "(", ")", "{", "}", "public", "static", "IDataSource", "getInstance", "(", ")", "{", "if", "(", "instance", "==", "null", ")", "{", "instance", "=", "new", "DataSourceImpl", "(", ")", ";", "}", "return", "instance", ";", "}", "}", "</s>" ]
12,889
[ "<s>", "package", "cz", ".", "festomat", ".", "client", ".", "data", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Collections", ";", "import", "java", ".", "util", ".", "Date", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "android", ".", "util", ".", "Log", ";", "import", "cz", ".", "festomat", ".", "client", ".", "data", ".", "beans", ".", "CommentBean", ";", "import", "cz", ".", "festomat", ".", "client", ".", "data", ".", "beans", ".", "FestivalBean", ";", "import", "cz", ".", "festomat", ".", "client", ".", "data", ".", "beans", ".", "FestivalListBean", ";", "public", "class", "DataSourceImplTest", "implements", "IDataSource", "{", "private", "final", "Map", "<", "String", ",", "FestivalBean", ">", "festivals", ";", "private", "final", "Map", "<", "String", ",", "String", ">", "all", ";", "private", "final", "List", "<", "CommentBean", ">", "comments", ";", "public", "DataSourceImplTest", "(", ")", "{", "festivals", "=", "new", "HashMap", "<", "String", ",", "FestivalBean", ">", "(", ")", ";", "FestivalBean", "fb1", "=", "new", "FestivalBean", "(", "\"ASFHGF1\"", ",", "\"Adresa", "1\"", ",", "\"Ceske", "Hrady\"", ",", "\"50:4:50.251\"", ",", "\"14:26:32.166\"", ",", "new", "Date", "(", "2011", ",", "5", ",", "25", ")", ",", "new", "Date", "(", "2011", ",", "5", ",", "27", ")", ",", "\"\"", ")", ";", "FestivalBean", "fb2", "=", "new", "FestivalBean", "(", "\"ASFHGF2\"", ",", "\"Adresa", "2\"", ",", "\"\"", ",", "\"50:4:50.251\"", ",", "\"14:26:32.166\"", ",", "new", "Date", "(", "2011", ",", "6", ",", "25", ")", ",", "new", "Date", "(", "2011", ",", "6", ",", "27", ")", ",", "\"\"", ")", ";", "FestivalBean", "fb3", "=", "new", "FestivalBean", "(", "\"ASFHGF3\"", ",", "\"Adresa", "3\"", ",", "\"\"", ",", "\"50:4:50.251\"", ",", "\"14:26:32.166\"", ",", "new", "Date", "(", "2011", ",", "7", ",", "25", ")", ",", "new", "Date", "(", "2011", ",", "7", ",", "27", ")", ",", "\"\"", ")", ";", "festivals", ".", "put", "(", "\"ASFHGF1\"", ",", "fb1", ")", ";", "festivals", ".", "put", "(", "\"ASFHGF2\"", ",", "fb2", ")", ";", "festivals", ".", "put", "(", "\"ASFHGF3\"", ",", "fb3", ")", ";", "all", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "FestivalBean", "bean", ";", "for", "(", "String", "key", ":", "festivals", ".", "keySet", "(", ")", ")", "{", "bean", "=", "festivals", ".", "get", "(", "key", ")", ";", "all", ".", "put", "(", "bean", ".", "getId", "(", ")", ",", "bean", ".", "getName", "(", ")", ")", ";", "}", "comments", "=", "new", "ArrayList", "<", "CommentBean", ">", "(", ")", ";", "CommentBean", "cb1", "=", "new", "CommentBean", "(", "\"@petr\"", ",", "new", "Date", "(", ")", ",", "\"\"", ")", ";", "CommentBean", "cb2", "=", "new", "CommentBean", "(", "\"@lubos\"", ",", "new", "Date", "(", ")", ",", "\"\"", ")", ";", "CommentBean", "cb3", "=", "new", "CommentBean", "(", "\"@pepa\"", ",", "new", "Date", "(", ")", ",", "\"prosim!\"", ")", ";", "comments", ".", "add", "(", "cb1", ")", ";", "comments", ".", "add", "(", "cb2", ")", ";", "comments", ".", "add", "(", "cb3", ")", ";", "}", "@", "Override", "public", "List", "<", "FestivalListBean", ">", "getAllFestivalls", "(", ")", "{", "return", "Collections", ".", "EMPTY_LIST", ";", "}", "@", "Override", "public", "FestivalBean", "getFestivalById", "(", "String", "id", ")", "{", "return", "festivals", ".", "get", "(", "id", ")", ";", "}", "@", "Override", "public", "List", "<", "CommentBean", ">", "getAllComments", "(", "String", "festivalId", ")", "{", "return", "comments", ";", "}", "@", "Override", "public", "void", "sendComment", "(", "String", "festivalId", ",", "CommentBean", "comment", ")", "{", "Log", ".", "i", "(", "\"DATA\"", ",", "\"\"", "+", "comment", ".", "getText", "(", ")", ")", ";", "}", "@", "Override", "public", "List", "<", "CommentBean", ">", "getFilteredComments", "(", "String", "festivalId", ",", "String", "needle", ")", "{", "return", "Collections", ".", "EMPTY_LIST", ";", "}", "}", "</s>" ]
12,890
[ "<s>", "package", "birthday", ";", "import", "java", ".", "util", ".", "Date", ";", "import", "java", ".", "util", ".", "List", ";", "public", "class", "BirthdayRing", "{", "private", "final", "BirthdayDatabase", "bdb", ";", "private", "final", "NumberLookup", "nlu", ";", "private", "final", "PhoneDailer", "phd", ";", "public", "BirthdayRing", "(", "BirthdayDatabase", "bdb", ",", "NumberLookup", "nlu", ",", "PhoneDailer", "phd", ")", "{", "this", ".", "bdb", "=", "bdb", ";", "this", ".", "nlu", "=", "nlu", ";", "this", ".", "phd", "=", "phd", ";", "}", "public", "void", "run", "(", ")", "{", "Date", "now", "=", "new", "Date", "(", ")", ";", "List", "<", "String", ">", "names", "=", "bdb", ".", "findBirthdays", "(", "now", ")", ";", "for", "(", "String", "name", ":", "names", ")", "{", "String", "number", "=", "nlu", ".", "getNumber", "(", "name", ")", ";", "phd", ".", "dialNumber", "(", "number", ")", ";", "}", "}", "}", "</s>" ]
12,891
[ "<s>", "package", "birthday", ";", "public", "interface", "NumberLookup", "{", "String", "getNumber", "(", "String", "name", ")", ";", "}", "</s>" ]
12,892
[ "<s>", "package", "birthday", ";", "import", "static", "org", ".", "mockito", ".", "Matchers", ".", "isA", ";", "import", "static", "org", ".", "mockito", ".", "Mockito", ".", "mock", ";", "import", "static", "org", ".", "mockito", ".", "Mockito", ".", "verify", ";", "import", "static", "org", ".", "mockito", ".", "Mockito", ".", "when", ";", "import", "static", "org", ".", "mockito", ".", "Mockito", ".", "doNothing", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Date", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "junit", ".", "Before", ";", "import", "org", ".", "junit", ".", "Test", ";", "public", "class", "BirthdayRingTest", "{", "private", "BirthdayDatabase", "bdb", ";", "private", "BirthdayRing", "birthdayRing", ";", "private", "NumberLookup", "nlu", ";", "private", "PhoneDailer", "phd", ";", "@", "Before", "public", "void", "setUp", "(", ")", "{", "bdb", "=", "mock", "(", "BirthdayDatabase", ".", "class", ")", ";", "nlu", "=", "mock", "(", "NumberLookup", ".", "class", ")", ";", "phd", "=", "mock", "(", "PhoneDailer", ".", "class", ")", ";", "birthdayRing", "=", "new", "BirthdayRing", "(", "bdb", ",", "nlu", ",", "phd", ")", ";", "}", "@", "Test", "public", "void", "callsBirthdayDatabase", "(", ")", "throws", "Exception", "{", "List", "<", "String", ">", "birthdays", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "when", "(", "bdb", ".", "findBirthdays", "(", "isA", "(", "Date", ".", "class", ")", ")", ")", ".", "thenReturn", "(", "birthdays", ")", ";", "birthdayRing", ".", "run", "(", ")", ";", "verify", "(", "bdb", ")", ".", "findBirthdays", "(", "isA", "(", "Date", ".", "class", ")", ")", ";", "}", "@", "Test", "public", "void", "callsNumberLookup", "(", ")", "throws", "Exception", "{", "List", "<", "String", ">", "birthdays", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "String", "name", "=", "\"John\"", ";", "birthdays", ".", "add", "(", "name", ")", ";", "when", "(", "bdb", ".", "findBirthdays", "(", "isA", "(", "Date", ".", "class", ")", ")", ")", ".", "thenReturn", "(", "birthdays", ")", ";", "when", "(", "nlu", ".", "getNumber", "(", "name", ")", ")", ".", "thenReturn", "(", "null", ")", ";", "birthdayRing", ".", "run", "(", ")", ";", "verify", "(", "nlu", ")", ".", "getNumber", "(", "name", ")", ";", "}", "@", "Test", "public", "void", "callsPhoneDailer", "(", ")", "throws", "Exception", "{", "List", "<", "String", ">", "birthdays", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "String", "name", "=", "\"John\"", ";", "birthdays", ".", "add", "(", "name", ")", ";", "when", "(", "bdb", ".", "findBirthdays", "(", "isA", "(", "Date", ".", "class", ")", ")", ")", ".", "thenReturn", "(", "birthdays", ")", ";", "String", "number", "=", "\"555-5555\"", ";", "when", "(", "nlu", ".", "getNumber", "(", "name", ")", ")", ".", "thenReturn", "(", "number", ")", ";", "birthdayRing", ".", "run", "(", ")", ";", "verify", "(", "phd", ")", ".", "dialNumber", "(", "number", ")", ";", "}", "}", "</s>" ]
12,893
[ "<s>", "package", "birthday", ";", "public", "interface", "PhoneDailer", "{", "void", "dialNumber", "(", "String", "number", ")", ";", "}", "</s>" ]
12,894
[ "<s>", "package", "birthday", ";", "import", "java", ".", "util", ".", "Date", ";", "import", "java", ".", "util", ".", "List", ";", "public", "interface", "BirthdayDatabase", "{", "List", "<", "String", ">", "findBirthdays", "(", "Date", "date", ")", ";", "}", "</s>" ]
12,895
[ "<s>", "package", "org", ".", "sonatype", ".", "plugins", ".", "portallocator", ";", "import", "org", ".", "apache", ".", "maven", ".", "plugin", ".", "MojoFailureException", ";", "public", "class", "PortUnavailableException", "extends", "MojoFailureException", "{", "private", "static", "final", "long", "serialVersionUID", "=", "-", "7410759462209491374L", ";", "public", "PortUnavailableException", "(", "String", "message", ",", "Exception", "cause", ")", "{", "super", "(", "message", ")", ";", "initCause", "(", "cause", ")", ";", "}", "}", "</s>" ]
12,896
[ "<s>", "package", "org", ".", "sonatype", ".", "plugins", ".", "portallocator", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "net", ".", "ServerSocket", ";", "import", "org", ".", "apache", ".", "maven", ".", "plugin", ".", "AbstractMojo", ";", "import", "org", ".", "apache", ".", "maven", ".", "plugin", ".", "MojoExecutionException", ";", "import", "org", ".", "apache", ".", "maven", ".", "plugin", ".", "MojoFailureException", ";", "import", "org", ".", "apache", ".", "maven", ".", "project", ".", "MavenProject", ";", "public", "class", "PortAllocatorMojo", "extends", "AbstractMojo", "{", "private", "Port", "[", "]", "ports", ";", "private", "MavenProject", "project", ";", "public", "void", "execute", "(", ")", "throws", "MojoExecutionException", ",", "MojoFailureException", "{", "for", "(", "Port", "port", ":", "ports", ")", "{", "String", "name", "=", "port", ".", "getName", "(", ")", ";", "if", "(", "name", "==", "null", ")", "{", "getLog", "(", ")", ".", "warn", "(", "\"\"", ")", ";", "continue", ";", "}", "String", "type", "=", "port", ".", "getType", "(", ")", ";", "int", "portNumber", ";", "if", "(", "Port", ".", "DEFAULT", ".", "equals", "(", "type", ")", ")", "{", "portNumber", "=", "handleDefaultPort", "(", "port", ")", ";", "}", "else", "{", "throw", "new", "MojoFailureException", "(", "\"\"", "+", "type", "+", "\"'", "for", "'\"", "+", "port", ".", "getName", "(", ")", "+", "\"'\"", ")", ";", "}", "getLog", "(", ")", ".", "info", "(", "\"\"", "+", "portNumber", "+", "\"\"", "+", "name", "+", "\"'\"", ")", ";", "project", ".", "getProperties", "(", ")", ".", "put", "(", "name", ",", "String", ".", "valueOf", "(", "portNumber", ")", ")", ";", "}", "}", "private", "int", "handleDefaultPort", "(", "Port", "port", ")", "throws", "MojoFailureException", ",", "MojoExecutionException", "{", "try", "{", "return", "allocate", "(", "port", ".", "getPortNumber", "(", ")", ")", ";", "}", "catch", "(", "PortUnavailableException", "e", ")", "{", "if", "(", "port", ".", "getFailIfOccupied", "(", ")", ")", "{", "throw", "e", ";", "}", "else", "{", "return", "allocate", "(", "0", ")", ";", "}", "}", "}", "private", "int", "allocate", "(", "int", "portNumber", ")", "throws", "PortUnavailableException", ",", "MojoFailureException", ",", "MojoExecutionException", "{", "ServerSocket", "server", ";", "try", "{", "server", "=", "new", "ServerSocket", "(", "portNumber", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "PortUnavailableException", "(", "e", ".", "getLocalizedMessage", "(", ")", ",", "e", ")", ";", "}", "portNumber", "=", "server", ".", "getLocalPort", "(", ")", ";", "try", "{", "server", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "MojoExecutionException", "(", "\"\"", "+", "portNumber", ",", "e", ")", ";", "}", "return", "portNumber", ";", "}", "public", "void", "setProject", "(", "MavenProject", "project", ")", "{", "this", ".", "project", "=", "project", ";", "}", "public", "void", "setPorts", "(", "Port", "[", "]", "ports", ")", "{", "this", ".", "ports", "=", "ports", ";", "}", "}", "</s>" ]
12,897
[ "<s>", "package", "org", ".", "sonatype", ".", "plugins", ".", "portallocator", ";", "public", "class", "Port", "{", "public", "static", "final", "String", "DEFAULT", "=", "\"default\"", ";", "private", "boolean", "failIfOccupied", ";", "private", "String", "name", ";", "private", "int", "portNumber", ";", "private", "String", "type", "=", "DEFAULT", ";", "public", "Port", "(", ")", "{", "super", "(", ")", ";", "}", "public", "Port", "(", "String", "name", ")", "{", "super", "(", ")", ";", "this", ".", "name", "=", "name", ";", "}", "public", "boolean", "getFailIfOccupied", "(", ")", "{", "return", "failIfOccupied", ";", "}", "public", "String", "getName", "(", ")", "{", "return", "name", ";", "}", "public", "int", "getPortNumber", "(", ")", "{", "return", "portNumber", ";", "}", "public", "String", "getType", "(", ")", "{", "return", "type", ";", "}", "public", "void", "setFailIfOccupied", "(", "boolean", "failIfOccupied", ")", "{", "this", ".", "failIfOccupied", "=", "failIfOccupied", ";", "}", "public", "void", "setName", "(", "String", "name", ")", "{", "this", ".", "name", "=", "name", ";", "}", "public", "void", "setPortNumber", "(", "int", "portNumber", ")", "{", "this", ".", "portNumber", "=", "portNumber", ";", "}", "public", "void", "setType", "(", "String", "type", ")", "{", "this", ".", "type", "=", "type", ";", "}", "}", "</s>" ]
12,898
[ "<s>", "package", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "model", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "FileInputStream", ";", "import", "java", ".", "io", ".", "FileWriter", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "Properties", ";", "import", "javax", ".", "swing", ".", "UIManager", ";", "public", "class", "SystemConfiguration", "{", "private", "final", "String", "configFile", "=", "System", ".", "getProperty", "(", "\"user.home\"", ")", "+", "\"\"", ";", "private", "Properties", "configProperties", ";", "private", "String", "username", ";", "private", "String", "password", ";", "private", "String", "nfePath", ";", "private", "String", "visual", ";", "private", "String", "wsURL", ";", "public", "static", "final", "int", "VALID", "=", "1", ";", "public", "static", "final", "int", "INVALID", "=", "2", ";", "public", "SystemConfiguration", "(", ")", "throws", "IOException", "{", "load", "(", ")", ";", "}", "private", "void", "load", "(", ")", "throws", "IOException", "{", "File", "file", "=", "new", "File", "(", "configFile", ")", ";", "configProperties", "=", "new", "Properties", "(", ")", ";", "if", "(", "file", ".", "exists", "(", ")", ")", "{", "configProperties", ".", "load", "(", "new", "FileInputStream", "(", "file", ")", ")", ";", "setFields", "(", ")", ";", "}", "else", "{", "setDefaults", "(", ")", ";", "}", "}", "public", "void", "store", "(", ")", "throws", "IOException", "{", "configProperties", ".", "store", "(", "new", "FileWriter", "(", "new", "File", "(", "configFile", ")", ")", ",", "\"\"", ")", ";", "}", "private", "void", "setDefaults", "(", ")", "{", "setUsername", "(", "\"\"", ")", ";", "setPassword", "(", "\"\"", ")", ";", "setNfePath", "(", "\"\"", ")", ";", "setVisual", "(", "UIManager", ".", "getSystemLookAndFeelClassName", "(", ")", ")", ";", "}", "private", "void", "setFields", "(", ")", "{", "nfePath", "=", "configProperties", ".", "getProperty", "(", "\"nfe.path\"", ")", ";", "username", "=", "configProperties", ".", "getProperty", "(", "\"user.name\"", ")", ";", "password", "=", "configProperties", ".", "getProperty", "(", "\"\"", ")", ";", "visual", "=", "configProperties", ".", "getProperty", "(", "\"app.visual\"", ")", ";", "wsURL", "=", "configProperties", ".", "getProperty", "(", "\"ws.url\"", ")", ";", "}", "public", "String", "getNfePath", "(", ")", "{", "return", "nfePath", ";", "}", "public", "void", "setNfePath", "(", "String", "nfePath", ")", "{", "configProperties", ".", "setProperty", "(", "\"nfe.path\"", ",", "nfePath", ")", ";", "this", ".", "nfePath", "=", "nfePath", ";", "}", "public", "String", "getPassword", "(", ")", "{", "return", "password", ";", "}", "public", "void", "setPassword", "(", "String", "password", ")", "{", "configProperties", ".", "setProperty", "(", "\"\"", ",", "password", ")", ";", "this", ".", "password", "=", "password", ";", "}", "public", "String", "getUsername", "(", ")", "{", "return", "username", ";", "}", "public", "void", "setUsername", "(", "String", "username", ")", "{", "configProperties", ".", "setProperty", "(", "\"user.name\"", ",", "username", ")", ";", "this", ".", "username", "=", "username", ";", "}", "public", "String", "getVisual", "(", ")", "{", "return", "visual", ";", "}", "public", "void", "setVisual", "(", "String", "visual", ")", "{", "configProperties", ".", "setProperty", "(", "\"app.visual\"", ",", "visual", ")", ";", "this", ".", "visual", "=", "visual", ";", "}", "public", "String", "getWsURL", "(", ")", "{", "return", "wsURL", ";", "}", "public", "void", "setWsURL", "(", "String", "wsURL", ")", "{", "configProperties", ".", "setProperty", "(", "\"ws.url\"", ",", "wsURL", ")", ";", "this", ".", "wsURL", "=", "wsURL", ";", "}", "public", "int", "validate", "(", ")", "{", "if", "(", "isEmpty", "(", "username", ")", ")", "return", "INVALID", ";", "if", "(", "isEmpty", "(", "password", ")", ")", "return", "INVALID", ";", "if", "(", "isEmpty", "(", "nfePath", ")", ")", "return", "INVALID", ";", "if", "(", "isEmpty", "(", "wsURL", ")", ")", "return", "INVALID", ";", "return", "VALID", ";", "}", "private", "boolean", "isEmpty", "(", "String", "value", ")", "{", "return", "(", "value", "==", "null", "||", "value", ".", "isEmpty", "(", ")", ")", ";", "}", "}", "</s>" ]
12,899
[ "<s>", "package", "com", ".", "nfe", ".", "guardian", ".", "client", ".", "model", ";", "import", "com", ".", "nfe", ".", "guardian", ".", "shared", ".", "model", ".", "resources", ".", "NFEGuardianError", ";", "import", "com", ".", "tiago", ".", "tablemodel", ".", "annotations", ".", "CollumnModel", ";", "public", "class", "NFeErrorWrapper", "{", "@", "CollumnModel", "(", "headerName", "=", "\"Cod.", "Erro\"", ")", "private", "int", "errorCode", ";", "@", "CollumnModel", "(", "headerName", "=", "\"Arquivo", "XML\"", ")", "private", "String", "fileName", ";", "@", "CollumnModel", "(", "headerName", "=", "\"Descri-UNK-o\"", ")", "private", "String", "message", ";", "public", "NFeErrorWrapper", "(", "String", "fileName", ",", "NFEGuardianError", "error", ")", "{", "this", ".", "fileName", "=", "fileName", ";", "errorCode", "=", "error", ".", "getHttpErrorCode", "(", ")", ";", "message", "=", "error", ".", "getMessage", "(", ")", ";", "}", "public", "int", "getErrorCode", "(", ")", "{", "return", "errorCode", ";", "}", "public", "String", "getFileName", "(", ")", "{", "return", "fileName", ";", "}", "public", "String", "getMessage", "(", ")", "{", "return", "message", ";", "}", "}", "</s>" ]