| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
|
| 21 |
|
|
| 22 |
|
|
| 23 |
|
|
| 24 |
|
|
| 25 |
|
|
| 26 |
|
|
| 27 |
|
|
| 28 |
|
|
| 29 |
|
|
| 30 |
|
|
| 31 |
|
|
| 32 |
|
package net.sourceforge.pebble.webservice; |
| 33 |
|
|
| 34 |
|
import net.sourceforge.pebble.Constants; |
| 35 |
|
import net.sourceforge.pebble.domain.*; |
| 36 |
|
import net.sourceforge.pebble.mock.MockAuthenticationManager; |
| 37 |
|
import org.acegisecurity.GrantedAuthority; |
| 38 |
|
import org.acegisecurity.GrantedAuthorityImpl; |
| 39 |
|
import org.acegisecurity.AuthenticationManager; |
| 40 |
|
import org.apache.xmlrpc.XmlRpcException; |
| 41 |
|
|
| 42 |
|
import java.util.Calendar; |
| 43 |
|
import java.util.Hashtable; |
| 44 |
|
import java.util.Vector; |
| 45 |
|
import java.text.DateFormat; |
| 46 |
|
import java.text.SimpleDateFormat; |
| 47 |
|
|
| 48 |
|
|
| 49 |
|
|
| 50 |
|
|
| 51 |
|
@author |
| 52 |
|
|
|
|
|
| 85,8% |
Uncovered Elements: 32 (226) |
Complexity: 47 |
Complexity Density: 0,22 |
|
| 53 |
|
public class SingleBlogMetaWeblogAPIHandlerTest extends SingleBlogTestCase { |
| 54 |
|
|
| 55 |
|
private MetaWeblogAPIHandler handler = new MetaWeblogAPIHandler(); |
| 56 |
|
private AuthenticationManager authenticationManager; |
| 57 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0,25 |
|
| 58 |
30
|
protected void setUp() throws Exception {... |
| 59 |
30
|
super.setUp(); |
| 60 |
|
|
| 61 |
30
|
authenticationManager = new MockAuthenticationManager(true, new GrantedAuthority[] {new GrantedAuthorityImpl(Constants.BLOG_CONTRIBUTOR_ROLE)}); |
| 62 |
30
|
handler.setAuthenticationManager(authenticationManager); |
| 63 |
30
|
blog.setProperty(Blog.BLOG_CONTRIBUTORS_KEY, "username"); |
| 64 |
|
} |
| 65 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
| 66 |
2
|
public void testConfigured() {... |
| 67 |
2
|
assertSame(authenticationManager, handler.getAuthenticationManager()); |
| 68 |
|
} |
| 69 |
|
|
| 70 |
|
|
| 71 |
|
|
| 72 |
|
|
|
|
|
| 52,4% |
Uncovered Elements: 10 (21) |
Complexity: 11 |
Complexity Density: 0,52 |
1
PASS
|
|
| 73 |
2
|
public void testAuthenticationFailure() {... |
| 74 |
2
|
handler.setAuthenticationManager(new MockAuthenticationManager(false)); |
| 75 |
2
|
try { |
| 76 |
2
|
handler.getCategories("default", "username", "password"); |
| 77 |
0
|
fail(); |
| 78 |
|
} catch (XmlRpcAuthenticationException xmlrpcae) { |
| 79 |
|
} catch (XmlRpcException xmlrpce) { |
| 80 |
|
} |
| 81 |
2
|
try { |
| 82 |
2
|
handler.editPost("default/123", "username", "password", new Hashtable(), true); |
| 83 |
0
|
fail(); |
| 84 |
|
} catch (XmlRpcAuthenticationException xmlrpcae) { |
| 85 |
|
} catch (XmlRpcException xmlrpce) { |
| 86 |
0
|
xmlrpce.printStackTrace(); |
| 87 |
0
|
fail(); |
| 88 |
|
} |
| 89 |
2
|
try { |
| 90 |
2
|
handler.getPost("default/123", "username", "password"); |
| 91 |
0
|
fail(); |
| 92 |
|
} catch (XmlRpcAuthenticationException xmlrpcae) { |
| 93 |
|
} catch (XmlRpcException xmlrpce) { |
| 94 |
0
|
fail(); |
| 95 |
|
} |
| 96 |
2
|
try { |
| 97 |
2
|
handler.getRecentPosts("default", "username", "password", 10); |
| 98 |
0
|
fail(); |
| 99 |
|
} catch (XmlRpcAuthenticationException xmlrpcae) { |
| 100 |
|
} catch (XmlRpcException xmlrpce) { |
| 101 |
0
|
fail(); |
| 102 |
|
} |
| 103 |
2
|
try { |
| 104 |
2
|
handler.newPost("default", "username", "password", new Hashtable(), true); |
| 105 |
0
|
fail(); |
| 106 |
|
} catch (XmlRpcAuthenticationException xmlrpcae) { |
| 107 |
|
} catch (XmlRpcException xmlrpce) { |
| 108 |
0
|
fail(); |
| 109 |
|
} |
| 110 |
|
} |
| 111 |
|
|
| 112 |
|
|
| 113 |
|
|
| 114 |
|
|
|
|
|
| 66,7% |
Uncovered Elements: 5 (15) |
Complexity: 11 |
Complexity Density: 0,73 |
1
PASS
|
|
| 115 |
2
|
public void testAuthenticationSuccess() {... |
| 116 |
2
|
try { |
| 117 |
2
|
handler.getCategories("123", "username", "password"); |
| 118 |
|
} catch (XmlRpcAuthenticationException xmlrpcae) { |
| 119 |
0
|
fail(); |
| 120 |
|
} catch (XmlRpcException xmlrpce) { |
| 121 |
|
} |
| 122 |
2
|
try { |
| 123 |
2
|
handler.editPost("123", "username", "password", new Hashtable(), true); |
| 124 |
|
} catch (XmlRpcAuthenticationException xmlrpcae) { |
| 125 |
0
|
fail(); |
| 126 |
|
} catch (XmlRpcException xmlrpce) { |
| 127 |
|
} |
| 128 |
2
|
try { |
| 129 |
2
|
handler.getPost("123", "username", "password"); |
| 130 |
|
} catch (XmlRpcAuthenticationException xmlrpcae) { |
| 131 |
0
|
fail(); |
| 132 |
|
} catch (XmlRpcException xmlrpce) { |
| 133 |
|
} |
| 134 |
2
|
try { |
| 135 |
2
|
handler.getRecentPosts("default", "username", "password", 10); |
| 136 |
|
} catch (XmlRpcAuthenticationException xmlrpcae) { |
| 137 |
0
|
fail(); |
| 138 |
|
} catch (XmlRpcException xmlrpce) { |
| 139 |
|
} |
| 140 |
2
|
try { |
| 141 |
2
|
handler.newPost("default", "username", "password", new Hashtable(), true); |
| 142 |
|
} catch (XmlRpcAuthenticationException xmlrpcae) { |
| 143 |
0
|
fail(); |
| 144 |
|
} catch (XmlRpcException xmlrpce) { |
| 145 |
|
} |
| 146 |
|
} |
| 147 |
|
|
|
|
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 0,5 |
1
PASS
|
|
| 148 |
2
|
public void testGetRecentPostsFromEmptyBlog() {... |
| 149 |
2
|
try { |
| 150 |
2
|
Vector posts = handler.getRecentPosts("default", "username", "password", 3); |
| 151 |
2
|
assertTrue(posts.isEmpty()); |
| 152 |
|
} catch (Exception e) { |
| 153 |
0
|
fail(); |
| 154 |
|
} |
| 155 |
|
} |
| 156 |
|
|
|
|
|
| 94,3% |
Uncovered Elements: 2 (35) |
Complexity: 2 |
Complexity Density: 0,06 |
1
PASS
|
|
| 157 |
2
|
public void testGetRecentPosts() {... |
| 158 |
2
|
try { |
| 159 |
2
|
BlogService service = new BlogService(); |
| 160 |
|
|
| 161 |
2
|
BlogEntry entry1 = new BlogEntry(blog); |
| 162 |
2
|
entry1.setTitle("title1"); |
| 163 |
2
|
entry1.setBody("body1"); |
| 164 |
2
|
service.putBlogEntry(entry1); |
| 165 |
|
|
| 166 |
2
|
BlogEntry entry2 = new BlogEntry(blog); |
| 167 |
2
|
entry2.setTitle("title2"); |
| 168 |
2
|
entry2.setBody("body2"); |
| 169 |
2
|
service.putBlogEntry(entry2); |
| 170 |
|
|
| 171 |
2
|
BlogEntry entry3 = new BlogEntry(blog); |
| 172 |
2
|
entry3.setTitle("title3"); |
| 173 |
2
|
entry3.setBody("body3"); |
| 174 |
2
|
service.putBlogEntry(entry3); |
| 175 |
|
|
| 176 |
2
|
BlogEntry entry4 = new BlogEntry(blog); |
| 177 |
2
|
entry4.setTitle("title4"); |
| 178 |
2
|
entry4.setBody("body4"); |
| 179 |
2
|
service.putBlogEntry(entry4); |
| 180 |
|
|
| 181 |
2
|
Vector posts = handler.getRecentPosts("default", "username", "password", 3); |
| 182 |
|
|
| 183 |
2
|
assertFalse(posts.isEmpty()); |
| 184 |
2
|
assertEquals(3, posts.size()); |
| 185 |
2
|
Hashtable ht = (Hashtable)posts.get(0); |
| 186 |
2
|
assertEquals("default/" + entry4.getId(), ht.get(MetaWeblogAPIHandler.POST_ID)); |
| 187 |
2
|
assertEquals("body4", ht.get(MetaWeblogAPIHandler.DESCRIPTION)); |
| 188 |
2
|
assertEquals("title4", ht.get(MetaWeblogAPIHandler.TITLE)); |
| 189 |
2
|
ht = (Hashtable)posts.get(1); |
| 190 |
2
|
assertEquals("default/" + entry3.getId(), ht.get(MetaWeblogAPIHandler.POST_ID)); |
| 191 |
2
|
assertEquals("body3", ht.get(MetaWeblogAPIHandler.DESCRIPTION)); |
| 192 |
2
|
assertEquals("title3", ht.get(MetaWeblogAPIHandler.TITLE)); |
| 193 |
2
|
ht = (Hashtable)posts.get(2); |
| 194 |
2
|
assertEquals("default/" + entry2.getId(), ht.get(MetaWeblogAPIHandler.POST_ID)); |
| 195 |
2
|
assertEquals("body2", ht.get(MetaWeblogAPIHandler.DESCRIPTION)); |
| 196 |
2
|
assertEquals("title2", ht.get(MetaWeblogAPIHandler.TITLE)); |
| 197 |
|
} catch (Exception e) { |
| 198 |
0
|
e.printStackTrace(); |
| 199 |
0
|
fail(); |
| 200 |
|
} |
| 201 |
|
} |
| 202 |
|
|
|
|
|
| 90,5% |
Uncovered Elements: 2 (21) |
Complexity: 2 |
Complexity Density: 0,1 |
1
PASS
|
|
| 203 |
2
|
public void testGetPost() {... |
| 204 |
2
|
try { |
| 205 |
2
|
Category category = new Category("/acategory", "A category"); |
| 206 |
2
|
blog.addCategory(category); |
| 207 |
|
|
| 208 |
2
|
BlogService service = new BlogService(); |
| 209 |
2
|
BlogEntry entry = new BlogEntry(blog); |
| 210 |
2
|
entry.setTitle("title"); |
| 211 |
2
|
entry.setBody("body"); |
| 212 |
2
|
entry.setAuthor("simon"); |
| 213 |
2
|
entry.addCategory(category); |
| 214 |
2
|
service.putBlogEntry(entry); |
| 215 |
|
|
| 216 |
2
|
Hashtable post = handler.getPost("default/" + entry.getId(), "username", "password"); |
| 217 |
2
|
assertEquals("title", post.get(MetaWeblogAPIHandler.TITLE)); |
| 218 |
2
|
assertEquals("body", post.get(MetaWeblogAPIHandler.DESCRIPTION)); |
| 219 |
2
|
Vector categories = (Vector)post.get(MetaWeblogAPIHandler.CATEGORIES); |
| 220 |
2
|
assertEquals(1, categories.size()); |
| 221 |
2
|
assertEquals("/acategory", categories.get(0)); |
| 222 |
2
|
assertEquals(entry.getAuthor(), post.get(MetaWeblogAPIHandler.USER_ID)); |
| 223 |
2
|
assertEquals(entry.getDate(), post.get(MetaWeblogAPIHandler.DATE_CREATED)); |
| 224 |
2
|
assertEquals("default/" + entry.getId(), post.get(MetaWeblogAPIHandler.POST_ID)); |
| 225 |
|
} catch (Exception e) { |
| 226 |
0
|
e.printStackTrace(); |
| 227 |
0
|
fail(); |
| 228 |
|
} |
| 229 |
|
} |
| 230 |
|
|
|
|
|
| 80% |
Uncovered Elements: 1 (5) |
Complexity: 2 |
Complexity Density: 0,4 |
1
PASS
|
|
| 231 |
2
|
public void testGetPostWithIdThatDoesntExist() {... |
| 232 |
2
|
String postid = "1234567890123"; |
| 233 |
2
|
try { |
| 234 |
2
|
handler.getPost("default/" + postid, "username", "password"); |
| 235 |
0
|
fail(); |
| 236 |
|
} catch (XmlRpcException xmlrpce) { |
| 237 |
2
|
assertEquals("Blog entry with ID of " + postid + " was not found.", xmlrpce.getMessage()); |
| 238 |
|
} |
| 239 |
|
} |
| 240 |
|
|
|
|
|
| 80% |
Uncovered Elements: 1 (5) |
Complexity: 2 |
Complexity Density: 0,4 |
1
PASS
|
|
| 241 |
2
|
public void testGetPostWithNullId() {... |
| 242 |
2
|
String postid = null; |
| 243 |
2
|
try { |
| 244 |
2
|
handler.getPost(postid, "username", "password"); |
| 245 |
0
|
fail(); |
| 246 |
|
} catch (XmlRpcException xmlrpce) { |
| 247 |
2
|
assertEquals("Blog with ID of " + null + " not found.", xmlrpce.getMessage()); |
| 248 |
|
} |
| 249 |
|
} |
| 250 |
|
|
|
|
|
| 89,5% |
Uncovered Elements: 2 (19) |
Complexity: 2 |
Complexity Density: 0,11 |
1
PASS
|
|
| 251 |
2
|
public void testNewPost() {... |
| 252 |
2
|
try { |
| 253 |
2
|
Category category = new Category("/acategory", "A category"); |
| 254 |
2
|
blog.addCategory(category); |
| 255 |
2
|
Hashtable struct = new Hashtable(); |
| 256 |
2
|
struct.put(MetaWeblogAPIHandler.TITLE, "Title"); |
| 257 |
2
|
struct.put(MetaWeblogAPIHandler.DESCRIPTION, "<p>Content</p>"); |
| 258 |
2
|
Vector categories = new Vector(); |
| 259 |
2
|
categories.add(category.getId()); |
| 260 |
2
|
struct.put(MetaWeblogAPIHandler.CATEGORIES, categories); |
| 261 |
|
|
| 262 |
2
|
String postid = handler.newPost("default", "username", "password", struct, true); |
| 263 |
|
|
| 264 |
2
|
BlogService service = new BlogService(); |
| 265 |
2
|
BlogEntry entry = service.getBlogEntry(blog, postid.substring("default".length()+1)); |
| 266 |
|
|
| 267 |
2
|
assertEquals("default/" + entry.getId(), postid); |
| 268 |
2
|
assertEquals("Title", entry.getTitle()); |
| 269 |
2
|
assertTrue(entry.inCategory(category)); |
| 270 |
2
|
assertEquals("<p>Content</p>", entry.getBody()); |
| 271 |
2
|
assertEquals("username", entry.getAuthor()); |
| 272 |
|
} catch (Exception e) { |
| 273 |
0
|
e.printStackTrace(); |
| 274 |
0
|
fail(); |
| 275 |
|
} |
| 276 |
|
} |
| 277 |
|
|
| 278 |
|
|
| 279 |
|
|
| 280 |
|
|
| 281 |
|
|
|
|
|
| 88,2% |
Uncovered Elements: 2 (17) |
Complexity: 2 |
Complexity Density: 0,12 |
1
PASS
|
|
| 282 |
2
|
public void testNewPostWithCategoryThatDoesntExist() {... |
| 283 |
2
|
try { |
| 284 |
2
|
Hashtable struct = new Hashtable(); |
| 285 |
2
|
struct.put(MetaWeblogAPIHandler.TITLE, "Title"); |
| 286 |
2
|
struct.put(MetaWeblogAPIHandler.DESCRIPTION, "<p>Content</p>"); |
| 287 |
2
|
Vector categories = new Vector(); |
| 288 |
2
|
categories.add("/someUnknownCategory"); |
| 289 |
2
|
struct.put(MetaWeblogAPIHandler.CATEGORIES, categories); |
| 290 |
|
|
| 291 |
2
|
String postid = handler.newPost("default", "username", "password", struct, true); |
| 292 |
|
|
| 293 |
2
|
BlogService service = new BlogService(); |
| 294 |
2
|
BlogEntry entry = service.getBlogEntry(blog, postid.substring("default".length()+1)); |
| 295 |
|
|
| 296 |
2
|
assertEquals("default/" + entry.getId(), postid); |
| 297 |
2
|
assertEquals("Title", entry.getTitle()); |
| 298 |
2
|
assertEquals(0, entry.getCategories().size()); |
| 299 |
2
|
assertEquals("<p>Content</p>", entry.getBody()); |
| 300 |
2
|
assertEquals("username", entry.getAuthor()); |
| 301 |
|
} catch (Exception e) { |
| 302 |
0
|
e.printStackTrace(); |
| 303 |
0
|
fail(); |
| 304 |
|
} |
| 305 |
|
} |
| 306 |
|
|
|
|
|
| 88,2% |
Uncovered Elements: 2 (17) |
Complexity: 2 |
Complexity Density: 0,12 |
1
PASS
|
|
| 307 |
2
|
public void testEditPost() {... |
| 308 |
2
|
try { |
| 309 |
2
|
BlogService service = new BlogService(); |
| 310 |
2
|
BlogEntry entry = new BlogEntry(blog); |
| 311 |
2
|
entry.setTitle("title"); |
| 312 |
2
|
entry.setBody("body"); |
| 313 |
2
|
service.putBlogEntry(entry); |
| 314 |
|
|
| 315 |
2
|
Hashtable struct = new Hashtable(); |
| 316 |
2
|
struct.put(MetaWeblogAPIHandler.TITLE, "Title"); |
| 317 |
2
|
struct.put(MetaWeblogAPIHandler.DESCRIPTION, "<p>Content</p>"); |
| 318 |
2
|
boolean result = handler.editPost("default/" + entry.getId(), "username", "password", struct, true); |
| 319 |
|
|
| 320 |
2
|
assertTrue(result); |
| 321 |
2
|
entry = service.getBlogEntry(blog, entry.getId()); |
| 322 |
2
|
assertEquals("Title", entry.getTitle()); |
| 323 |
2
|
assertEquals("<p>Content</p>", entry.getBody()); |
| 324 |
2
|
assertEquals("username", entry.getAuthor()); |
| 325 |
|
|
| 326 |
|
} catch (Exception e) { |
| 327 |
0
|
e.printStackTrace(); |
| 328 |
0
|
fail(); |
| 329 |
|
} |
| 330 |
|
} |
| 331 |
|
|
|
|
|
| 80% |
Uncovered Elements: 1 (5) |
Complexity: 2 |
Complexity Density: 0,4 |
1
PASS
|
|
| 332 |
2
|
public void testEditPostWithNullId() {... |
| 333 |
2
|
String postid = null; |
| 334 |
2
|
try { |
| 335 |
2
|
handler.editPost(postid, "username", "password", new Hashtable(), true); |
| 336 |
0
|
fail(); |
| 337 |
|
} catch (XmlRpcException xmlrpce) { |
| 338 |
2
|
assertEquals("Blog with ID of " + postid + " not found.", xmlrpce.getMessage()); |
| 339 |
|
} |
| 340 |
|
} |
| 341 |
|
|
|
|
|
| 80% |
Uncovered Elements: 1 (5) |
Complexity: 2 |
Complexity Density: 0,4 |
1
PASS
|
|
| 342 |
2
|
public void testEditPostWithIdThatDoesntExist() {... |
| 343 |
2
|
String postid = "1234567890123"; |
| 344 |
2
|
try { |
| 345 |
2
|
handler.editPost("default/" + postid, "username", "password", new Hashtable(), true); |
| 346 |
0
|
fail(); |
| 347 |
|
} catch (XmlRpcException xmlrpce) { |
| 348 |
2
|
assertEquals("Blog entry with ID of " + postid + " was not found.", xmlrpce.getMessage()); |
| 349 |
|
} |
| 350 |
|
} |
| 351 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (14) |
Complexity: 1 |
Complexity Density: 0,07 |
1
PASS
|
|
| 352 |
2
|
public void testGetCategories() throws Exception {... |
| 353 |
2
|
Hashtable categories = handler.getCategories("default", "username", "password"); |
| 354 |
2
|
assertEquals(0, categories.size()); |
| 355 |
|
|
| 356 |
2
|
blog.addCategory(new Category("/category1", "Category 1")); |
| 357 |
2
|
blog.addCategory(new Category("/category2", "Category 2")); |
| 358 |
2
|
categories = handler.getCategories("default", "username", "password"); |
| 359 |
2
|
assertTrue(categories.size() == 2); |
| 360 |
2
|
Hashtable struct = (Hashtable)categories.get("/category1"); |
| 361 |
2
|
assertEquals("/category1", struct.get(MetaWeblogAPIHandler.DESCRIPTION)); |
| 362 |
2
|
assertEquals(blog.getUrl() + "categories/category1/", struct.get(MetaWeblogAPIHandler.HTML_URL)); |
| 363 |
2
|
assertEquals(blog.getUrl() + "rss.xml?category=/category1", struct.get(MetaWeblogAPIHandler.RSS_URL)); |
| 364 |
2
|
struct = (Hashtable)categories.get("/category2"); |
| 365 |
2
|
assertEquals("/category2", struct.get(MetaWeblogAPIHandler.DESCRIPTION)); |
| 366 |
2
|
assertEquals(blog.getUrl() + "categories/category2/", struct.get(MetaWeblogAPIHandler.HTML_URL)); |
| 367 |
2
|
assertEquals(blog.getUrl() + "rss.xml?category=/category2", struct.get(MetaWeblogAPIHandler.RSS_URL)); |
| 368 |
|
} |
| 369 |
|
|
|
|
|
| 90,9% |
Uncovered Elements: 2 (22) |
Complexity: 2 |
Complexity Density: 0,09 |
1
PASS
|
|
| 370 |
2
|
public void testNewPostWithAPubDate() {... |
| 371 |
2
|
Calendar cal = blog.getCalendar(); |
| 372 |
2
|
cal.set(Calendar.DAY_OF_MONTH, 14); |
| 373 |
2
|
cal.set(Calendar.MONTH, 6); |
| 374 |
2
|
cal.set(Calendar.YEAR, 2004); |
| 375 |
2
|
try { |
| 376 |
2
|
Category category = new Category("/acategory", "A category"); |
| 377 |
2
|
blog.addCategory(category); |
| 378 |
2
|
Hashtable struct = new Hashtable(); |
| 379 |
2
|
struct.put(MetaWeblogAPIHandler.TITLE, "Title"); |
| 380 |
2
|
struct.put(MetaWeblogAPIHandler.DESCRIPTION, "<p>Content</p>"); |
| 381 |
2
|
struct.put(MetaWeblogAPIHandler.PUB_DATE, cal.getTime()); |
| 382 |
2
|
Vector categories = new Vector(); |
| 383 |
2
|
categories.add(category.getId()); |
| 384 |
2
|
struct.put(MetaWeblogAPIHandler.CATEGORIES, categories); |
| 385 |
|
|
| 386 |
2
|
String postid = handler.newPost("default", "username", "password", struct, true); |
| 387 |
|
|
| 388 |
2
|
BlogService service = new BlogService(); |
| 389 |
2
|
BlogEntry entry = service.getBlogEntry(blog, postid.substring("default".length()+1)); |
| 390 |
|
|
| 391 |
2
|
DateFormat format = new SimpleDateFormat("dd/MM/yyyy"); |
| 392 |
2
|
format.setTimeZone(blog.getTimeZone()); |
| 393 |
2
|
assertEquals("14/07/2004", format.format(entry.getDate())); |
| 394 |
|
} catch (Exception e) { |
| 395 |
0
|
e.printStackTrace(); |
| 396 |
0
|
fail(); |
| 397 |
|
} |
| 398 |
|
} |
| 399 |
|
|
| 400 |
|
} |