target
stringlengths 20
113k
| src_fm
stringlengths 11
86.3k
| src_fm_fc
stringlengths 21
86.4k
| src_fm_fc_co
stringlengths 30
86.4k
| src_fm_fc_ms
stringlengths 42
86.8k
| src_fm_fc_ms_ff
stringlengths 43
86.8k
|
---|---|---|---|---|---|
@Test public void shouldShowMusicWhenExists() { when(dao.load(music)).thenReturn(music); controller.show(music); assertNotNull(result.included().get("music")); assertThat((Music) result.included().get("music"), is(music)); } | @Path("/musics/{music.id}") @Get public void show(Music music) { result.include("music", musicDao.load(music)); } | MusicController { @Path("/musics/{music.id}") @Get public void show(Music music) { result.include("music", musicDao.load(music)); } } | MusicController { @Path("/musics/{music.id}") @Get public void show(Music music) { result.include("music", musicDao.load(music)); } protected MusicController(); @Inject MusicController(MusicDao musicDao, UserInfo userInfo,
Result result, Validator validator, Musics musics, UserDao userDao); } | MusicController { @Path("/musics/{music.id}") @Get public void show(Music music) { result.include("music", musicDao.load(music)); } protected MusicController(); @Inject MusicController(MusicDao musicDao, UserInfo userInfo,
Result result, Validator validator, Musics musics, UserDao userDao); @Path("/musics") @Post void add(final @NotNull @Valid Music music, UploadedFile file); @Path("/musics/{music.id}") @Get void show(Music music); @Get("/musics/search") void search(Music music); @Path("/musics/download/{m.id}") @Get Download download(Music m); @Public @Path("/musics/list/json") void showAllMusicsAsJSON(); @Public @Path("/musics/list/xml") void showAllMusicsAsXML(); @Public @Path("/musics/list/http") void showAllMusicsAsHTTP(); @Public @Path("/musics/list/form") void listForm(); @Public @Path("musics/listAs") void listAs(); } | MusicController { @Path("/musics/{music.id}") @Get public void show(Music music) { result.include("music", musicDao.load(music)); } protected MusicController(); @Inject MusicController(MusicDao musicDao, UserInfo userInfo,
Result result, Validator validator, Musics musics, UserDao userDao); @Path("/musics") @Post void add(final @NotNull @Valid Music music, UploadedFile file); @Path("/musics/{music.id}") @Get void show(Music music); @Get("/musics/search") void search(Music music); @Path("/musics/download/{m.id}") @Get Download download(Music m); @Public @Path("/musics/list/json") void showAllMusicsAsJSON(); @Public @Path("/musics/list/xml") void showAllMusicsAsXML(); @Public @Path("/musics/list/http") void showAllMusicsAsHTTP(); @Public @Path("/musics/list/form") void listForm(); @Public @Path("musics/listAs") void listAs(); } |
@Test public void supportOverrideTypeHttpMethodAnnotation() throws SecurityException, NoSuchMethodException { List<Route> routes = parser.rulesFor(new DefaultBeanClass(AnnotatedController.class)); Route route = getRouteMatching(routes, "/annotated/overridden"); assertThat(route.allowedMethods(), is(EnumSet.of(HttpMethod.GET))); } | @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } | PathAnnotationRoutesParser implements RoutesParser { @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } } | PathAnnotationRoutesParser implements RoutesParser { @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } protected PathAnnotationRoutesParser(); @Inject PathAnnotationRoutesParser(Router router, ReflectionProvider reflectionProvider); } | PathAnnotationRoutesParser implements RoutesParser { @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } protected PathAnnotationRoutesParser(); @Inject PathAnnotationRoutesParser(Router router, ReflectionProvider reflectionProvider); @Override List<Route> rulesFor(BeanClass controller); } | PathAnnotationRoutesParser implements RoutesParser { @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } protected PathAnnotationRoutesParser(); @Inject PathAnnotationRoutesParser(Router router, ReflectionProvider reflectionProvider); @Override List<Route> rulesFor(BeanClass controller); } |
@Test public void strippsContextPath() { when(request.getContextPath()).thenReturn("/myapp"); when(request.getRequestURI()).thenReturn("/myapp/somepage"); assertThat(vraptor.getRequestedUri(), is(equalTo("/somepage"))); } | @Override public String getRequestedUri() { if (getAttribute(INCLUDE_REQUEST_URI) != null) { return (String) getAttribute(INCLUDE_REQUEST_URI); } String uri = getRelativeRequestURI(this); return uri.replaceFirst("(?i);jsessionid=.*$", ""); } | VRaptorRequest extends HttpServletRequestWrapper implements MutableRequest { @Override public String getRequestedUri() { if (getAttribute(INCLUDE_REQUEST_URI) != null) { return (String) getAttribute(INCLUDE_REQUEST_URI); } String uri = getRelativeRequestURI(this); return uri.replaceFirst("(?i);jsessionid=.*$", ""); } } | VRaptorRequest extends HttpServletRequestWrapper implements MutableRequest { @Override public String getRequestedUri() { if (getAttribute(INCLUDE_REQUEST_URI) != null) { return (String) getAttribute(INCLUDE_REQUEST_URI); } String uri = getRelativeRequestURI(this); return uri.replaceFirst("(?i);jsessionid=.*$", ""); } VRaptorRequest(HttpServletRequest request); } | VRaptorRequest extends HttpServletRequestWrapper implements MutableRequest { @Override public String getRequestedUri() { if (getAttribute(INCLUDE_REQUEST_URI) != null) { return (String) getAttribute(INCLUDE_REQUEST_URI); } String uri = getRelativeRequestURI(this); return uri.replaceFirst("(?i);jsessionid=.*$", ""); } VRaptorRequest(HttpServletRequest request); @Override String getParameter(String name); @Override Enumeration<String> getParameterNames(); @Override String[] getParameterValues(String name); @Override Map<String, String[]> getParameterMap(); @Override void setParameter(String key, String... value); @Override String getRequestedUri(); static String getRelativeRequestURI(HttpServletRequest request); @Override String toString(); } | VRaptorRequest extends HttpServletRequestWrapper implements MutableRequest { @Override public String getRequestedUri() { if (getAttribute(INCLUDE_REQUEST_URI) != null) { return (String) getAttribute(INCLUDE_REQUEST_URI); } String uri = getRelativeRequestURI(this); return uri.replaceFirst("(?i);jsessionid=.*$", ""); } VRaptorRequest(HttpServletRequest request); @Override String getParameter(String name); @Override Enumeration<String> getParameterNames(); @Override String[] getParameterValues(String name); @Override Map<String, String[]> getParameterMap(); @Override void setParameter(String key, String... value); @Override String getRequestedUri(); static String getRelativeRequestURI(HttpServletRequest request); @Override String toString(); } |
@Test public void shouldNotShowMusicWhenDoesNotExists() { when(dao.load(music)).thenReturn(null); controller.show(music); assertNull(result.included().get("music")); } | @Path("/musics/{music.id}") @Get public void show(Music music) { result.include("music", musicDao.load(music)); } | MusicController { @Path("/musics/{music.id}") @Get public void show(Music music) { result.include("music", musicDao.load(music)); } } | MusicController { @Path("/musics/{music.id}") @Get public void show(Music music) { result.include("music", musicDao.load(music)); } protected MusicController(); @Inject MusicController(MusicDao musicDao, UserInfo userInfo,
Result result, Validator validator, Musics musics, UserDao userDao); } | MusicController { @Path("/musics/{music.id}") @Get public void show(Music music) { result.include("music", musicDao.load(music)); } protected MusicController(); @Inject MusicController(MusicDao musicDao, UserInfo userInfo,
Result result, Validator validator, Musics musics, UserDao userDao); @Path("/musics") @Post void add(final @NotNull @Valid Music music, UploadedFile file); @Path("/musics/{music.id}") @Get void show(Music music); @Get("/musics/search") void search(Music music); @Path("/musics/download/{m.id}") @Get Download download(Music m); @Public @Path("/musics/list/json") void showAllMusicsAsJSON(); @Public @Path("/musics/list/xml") void showAllMusicsAsXML(); @Public @Path("/musics/list/http") void showAllMusicsAsHTTP(); @Public @Path("/musics/list/form") void listForm(); @Public @Path("musics/listAs") void listAs(); } | MusicController { @Path("/musics/{music.id}") @Get public void show(Music music) { result.include("music", musicDao.load(music)); } protected MusicController(); @Inject MusicController(MusicDao musicDao, UserInfo userInfo,
Result result, Validator validator, Musics musics, UserDao userDao); @Path("/musics") @Post void add(final @NotNull @Valid Music music, UploadedFile file); @Path("/musics/{music.id}") @Get void show(Music music); @Get("/musics/search") void search(Music music); @Path("/musics/download/{m.id}") @Get Download download(Music m); @Public @Path("/musics/list/json") void showAllMusicsAsJSON(); @Public @Path("/musics/list/xml") void showAllMusicsAsXML(); @Public @Path("/musics/list/http") void showAllMusicsAsHTTP(); @Public @Path("/musics/list/form") void listForm(); @Public @Path("musics/listAs") void listAs(); } |
@SuppressWarnings("unchecked") @Test public void shouldReturnMusicList() { when(dao.searchSimilarTitle(music.getTitle())).thenReturn(Arrays.asList(music)); controller.search(music); assertThat((List<Music>) result.included().get("musics"), contains(music)); } | @Get("/musics/search") public void search(Music music) { String title = MoreObjects.firstNonNull(music.getTitle(), ""); result.include("musics", this.musicDao.searchSimilarTitle(title)); } | MusicController { @Get("/musics/search") public void search(Music music) { String title = MoreObjects.firstNonNull(music.getTitle(), ""); result.include("musics", this.musicDao.searchSimilarTitle(title)); } } | MusicController { @Get("/musics/search") public void search(Music music) { String title = MoreObjects.firstNonNull(music.getTitle(), ""); result.include("musics", this.musicDao.searchSimilarTitle(title)); } protected MusicController(); @Inject MusicController(MusicDao musicDao, UserInfo userInfo,
Result result, Validator validator, Musics musics, UserDao userDao); } | MusicController { @Get("/musics/search") public void search(Music music) { String title = MoreObjects.firstNonNull(music.getTitle(), ""); result.include("musics", this.musicDao.searchSimilarTitle(title)); } protected MusicController(); @Inject MusicController(MusicDao musicDao, UserInfo userInfo,
Result result, Validator validator, Musics musics, UserDao userDao); @Path("/musics") @Post void add(final @NotNull @Valid Music music, UploadedFile file); @Path("/musics/{music.id}") @Get void show(Music music); @Get("/musics/search") void search(Music music); @Path("/musics/download/{m.id}") @Get Download download(Music m); @Public @Path("/musics/list/json") void showAllMusicsAsJSON(); @Public @Path("/musics/list/xml") void showAllMusicsAsXML(); @Public @Path("/musics/list/http") void showAllMusicsAsHTTP(); @Public @Path("/musics/list/form") void listForm(); @Public @Path("musics/listAs") void listAs(); } | MusicController { @Get("/musics/search") public void search(Music music) { String title = MoreObjects.firstNonNull(music.getTitle(), ""); result.include("musics", this.musicDao.searchSimilarTitle(title)); } protected MusicController(); @Inject MusicController(MusicDao musicDao, UserInfo userInfo,
Result result, Validator validator, Musics musics, UserDao userDao); @Path("/musics") @Post void add(final @NotNull @Valid Music music, UploadedFile file); @Path("/musics/{music.id}") @Get void show(Music music); @Get("/musics/search") void search(Music music); @Path("/musics/download/{m.id}") @Get Download download(Music m); @Public @Path("/musics/list/json") void showAllMusicsAsJSON(); @Public @Path("/musics/list/xml") void showAllMusicsAsXML(); @Public @Path("/musics/list/http") void showAllMusicsAsHTTP(); @Public @Path("/musics/list/form") void listForm(); @Public @Path("musics/listAs") void listAs(); } |
@SuppressWarnings("unchecked") @Test public void shouldReturnEmptyList() { when(dao.searchSimilarTitle(music.getTitle())).thenReturn(new ArrayList<Music>()); controller.search(music); List<Music> musics = (List<Music>) result.included().get("musics"); assertThat(musics, empty()); } | @Get("/musics/search") public void search(Music music) { String title = MoreObjects.firstNonNull(music.getTitle(), ""); result.include("musics", this.musicDao.searchSimilarTitle(title)); } | MusicController { @Get("/musics/search") public void search(Music music) { String title = MoreObjects.firstNonNull(music.getTitle(), ""); result.include("musics", this.musicDao.searchSimilarTitle(title)); } } | MusicController { @Get("/musics/search") public void search(Music music) { String title = MoreObjects.firstNonNull(music.getTitle(), ""); result.include("musics", this.musicDao.searchSimilarTitle(title)); } protected MusicController(); @Inject MusicController(MusicDao musicDao, UserInfo userInfo,
Result result, Validator validator, Musics musics, UserDao userDao); } | MusicController { @Get("/musics/search") public void search(Music music) { String title = MoreObjects.firstNonNull(music.getTitle(), ""); result.include("musics", this.musicDao.searchSimilarTitle(title)); } protected MusicController(); @Inject MusicController(MusicDao musicDao, UserInfo userInfo,
Result result, Validator validator, Musics musics, UserDao userDao); @Path("/musics") @Post void add(final @NotNull @Valid Music music, UploadedFile file); @Path("/musics/{music.id}") @Get void show(Music music); @Get("/musics/search") void search(Music music); @Path("/musics/download/{m.id}") @Get Download download(Music m); @Public @Path("/musics/list/json") void showAllMusicsAsJSON(); @Public @Path("/musics/list/xml") void showAllMusicsAsXML(); @Public @Path("/musics/list/http") void showAllMusicsAsHTTP(); @Public @Path("/musics/list/form") void listForm(); @Public @Path("musics/listAs") void listAs(); } | MusicController { @Get("/musics/search") public void search(Music music) { String title = MoreObjects.firstNonNull(music.getTitle(), ""); result.include("musics", this.musicDao.searchSimilarTitle(title)); } protected MusicController(); @Inject MusicController(MusicDao musicDao, UserInfo userInfo,
Result result, Validator validator, Musics musics, UserDao userDao); @Path("/musics") @Post void add(final @NotNull @Valid Music music, UploadedFile file); @Path("/musics/{music.id}") @Get void show(Music music); @Get("/musics/search") void search(Music music); @Path("/musics/download/{m.id}") @Get Download download(Music m); @Public @Path("/musics/list/json") void showAllMusicsAsJSON(); @Public @Path("/musics/list/xml") void showAllMusicsAsXML(); @Public @Path("/musics/list/http") void showAllMusicsAsHTTP(); @Public @Path("/musics/list/form") void listForm(); @Public @Path("musics/listAs") void listAs(); } |
@Test public void shouldNotDownloadMusicWhenDoesNotExist() { when(dao.load(music)).thenReturn(music); when(musics.getFile(music)).thenReturn(new File("/tmp/uploads/Music_" + music.getId() + ".mp3")); try { controller.download(music); fail("Should throw an exception."); } catch (FileNotFoundException e) { verify(musics).getFile(music); } } | @Path("/musics/download/{m.id}") @Get public Download download(Music m) throws FileNotFoundException { Music music = musicDao.load(m); File file = musics.getFile(music); String contentType = "audio/mpeg"; String filename = music.getTitle() + ".mp3"; return new FileDownload(file, contentType, filename); } | MusicController { @Path("/musics/download/{m.id}") @Get public Download download(Music m) throws FileNotFoundException { Music music = musicDao.load(m); File file = musics.getFile(music); String contentType = "audio/mpeg"; String filename = music.getTitle() + ".mp3"; return new FileDownload(file, contentType, filename); } } | MusicController { @Path("/musics/download/{m.id}") @Get public Download download(Music m) throws FileNotFoundException { Music music = musicDao.load(m); File file = musics.getFile(music); String contentType = "audio/mpeg"; String filename = music.getTitle() + ".mp3"; return new FileDownload(file, contentType, filename); } protected MusicController(); @Inject MusicController(MusicDao musicDao, UserInfo userInfo,
Result result, Validator validator, Musics musics, UserDao userDao); } | MusicController { @Path("/musics/download/{m.id}") @Get public Download download(Music m) throws FileNotFoundException { Music music = musicDao.load(m); File file = musics.getFile(music); String contentType = "audio/mpeg"; String filename = music.getTitle() + ".mp3"; return new FileDownload(file, contentType, filename); } protected MusicController(); @Inject MusicController(MusicDao musicDao, UserInfo userInfo,
Result result, Validator validator, Musics musics, UserDao userDao); @Path("/musics") @Post void add(final @NotNull @Valid Music music, UploadedFile file); @Path("/musics/{music.id}") @Get void show(Music music); @Get("/musics/search") void search(Music music); @Path("/musics/download/{m.id}") @Get Download download(Music m); @Public @Path("/musics/list/json") void showAllMusicsAsJSON(); @Public @Path("/musics/list/xml") void showAllMusicsAsXML(); @Public @Path("/musics/list/http") void showAllMusicsAsHTTP(); @Public @Path("/musics/list/form") void listForm(); @Public @Path("musics/listAs") void listAs(); } | MusicController { @Path("/musics/download/{m.id}") @Get public Download download(Music m) throws FileNotFoundException { Music music = musicDao.load(m); File file = musics.getFile(music); String contentType = "audio/mpeg"; String filename = music.getTitle() + ".mp3"; return new FileDownload(file, contentType, filename); } protected MusicController(); @Inject MusicController(MusicDao musicDao, UserInfo userInfo,
Result result, Validator validator, Musics musics, UserDao userDao); @Path("/musics") @Post void add(final @NotNull @Valid Music music, UploadedFile file); @Path("/musics/{music.id}") @Get void show(Music music); @Get("/musics/search") void search(Music music); @Path("/musics/download/{m.id}") @Get Download download(Music m); @Public @Path("/musics/list/json") void showAllMusicsAsJSON(); @Public @Path("/musics/list/xml") void showAllMusicsAsXML(); @Public @Path("/musics/list/http") void showAllMusicsAsHTTP(); @Public @Path("/musics/list/form") void listForm(); @Public @Path("musics/listAs") void listAs(); } |
@Test public void shouldShowAllMusicsAsJSON() throws Exception { when(dao.listAll()).thenReturn(Arrays.asList(music)); controller.showAllMusicsAsJSON(); assertThat(result.serializedResult(), is("{\"list\":[{\"id\":1,\"title\":\"Some Music\"," + "\"description\":\"Some description\",\"type\":\"ROCK\"}]}")); } | @Public @Path("/musics/list/json") public void showAllMusicsAsJSON() { result.use(json()).from(musicDao.listAll()).serialize(); } | MusicController { @Public @Path("/musics/list/json") public void showAllMusicsAsJSON() { result.use(json()).from(musicDao.listAll()).serialize(); } } | MusicController { @Public @Path("/musics/list/json") public void showAllMusicsAsJSON() { result.use(json()).from(musicDao.listAll()).serialize(); } protected MusicController(); @Inject MusicController(MusicDao musicDao, UserInfo userInfo,
Result result, Validator validator, Musics musics, UserDao userDao); } | MusicController { @Public @Path("/musics/list/json") public void showAllMusicsAsJSON() { result.use(json()).from(musicDao.listAll()).serialize(); } protected MusicController(); @Inject MusicController(MusicDao musicDao, UserInfo userInfo,
Result result, Validator validator, Musics musics, UserDao userDao); @Path("/musics") @Post void add(final @NotNull @Valid Music music, UploadedFile file); @Path("/musics/{music.id}") @Get void show(Music music); @Get("/musics/search") void search(Music music); @Path("/musics/download/{m.id}") @Get Download download(Music m); @Public @Path("/musics/list/json") void showAllMusicsAsJSON(); @Public @Path("/musics/list/xml") void showAllMusicsAsXML(); @Public @Path("/musics/list/http") void showAllMusicsAsHTTP(); @Public @Path("/musics/list/form") void listForm(); @Public @Path("musics/listAs") void listAs(); } | MusicController { @Public @Path("/musics/list/json") public void showAllMusicsAsJSON() { result.use(json()).from(musicDao.listAll()).serialize(); } protected MusicController(); @Inject MusicController(MusicDao musicDao, UserInfo userInfo,
Result result, Validator validator, Musics musics, UserDao userDao); @Path("/musics") @Post void add(final @NotNull @Valid Music music, UploadedFile file); @Path("/musics/{music.id}") @Get void show(Music music); @Get("/musics/search") void search(Music music); @Path("/musics/download/{m.id}") @Get Download download(Music m); @Public @Path("/musics/list/json") void showAllMusicsAsJSON(); @Public @Path("/musics/list/xml") void showAllMusicsAsXML(); @Public @Path("/musics/list/http") void showAllMusicsAsHTTP(); @Public @Path("/musics/list/form") void listForm(); @Public @Path("musics/listAs") void listAs(); } |
@Test public void shouldShowAllMusicsAsXML() throws Exception { when(dao.listAll()).thenReturn(Arrays.asList(music)); controller.showAllMusicsAsXML(); assertThat(result.serializedResult(), is("<list><music><id>1</id><title>Some Music</title><description>Some description</description><type>ROCK</type></music></list>")); } | @Public @Path("/musics/list/xml") public void showAllMusicsAsXML() { result.use(xml()).from(musicDao.listAll()).serialize(); } | MusicController { @Public @Path("/musics/list/xml") public void showAllMusicsAsXML() { result.use(xml()).from(musicDao.listAll()).serialize(); } } | MusicController { @Public @Path("/musics/list/xml") public void showAllMusicsAsXML() { result.use(xml()).from(musicDao.listAll()).serialize(); } protected MusicController(); @Inject MusicController(MusicDao musicDao, UserInfo userInfo,
Result result, Validator validator, Musics musics, UserDao userDao); } | MusicController { @Public @Path("/musics/list/xml") public void showAllMusicsAsXML() { result.use(xml()).from(musicDao.listAll()).serialize(); } protected MusicController(); @Inject MusicController(MusicDao musicDao, UserInfo userInfo,
Result result, Validator validator, Musics musics, UserDao userDao); @Path("/musics") @Post void add(final @NotNull @Valid Music music, UploadedFile file); @Path("/musics/{music.id}") @Get void show(Music music); @Get("/musics/search") void search(Music music); @Path("/musics/download/{m.id}") @Get Download download(Music m); @Public @Path("/musics/list/json") void showAllMusicsAsJSON(); @Public @Path("/musics/list/xml") void showAllMusicsAsXML(); @Public @Path("/musics/list/http") void showAllMusicsAsHTTP(); @Public @Path("/musics/list/form") void listForm(); @Public @Path("musics/listAs") void listAs(); } | MusicController { @Public @Path("/musics/list/xml") public void showAllMusicsAsXML() { result.use(xml()).from(musicDao.listAll()).serialize(); } protected MusicController(); @Inject MusicController(MusicDao musicDao, UserInfo userInfo,
Result result, Validator validator, Musics musics, UserDao userDao); @Path("/musics") @Post void add(final @NotNull @Valid Music music, UploadedFile file); @Path("/musics/{music.id}") @Get void show(Music music); @Get("/musics/search") void search(Music music); @Path("/musics/download/{m.id}") @Get Download download(Music m); @Public @Path("/musics/list/json") void showAllMusicsAsJSON(); @Public @Path("/musics/list/xml") void showAllMusicsAsXML(); @Public @Path("/musics/list/http") void showAllMusicsAsHTTP(); @Public @Path("/musics/list/form") void listForm(); @Public @Path("musics/listAs") void listAs(); } |
@Test public void shouldShowAllMusicsAsHTTP() { MockHttpResult mockHttpResult = new MockHttpResult(); controller = new MusicController(dao, userInfo, mockHttpResult, validator, musics, userDao); when(dao.listAll()).thenReturn(Arrays.asList(music)); controller.showAllMusicsAsHTTP(); assertThat(mockHttpResult.getBody(), is("<p class=\"content\">"+ Arrays.asList(music).toString()+"</p>")); } | @Public @Path("/musics/list/http") public void showAllMusicsAsHTTP() { result.use(http()).body("<p class=\"content\">"+ musicDao.listAll().toString()+"</p>"); } | MusicController { @Public @Path("/musics/list/http") public void showAllMusicsAsHTTP() { result.use(http()).body("<p class=\"content\">"+ musicDao.listAll().toString()+"</p>"); } } | MusicController { @Public @Path("/musics/list/http") public void showAllMusicsAsHTTP() { result.use(http()).body("<p class=\"content\">"+ musicDao.listAll().toString()+"</p>"); } protected MusicController(); @Inject MusicController(MusicDao musicDao, UserInfo userInfo,
Result result, Validator validator, Musics musics, UserDao userDao); } | MusicController { @Public @Path("/musics/list/http") public void showAllMusicsAsHTTP() { result.use(http()).body("<p class=\"content\">"+ musicDao.listAll().toString()+"</p>"); } protected MusicController(); @Inject MusicController(MusicDao musicDao, UserInfo userInfo,
Result result, Validator validator, Musics musics, UserDao userDao); @Path("/musics") @Post void add(final @NotNull @Valid Music music, UploadedFile file); @Path("/musics/{music.id}") @Get void show(Music music); @Get("/musics/search") void search(Music music); @Path("/musics/download/{m.id}") @Get Download download(Music m); @Public @Path("/musics/list/json") void showAllMusicsAsJSON(); @Public @Path("/musics/list/xml") void showAllMusicsAsXML(); @Public @Path("/musics/list/http") void showAllMusicsAsHTTP(); @Public @Path("/musics/list/form") void listForm(); @Public @Path("musics/listAs") void listAs(); } | MusicController { @Public @Path("/musics/list/http") public void showAllMusicsAsHTTP() { result.use(http()).body("<p class=\"content\">"+ musicDao.listAll().toString()+"</p>"); } protected MusicController(); @Inject MusicController(MusicDao musicDao, UserInfo userInfo,
Result result, Validator validator, Musics musics, UserDao userDao); @Path("/musics") @Post void add(final @NotNull @Valid Music music, UploadedFile file); @Path("/musics/{music.id}") @Get void show(Music music); @Get("/musics/search") void search(Music music); @Path("/musics/download/{m.id}") @Get Download download(Music m); @Public @Path("/musics/list/json") void showAllMusicsAsJSON(); @Public @Path("/musics/list/xml") void showAllMusicsAsXML(); @Public @Path("/musics/list/http") void showAllMusicsAsHTTP(); @Public @Path("/musics/list/form") void listForm(); @Public @Path("musics/listAs") void listAs(); } |
@Test public void shouldListAs() throws Exception { when(dao.listAll()).thenReturn(Arrays.asList(music)); controller.listAs(); assertThat(result.serializedResult(), is("<list><music><id>1</id><title>Some Music</title><description>Some description</description><type>ROCK</type></music></list>")); } | @Public @Path("musics/listAs") public void listAs() { result.use(representation()) .from(musicDao.listAll()).serialize(); } | MusicController { @Public @Path("musics/listAs") public void listAs() { result.use(representation()) .from(musicDao.listAll()).serialize(); } } | MusicController { @Public @Path("musics/listAs") public void listAs() { result.use(representation()) .from(musicDao.listAll()).serialize(); } protected MusicController(); @Inject MusicController(MusicDao musicDao, UserInfo userInfo,
Result result, Validator validator, Musics musics, UserDao userDao); } | MusicController { @Public @Path("musics/listAs") public void listAs() { result.use(representation()) .from(musicDao.listAll()).serialize(); } protected MusicController(); @Inject MusicController(MusicDao musicDao, UserInfo userInfo,
Result result, Validator validator, Musics musics, UserDao userDao); @Path("/musics") @Post void add(final @NotNull @Valid Music music, UploadedFile file); @Path("/musics/{music.id}") @Get void show(Music music); @Get("/musics/search") void search(Music music); @Path("/musics/download/{m.id}") @Get Download download(Music m); @Public @Path("/musics/list/json") void showAllMusicsAsJSON(); @Public @Path("/musics/list/xml") void showAllMusicsAsXML(); @Public @Path("/musics/list/http") void showAllMusicsAsHTTP(); @Public @Path("/musics/list/form") void listForm(); @Public @Path("musics/listAs") void listAs(); } | MusicController { @Public @Path("musics/listAs") public void listAs() { result.use(representation()) .from(musicDao.listAll()).serialize(); } protected MusicController(); @Inject MusicController(MusicDao musicDao, UserInfo userInfo,
Result result, Validator validator, Musics musics, UserDao userDao); @Path("/musics") @Post void add(final @NotNull @Valid Music music, UploadedFile file); @Path("/musics/{music.id}") @Get void show(Music music); @Get("/musics/search") void search(Music music); @Path("/musics/download/{m.id}") @Get Download download(Music m); @Public @Path("/musics/list/json") void showAllMusicsAsJSON(); @Public @Path("/musics/list/xml") void showAllMusicsAsXML(); @Public @Path("/musics/list/http") void showAllMusicsAsHTTP(); @Public @Path("/musics/list/form") void listForm(); @Public @Path("musics/listAs") void listAs(); } |
@Test public void addsAPrefixToMethodsWhenTheGetControllerAndTheMethodAreAnnotatedWithRelativePath() throws Exception { List<Route> routes = parser.rulesFor(new DefaultBeanClass(GetAnnotatedController.class)); Route route = getRouteMatching(routes, "/prefix/relativePath"); assertThat(route, canHandle(GetAnnotatedController.class, "withRelativePath")); } | @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } | PathAnnotationRoutesParser implements RoutesParser { @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } } | PathAnnotationRoutesParser implements RoutesParser { @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } protected PathAnnotationRoutesParser(); @Inject PathAnnotationRoutesParser(Router router, ReflectionProvider reflectionProvider); } | PathAnnotationRoutesParser implements RoutesParser { @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } protected PathAnnotationRoutesParser(); @Inject PathAnnotationRoutesParser(Router router, ReflectionProvider reflectionProvider); @Override List<Route> rulesFor(BeanClass controller); } | PathAnnotationRoutesParser implements RoutesParser { @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } protected PathAnnotationRoutesParser(); @Inject PathAnnotationRoutesParser(Router router, ReflectionProvider reflectionProvider); @Override List<Route> rulesFor(BeanClass controller); } |
@Test public void priorityForGetAnnotationShouldBeDefault() throws Exception { List<Route> routes = parser.rulesFor(new DefaultBeanClass(GetAnnotatedController.class)); Route route = getRouteMatching(routes, "/prefix/relativePath"); assertThat(route.getPriority(), is(Path.DEFAULT)); } | @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } | PathAnnotationRoutesParser implements RoutesParser { @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } } | PathAnnotationRoutesParser implements RoutesParser { @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } protected PathAnnotationRoutesParser(); @Inject PathAnnotationRoutesParser(Router router, ReflectionProvider reflectionProvider); } | PathAnnotationRoutesParser implements RoutesParser { @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } protected PathAnnotationRoutesParser(); @Inject PathAnnotationRoutesParser(Router router, ReflectionProvider reflectionProvider); @Override List<Route> rulesFor(BeanClass controller); } | PathAnnotationRoutesParser implements RoutesParser { @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } protected PathAnnotationRoutesParser(); @Inject PathAnnotationRoutesParser(Router router, ReflectionProvider reflectionProvider); @Override List<Route> rulesFor(BeanClass controller); } |
@Test public void addsAPrefixToMethodsWhenTheGetControllerEndsWithSlashAndTheMethodAreAnnotatedWithRelativePath() throws Exception { List<Route> routes = parser.rulesFor(new DefaultBeanClass(EndSlashAnnotatedGetController.class)); Route route = getRouteMatching(routes, "/endSlash/relativePath"); assertThat(route, canHandle(EndSlashAnnotatedGetController.class, "withRelativePath")); } | @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } | PathAnnotationRoutesParser implements RoutesParser { @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } } | PathAnnotationRoutesParser implements RoutesParser { @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } protected PathAnnotationRoutesParser(); @Inject PathAnnotationRoutesParser(Router router, ReflectionProvider reflectionProvider); } | PathAnnotationRoutesParser implements RoutesParser { @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } protected PathAnnotationRoutesParser(); @Inject PathAnnotationRoutesParser(Router router, ReflectionProvider reflectionProvider); @Override List<Route> rulesFor(BeanClass controller); } | PathAnnotationRoutesParser implements RoutesParser { @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } protected PathAnnotationRoutesParser(); @Inject PathAnnotationRoutesParser(Router router, ReflectionProvider reflectionProvider); @Override List<Route> rulesFor(BeanClass controller); } |
@Test public void addsAPrefixToMethodsWhenTheGetControllerEndsWithSlashAndTheMethodAreAnnotatedWithAbsolutePath() throws Exception { List<Route> routes = parser.rulesFor(new DefaultBeanClass(EndSlashAnnotatedGetController.class)); Route route = getRouteMatching(routes, "/endSlash/absolutePath"); assertThat(route, canHandle(EndSlashAnnotatedGetController.class, "withAbsolutePath")); } | @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } | PathAnnotationRoutesParser implements RoutesParser { @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } } | PathAnnotationRoutesParser implements RoutesParser { @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } protected PathAnnotationRoutesParser(); @Inject PathAnnotationRoutesParser(Router router, ReflectionProvider reflectionProvider); } | PathAnnotationRoutesParser implements RoutesParser { @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } protected PathAnnotationRoutesParser(); @Inject PathAnnotationRoutesParser(Router router, ReflectionProvider reflectionProvider); @Override List<Route> rulesFor(BeanClass controller); } | PathAnnotationRoutesParser implements RoutesParser { @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } protected PathAnnotationRoutesParser(); @Inject PathAnnotationRoutesParser(Router router, ReflectionProvider reflectionProvider); @Override List<Route> rulesFor(BeanClass controller); } |
@Test public void addsAPrefixToMethodsWhenTheGetControllerAndTheMethodAreAnnotatedWithAbsolutePath() throws Exception { List<Route> routes = parser.rulesFor(new DefaultBeanClass(GetAnnotatedController.class)); Route route = getRouteMatching(routes, "/prefix/absolutePath"); assertThat(route, canHandle(GetAnnotatedController.class, "withAbsolutePath")); } | @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } | PathAnnotationRoutesParser implements RoutesParser { @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } } | PathAnnotationRoutesParser implements RoutesParser { @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } protected PathAnnotationRoutesParser(); @Inject PathAnnotationRoutesParser(Router router, ReflectionProvider reflectionProvider); } | PathAnnotationRoutesParser implements RoutesParser { @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } protected PathAnnotationRoutesParser(); @Inject PathAnnotationRoutesParser(Router router, ReflectionProvider reflectionProvider); @Override List<Route> rulesFor(BeanClass controller); } | PathAnnotationRoutesParser implements RoutesParser { @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } protected PathAnnotationRoutesParser(); @Inject PathAnnotationRoutesParser(Router router, ReflectionProvider reflectionProvider); @Override List<Route> rulesFor(BeanClass controller); } |
@Test public void addsAPrefixToMethodsWhenTheGetControllerIsAnnotatedWithPath() throws Exception { List<Route> routes = parser.rulesFor(new DefaultBeanClass(GetAnnotatedController.class)); Route route = getRouteMatching(routes, "/prefix/withoutPath"); assertThat(route, canHandle(GetAnnotatedController.class, "withoutPath")); } | @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } | PathAnnotationRoutesParser implements RoutesParser { @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } } | PathAnnotationRoutesParser implements RoutesParser { @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } protected PathAnnotationRoutesParser(); @Inject PathAnnotationRoutesParser(Router router, ReflectionProvider reflectionProvider); } | PathAnnotationRoutesParser implements RoutesParser { @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } protected PathAnnotationRoutesParser(); @Inject PathAnnotationRoutesParser(Router router, ReflectionProvider reflectionProvider); @Override List<Route> rulesFor(BeanClass controller); } | PathAnnotationRoutesParser implements RoutesParser { @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } protected PathAnnotationRoutesParser(); @Inject PathAnnotationRoutesParser(Router router, ReflectionProvider reflectionProvider); @Override List<Route> rulesFor(BeanClass controller); } |
@Test public void throwsExceptionWhenTheGetControllerHasAmbiguousDeclaration() throws Exception { exception.expect(IllegalArgumentException.class); exception.expectMessage("You should specify paths either in @Path(\"/path\") or @Get(\"/path\") (or @Post, @Put, @Delete), not both at"); parser.rulesFor(new DefaultBeanClass(WrongGetAnnotatedController.class)); } | @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } | PathAnnotationRoutesParser implements RoutesParser { @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } } | PathAnnotationRoutesParser implements RoutesParser { @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } protected PathAnnotationRoutesParser(); @Inject PathAnnotationRoutesParser(Router router, ReflectionProvider reflectionProvider); } | PathAnnotationRoutesParser implements RoutesParser { @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } protected PathAnnotationRoutesParser(); @Inject PathAnnotationRoutesParser(Router router, ReflectionProvider reflectionProvider); @Override List<Route> rulesFor(BeanClass controller); } | PathAnnotationRoutesParser implements RoutesParser { @Override public List<Route> rulesFor(BeanClass controller) { Class<?> baseType = controller.getType(); return registerRulesFor(baseType); } protected PathAnnotationRoutesParser(); @Inject PathAnnotationRoutesParser(Router router, ReflectionProvider reflectionProvider); @Override List<Route> rulesFor(BeanClass controller); } |
@Test public void allowsAdditionOfRouteBuildersByDefaultWithNoStrategy() { exception.expect(IllegalRouteException.class); new Rules(router) { @Override public void routes() { routeFor(""); } }; } | protected final RouteBuilder routeFor(String uri) { RouteBuilder rule = router.builderFor(uri); rule.withPriority(Integer.MIN_VALUE); this.routesToBuild.add(rule); return rule; } | Rules { protected final RouteBuilder routeFor(String uri) { RouteBuilder rule = router.builderFor(uri); rule.withPriority(Integer.MIN_VALUE); this.routesToBuild.add(rule); return rule; } } | Rules { protected final RouteBuilder routeFor(String uri) { RouteBuilder rule = router.builderFor(uri); rule.withPriority(Integer.MIN_VALUE); this.routesToBuild.add(rule); return rule; } Rules(Router router); } | Rules { protected final RouteBuilder routeFor(String uri) { RouteBuilder rule = router.builderFor(uri); rule.withPriority(Integer.MIN_VALUE); this.routesToBuild.add(rule); return rule; } Rules(Router router); abstract void routes(); } | Rules { protected final RouteBuilder routeFor(String uri) { RouteBuilder rule = router.builderFor(uri); rule.withPriority(Integer.MIN_VALUE); this.routesToBuild.add(rule); return rule; } Rules(Router router); abstract void routes(); } |
@Test public void shouldInvokeAGetter() { assertThat((Long) evaluator.get(client(1L), "client.id"), is(equalTo(1L))); } | @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } | JavaEvaluator implements Evaluator { @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } } | JavaEvaluator implements Evaluator { @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } protected JavaEvaluator(); @Inject JavaEvaluator(ReflectionProvider reflectionProvider); } | JavaEvaluator implements Evaluator { @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } protected JavaEvaluator(); @Inject JavaEvaluator(ReflectionProvider reflectionProvider); @Override Object get(Object root, String path); } | JavaEvaluator implements Evaluator { @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } protected JavaEvaluator(); @Inject JavaEvaluator(ReflectionProvider reflectionProvider); @Override Object get(Object root, String path); } |
@Test public void shouldInvokeAIs() { Client c = client(1L); c.ugly=true; assertThat((Boolean) evaluator.get(c, "client.ugly"), is(equalTo(true))); } | @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } | JavaEvaluator implements Evaluator { @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } } | JavaEvaluator implements Evaluator { @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } protected JavaEvaluator(); @Inject JavaEvaluator(ReflectionProvider reflectionProvider); } | JavaEvaluator implements Evaluator { @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } protected JavaEvaluator(); @Inject JavaEvaluator(ReflectionProvider reflectionProvider); @Override Object get(Object root, String path); } | JavaEvaluator implements Evaluator { @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } protected JavaEvaluator(); @Inject JavaEvaluator(ReflectionProvider reflectionProvider); @Override Object get(Object root, String path); } |
@Test public void strippsRootContextPath() { when(request.getContextPath()).thenReturn("/"); when(request.getRequestURI()).thenReturn("/somepage"); assertThat(vraptor.getRequestedUri(), is(equalTo("/somepage"))); } | @Override public String getRequestedUri() { if (getAttribute(INCLUDE_REQUEST_URI) != null) { return (String) getAttribute(INCLUDE_REQUEST_URI); } String uri = getRelativeRequestURI(this); return uri.replaceFirst("(?i);jsessionid=.*$", ""); } | VRaptorRequest extends HttpServletRequestWrapper implements MutableRequest { @Override public String getRequestedUri() { if (getAttribute(INCLUDE_REQUEST_URI) != null) { return (String) getAttribute(INCLUDE_REQUEST_URI); } String uri = getRelativeRequestURI(this); return uri.replaceFirst("(?i);jsessionid=.*$", ""); } } | VRaptorRequest extends HttpServletRequestWrapper implements MutableRequest { @Override public String getRequestedUri() { if (getAttribute(INCLUDE_REQUEST_URI) != null) { return (String) getAttribute(INCLUDE_REQUEST_URI); } String uri = getRelativeRequestURI(this); return uri.replaceFirst("(?i);jsessionid=.*$", ""); } VRaptorRequest(HttpServletRequest request); } | VRaptorRequest extends HttpServletRequestWrapper implements MutableRequest { @Override public String getRequestedUri() { if (getAttribute(INCLUDE_REQUEST_URI) != null) { return (String) getAttribute(INCLUDE_REQUEST_URI); } String uri = getRelativeRequestURI(this); return uri.replaceFirst("(?i);jsessionid=.*$", ""); } VRaptorRequest(HttpServletRequest request); @Override String getParameter(String name); @Override Enumeration<String> getParameterNames(); @Override String[] getParameterValues(String name); @Override Map<String, String[]> getParameterMap(); @Override void setParameter(String key, String... value); @Override String getRequestedUri(); static String getRelativeRequestURI(HttpServletRequest request); @Override String toString(); } | VRaptorRequest extends HttpServletRequestWrapper implements MutableRequest { @Override public String getRequestedUri() { if (getAttribute(INCLUDE_REQUEST_URI) != null) { return (String) getAttribute(INCLUDE_REQUEST_URI); } String uri = getRelativeRequestURI(this); return uri.replaceFirst("(?i);jsessionid=.*$", ""); } VRaptorRequest(HttpServletRequest request); @Override String getParameter(String name); @Override Enumeration<String> getParameterNames(); @Override String[] getParameterValues(String name); @Override Map<String, String[]> getParameterMap(); @Override void setParameter(String key, String... value); @Override String getRequestedUri(); static String getRelativeRequestURI(HttpServletRequest request); @Override String toString(); } |
@Test public void shouldAccessArray() { Client c = client(1L); c.favoriteColors = new String[] {"blue", "red"}; assertThat((String) evaluator.get(c, "client.favoriteColors[1]"), is(equalTo("red"))); } | @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } | JavaEvaluator implements Evaluator { @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } } | JavaEvaluator implements Evaluator { @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } protected JavaEvaluator(); @Inject JavaEvaluator(ReflectionProvider reflectionProvider); } | JavaEvaluator implements Evaluator { @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } protected JavaEvaluator(); @Inject JavaEvaluator(ReflectionProvider reflectionProvider); @Override Object get(Object root, String path); } | JavaEvaluator implements Evaluator { @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } protected JavaEvaluator(); @Inject JavaEvaluator(ReflectionProvider reflectionProvider); @Override Object get(Object root, String path); } |
@Test public void shouldAccessList() { Client c = client(1L); c.emails = Arrays.asList("blue", "red"); assertThat((String) evaluator.get(c, "client.emails[1]"), is(equalTo("red"))); } | @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } | JavaEvaluator implements Evaluator { @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } } | JavaEvaluator implements Evaluator { @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } protected JavaEvaluator(); @Inject JavaEvaluator(ReflectionProvider reflectionProvider); } | JavaEvaluator implements Evaluator { @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } protected JavaEvaluator(); @Inject JavaEvaluator(ReflectionProvider reflectionProvider); @Override Object get(Object root, String path); } | JavaEvaluator implements Evaluator { @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } protected JavaEvaluator(); @Inject JavaEvaluator(ReflectionProvider reflectionProvider); @Override Object get(Object root, String path); } |
@Test public void shouldAccessCollection() { Client c = client(1L); c.favoriteNumbers = new TreeSet<>(Arrays.asList(10, 5)); assertThat((Integer) evaluator.get(c, "client.favoriteNumbers[1]"), is(equalTo(10))); } | @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } | JavaEvaluator implements Evaluator { @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } } | JavaEvaluator implements Evaluator { @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } protected JavaEvaluator(); @Inject JavaEvaluator(ReflectionProvider reflectionProvider); } | JavaEvaluator implements Evaluator { @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } protected JavaEvaluator(); @Inject JavaEvaluator(ReflectionProvider reflectionProvider); @Override Object get(Object root, String path); } | JavaEvaluator implements Evaluator { @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } protected JavaEvaluator(); @Inject JavaEvaluator(ReflectionProvider reflectionProvider); @Override Object get(Object root, String path); } |
@Test public void shouldReturnEmptyStringIfNullWasFoundOnTheWay() { Client c = client(1L); assertThat((String) evaluator.get(c, "client.child.id"), is(equalTo(""))); } | @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } | JavaEvaluator implements Evaluator { @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } } | JavaEvaluator implements Evaluator { @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } protected JavaEvaluator(); @Inject JavaEvaluator(ReflectionProvider reflectionProvider); } | JavaEvaluator implements Evaluator { @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } protected JavaEvaluator(); @Inject JavaEvaluator(ReflectionProvider reflectionProvider); @Override Object get(Object root, String path); } | JavaEvaluator implements Evaluator { @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } protected JavaEvaluator(); @Inject JavaEvaluator(ReflectionProvider reflectionProvider); @Override Object get(Object root, String path); } |
@Test public void shouldReturnEmptyStringIfTheResultIsNull() { Client c = client(null); assertThat((String) evaluator.get(c, "client.id"), is(equalTo(""))); } | @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } | JavaEvaluator implements Evaluator { @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } } | JavaEvaluator implements Evaluator { @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } protected JavaEvaluator(); @Inject JavaEvaluator(ReflectionProvider reflectionProvider); } | JavaEvaluator implements Evaluator { @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } protected JavaEvaluator(); @Inject JavaEvaluator(ReflectionProvider reflectionProvider); @Override Object get(Object root, String path); } | JavaEvaluator implements Evaluator { @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } protected JavaEvaluator(); @Inject JavaEvaluator(ReflectionProvider reflectionProvider); @Override Object get(Object root, String path); } |
@Test public void shouldInvokeAGetterDeclaredOnSuperClass() { Client c = vipClient(1L); assertThat((Long) evaluator.get(c, "client.id"), is(equalTo(1L))); } | @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } | JavaEvaluator implements Evaluator { @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } } | JavaEvaluator implements Evaluator { @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } protected JavaEvaluator(); @Inject JavaEvaluator(ReflectionProvider reflectionProvider); } | JavaEvaluator implements Evaluator { @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } protected JavaEvaluator(); @Inject JavaEvaluator(ReflectionProvider reflectionProvider); @Override Object get(Object root, String path); } | JavaEvaluator implements Evaluator { @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } protected JavaEvaluator(); @Inject JavaEvaluator(ReflectionProvider reflectionProvider); @Override Object get(Object root, String path); } |
@Test public void shouldInvokeAIsDeclaredOnSuperClass() { Client c = vipClient(1L); c.ugly = true; assertThat((Boolean) evaluator.get(c, "client.ugly"), is(equalTo(true))); } | @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } | JavaEvaluator implements Evaluator { @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } } | JavaEvaluator implements Evaluator { @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } protected JavaEvaluator(); @Inject JavaEvaluator(ReflectionProvider reflectionProvider); } | JavaEvaluator implements Evaluator { @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } protected JavaEvaluator(); @Inject JavaEvaluator(ReflectionProvider reflectionProvider); @Override Object get(Object root, String path); } | JavaEvaluator implements Evaluator { @Override public Object get(Object root, String path) { if (root == null) { return null; } String[] paths = path.split("[\\]\\.]"); Object current = root; for (int i = 1; i < paths.length; i++) { try { current = navigate(current, paths[i]); } catch (Exception e) { throw new VRaptorException("Unable to evaluate expression " + path, e); } if (current == null) { return ""; } } return current; } protected JavaEvaluator(); @Inject JavaEvaluator(ReflectionProvider reflectionProvider); @Override Object get(Object root, String path); } |
@Test public void shouldReturnTheFirstRouteFound() throws Exception { Method method = MyController.class.getDeclaredMethod("listDogs", Integer.class); registerRulesFor(MyController.class); assertEquals("/dogs/1", router.urlFor(MyController.class, method, new Object[] { "1" })); } | @Override public <T> String urlFor(final Class<T> type, final Method method, Object... params) { final Class<?> rawtype = proxifier.isProxyType(type) ? type.getSuperclass() : type; final Invocation invocation = new Invocation(rawtype, method); Route route = cache.fetch(invocation, new Supplier<Route>() { @Override public Route get() { return FluentIterable.from(routes).filter(canHandle(rawtype, method)) .first().or(NULL); } }); logger.debug("Selected route for {} is {}", method, route); String url = route.urlFor(type, method, params); logger.debug("Returning URL {} for {}", url, route); return url; } | DefaultRouter implements Router { @Override public <T> String urlFor(final Class<T> type, final Method method, Object... params) { final Class<?> rawtype = proxifier.isProxyType(type) ? type.getSuperclass() : type; final Invocation invocation = new Invocation(rawtype, method); Route route = cache.fetch(invocation, new Supplier<Route>() { @Override public Route get() { return FluentIterable.from(routes).filter(canHandle(rawtype, method)) .first().or(NULL); } }); logger.debug("Selected route for {} is {}", method, route); String url = route.urlFor(type, method, params); logger.debug("Returning URL {} for {}", url, route); return url; } } | DefaultRouter implements Router { @Override public <T> String urlFor(final Class<T> type, final Method method, Object... params) { final Class<?> rawtype = proxifier.isProxyType(type) ? type.getSuperclass() : type; final Invocation invocation = new Invocation(rawtype, method); Route route = cache.fetch(invocation, new Supplier<Route>() { @Override public Route get() { return FluentIterable.from(routes).filter(canHandle(rawtype, method)) .first().or(NULL); } }); logger.debug("Selected route for {} is {}", method, route); String url = route.urlFor(type, method, params); logger.debug("Returning URL {} for {}", url, route); return url; } protected DefaultRouter(); @Inject DefaultRouter(Proxifier proxifier, TypeFinder finder, Converters converters,
ParameterNameProvider nameProvider, Evaluator evaluator, EncodingHandler encodingHandler,
CacheStore<Invocation, Route> cache); } | DefaultRouter implements Router { @Override public <T> String urlFor(final Class<T> type, final Method method, Object... params) { final Class<?> rawtype = proxifier.isProxyType(type) ? type.getSuperclass() : type; final Invocation invocation = new Invocation(rawtype, method); Route route = cache.fetch(invocation, new Supplier<Route>() { @Override public Route get() { return FluentIterable.from(routes).filter(canHandle(rawtype, method)) .first().or(NULL); } }); logger.debug("Selected route for {} is {}", method, route); String url = route.urlFor(type, method, params); logger.debug("Returning URL {} for {}", url, route); return url; } protected DefaultRouter(); @Inject DefaultRouter(Proxifier proxifier, TypeFinder finder, Converters converters,
ParameterNameProvider nameProvider, Evaluator evaluator, EncodingHandler encodingHandler,
CacheStore<Invocation, Route> cache); @Override RouteBuilder builderFor(String uri); @Override void add(Route r); @Override ControllerMethod parse(String uri, HttpMethod method, MutableRequest request); @Override EnumSet<HttpMethod> allowedMethodsFor(String uri); @Override String urlFor(final Class<T> type, final Method method, Object... params); @Override List<Route> allRoutes(); } | DefaultRouter implements Router { @Override public <T> String urlFor(final Class<T> type, final Method method, Object... params) { final Class<?> rawtype = proxifier.isProxyType(type) ? type.getSuperclass() : type; final Invocation invocation = new Invocation(rawtype, method); Route route = cache.fetch(invocation, new Supplier<Route>() { @Override public Route get() { return FluentIterable.from(routes).filter(canHandle(rawtype, method)) .first().or(NULL); } }); logger.debug("Selected route for {} is {}", method, route); String url = route.urlFor(type, method, params); logger.debug("Returning URL {} for {}", url, route); return url; } protected DefaultRouter(); @Inject DefaultRouter(Proxifier proxifier, TypeFinder finder, Converters converters,
ParameterNameProvider nameProvider, Evaluator evaluator, EncodingHandler encodingHandler,
CacheStore<Invocation, Route> cache); @Override RouteBuilder builderFor(String uri); @Override void add(Route r); @Override ControllerMethod parse(String uri, HttpMethod method, MutableRequest request); @Override EnumSet<HttpMethod> allowedMethodsFor(String uri); @Override String urlFor(final Class<T> type, final Method method, Object... params); @Override List<Route> allRoutes(); } |
@Test public void canFindUrlForProxyClasses() throws Exception { registerRulesFor(MyController.class); MyController proxy = proxifier.proxify(MyController.class, null); Class<? extends MyController> type = proxy.getClass(); Method method = type.getMethod("notAnnotated"); assertEquals("/my/notAnnotated", router.urlFor(type, method)); } | @Override public <T> String urlFor(final Class<T> type, final Method method, Object... params) { final Class<?> rawtype = proxifier.isProxyType(type) ? type.getSuperclass() : type; final Invocation invocation = new Invocation(rawtype, method); Route route = cache.fetch(invocation, new Supplier<Route>() { @Override public Route get() { return FluentIterable.from(routes).filter(canHandle(rawtype, method)) .first().or(NULL); } }); logger.debug("Selected route for {} is {}", method, route); String url = route.urlFor(type, method, params); logger.debug("Returning URL {} for {}", url, route); return url; } | DefaultRouter implements Router { @Override public <T> String urlFor(final Class<T> type, final Method method, Object... params) { final Class<?> rawtype = proxifier.isProxyType(type) ? type.getSuperclass() : type; final Invocation invocation = new Invocation(rawtype, method); Route route = cache.fetch(invocation, new Supplier<Route>() { @Override public Route get() { return FluentIterable.from(routes).filter(canHandle(rawtype, method)) .first().or(NULL); } }); logger.debug("Selected route for {} is {}", method, route); String url = route.urlFor(type, method, params); logger.debug("Returning URL {} for {}", url, route); return url; } } | DefaultRouter implements Router { @Override public <T> String urlFor(final Class<T> type, final Method method, Object... params) { final Class<?> rawtype = proxifier.isProxyType(type) ? type.getSuperclass() : type; final Invocation invocation = new Invocation(rawtype, method); Route route = cache.fetch(invocation, new Supplier<Route>() { @Override public Route get() { return FluentIterable.from(routes).filter(canHandle(rawtype, method)) .first().or(NULL); } }); logger.debug("Selected route for {} is {}", method, route); String url = route.urlFor(type, method, params); logger.debug("Returning URL {} for {}", url, route); return url; } protected DefaultRouter(); @Inject DefaultRouter(Proxifier proxifier, TypeFinder finder, Converters converters,
ParameterNameProvider nameProvider, Evaluator evaluator, EncodingHandler encodingHandler,
CacheStore<Invocation, Route> cache); } | DefaultRouter implements Router { @Override public <T> String urlFor(final Class<T> type, final Method method, Object... params) { final Class<?> rawtype = proxifier.isProxyType(type) ? type.getSuperclass() : type; final Invocation invocation = new Invocation(rawtype, method); Route route = cache.fetch(invocation, new Supplier<Route>() { @Override public Route get() { return FluentIterable.from(routes).filter(canHandle(rawtype, method)) .first().or(NULL); } }); logger.debug("Selected route for {} is {}", method, route); String url = route.urlFor(type, method, params); logger.debug("Returning URL {} for {}", url, route); return url; } protected DefaultRouter(); @Inject DefaultRouter(Proxifier proxifier, TypeFinder finder, Converters converters,
ParameterNameProvider nameProvider, Evaluator evaluator, EncodingHandler encodingHandler,
CacheStore<Invocation, Route> cache); @Override RouteBuilder builderFor(String uri); @Override void add(Route r); @Override ControllerMethod parse(String uri, HttpMethod method, MutableRequest request); @Override EnumSet<HttpMethod> allowedMethodsFor(String uri); @Override String urlFor(final Class<T> type, final Method method, Object... params); @Override List<Route> allRoutes(); } | DefaultRouter implements Router { @Override public <T> String urlFor(final Class<T> type, final Method method, Object... params) { final Class<?> rawtype = proxifier.isProxyType(type) ? type.getSuperclass() : type; final Invocation invocation = new Invocation(rawtype, method); Route route = cache.fetch(invocation, new Supplier<Route>() { @Override public Route get() { return FluentIterable.from(routes).filter(canHandle(rawtype, method)) .first().or(NULL); } }); logger.debug("Selected route for {} is {}", method, route); String url = route.urlFor(type, method, params); logger.debug("Returning URL {} for {}", url, route); return url; } protected DefaultRouter(); @Inject DefaultRouter(Proxifier proxifier, TypeFinder finder, Converters converters,
ParameterNameProvider nameProvider, Evaluator evaluator, EncodingHandler encodingHandler,
CacheStore<Invocation, Route> cache); @Override RouteBuilder builderFor(String uri); @Override void add(Route r); @Override ControllerMethod parse(String uri, HttpMethod method, MutableRequest request); @Override EnumSet<HttpMethod> allowedMethodsFor(String uri); @Override String urlFor(final Class<T> type, final Method method, Object... params); @Override List<Route> allRoutes(); } |
@Test public void shouldNameObjectTypeAsItsSimpleName() throws SecurityException, NoSuchMethodException { Parameter[] namesFor = provider.parametersFor(Horse.class.getMethod("runThrough", Field.class)); assertThat(toNames(namesFor), contains("f")); } | @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } | ParanamerNameProvider implements ParameterNameProvider { @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } } | ParanamerNameProvider implements ParameterNameProvider { @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } } | ParanamerNameProvider implements ParameterNameProvider { @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } @Override Parameter[] parametersFor(final AccessibleObject executable); } | ParanamerNameProvider implements ParameterNameProvider { @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } @Override Parameter[] parametersFor(final AccessibleObject executable); } |
@Test public void registerExtraParametersFromAcessedUrl() throws SecurityException, NoSuchMethodException { DefaultParametersControl control = getDefaultParameterControlForUrl("/clients/{dog.id}"); control.fillIntoRequest("/clients/45", request); verify(request).setParameter("dog.id", new String[] {"45"}); } | @Override public void fillIntoRequest(String uri, MutableRequest request) { Matcher m = pattern.matcher(uri); m.matches(); for (int i = 1; i <= m.groupCount(); i++) { String name = parameters.get(i - 1); try { request.setParameter(name, URLDecoder.decode(m.group(i), encodingHandler.getEncoding())); } catch (UnsupportedEncodingException e) { logger.error("Error when decoding url parameters"); } } } | DefaultParametersControl implements ParametersControl { @Override public void fillIntoRequest(String uri, MutableRequest request) { Matcher m = pattern.matcher(uri); m.matches(); for (int i = 1; i <= m.groupCount(); i++) { String name = parameters.get(i - 1); try { request.setParameter(name, URLDecoder.decode(m.group(i), encodingHandler.getEncoding())); } catch (UnsupportedEncodingException e) { logger.error("Error when decoding url parameters"); } } } } | DefaultParametersControl implements ParametersControl { @Override public void fillIntoRequest(String uri, MutableRequest request) { Matcher m = pattern.matcher(uri); m.matches(); for (int i = 1; i <= m.groupCount(); i++) { String name = parameters.get(i - 1); try { request.setParameter(name, URLDecoder.decode(m.group(i), encodingHandler.getEncoding())); } catch (UnsupportedEncodingException e) { logger.error("Error when decoding url parameters"); } } } DefaultParametersControl(String originalPattern, Map<String, String> parameterPatterns, Converters converters, Evaluator evaluator, EncodingHandler encodingHandler); DefaultParametersControl(String originalPattern, Converters converters, Evaluator evaluator, EncodingHandler encodingHandler); } | DefaultParametersControl implements ParametersControl { @Override public void fillIntoRequest(String uri, MutableRequest request) { Matcher m = pattern.matcher(uri); m.matches(); for (int i = 1; i <= m.groupCount(); i++) { String name = parameters.get(i - 1); try { request.setParameter(name, URLDecoder.decode(m.group(i), encodingHandler.getEncoding())); } catch (UnsupportedEncodingException e) { logger.error("Error when decoding url parameters"); } } } DefaultParametersControl(String originalPattern, Map<String, String> parameterPatterns, Converters converters, Evaluator evaluator, EncodingHandler encodingHandler); DefaultParametersControl(String originalPattern, Converters converters, Evaluator evaluator, EncodingHandler encodingHandler); @Override String fillUri(Parameter[] paramNames, Object... paramValues); @Override boolean matches(String uri); @Override void fillIntoRequest(String uri, MutableRequest request); @Override String apply(String[] values); } | DefaultParametersControl implements ParametersControl { @Override public void fillIntoRequest(String uri, MutableRequest request) { Matcher m = pattern.matcher(uri); m.matches(); for (int i = 1; i <= m.groupCount(); i++) { String name = parameters.get(i - 1); try { request.setParameter(name, URLDecoder.decode(m.group(i), encodingHandler.getEncoding())); } catch (UnsupportedEncodingException e) { logger.error("Error when decoding url parameters"); } } } DefaultParametersControl(String originalPattern, Map<String, String> parameterPatterns, Converters converters, Evaluator evaluator, EncodingHandler encodingHandler); DefaultParametersControl(String originalPattern, Converters converters, Evaluator evaluator, EncodingHandler encodingHandler); @Override String fillUri(Parameter[] paramNames, Object... paramValues); @Override boolean matches(String uri); @Override void fillIntoRequest(String uri, MutableRequest request); @Override String apply(String[] values); } |
@Test public void shouldNamePrimitiveTypeAsItsSimpleName() throws SecurityException, NoSuchMethodException { Parameter[] namesFor = provider.parametersFor(Horse.class.getMethod("rest", int.class)); assertThat(toNames(namesFor), contains("hours")); } | @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } | ParanamerNameProvider implements ParameterNameProvider { @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } } | ParanamerNameProvider implements ParameterNameProvider { @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } } | ParanamerNameProvider implements ParameterNameProvider { @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } @Override Parameter[] parametersFor(final AccessibleObject executable); } | ParanamerNameProvider implements ParameterNameProvider { @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } @Override Parameter[] parametersFor(final AccessibleObject executable); } |
@Test public void shouldNameArrayAsItsSimpleTypeName() throws SecurityException, NoSuchMethodException { Parameter[] namesFor = provider.parametersFor(Horse.class.getMethod("setLeg", int[].class)); assertThat(toNames(namesFor), contains("length")); } | @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } | ParanamerNameProvider implements ParameterNameProvider { @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } } | ParanamerNameProvider implements ParameterNameProvider { @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } } | ParanamerNameProvider implements ParameterNameProvider { @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } @Override Parameter[] parametersFor(final AccessibleObject executable); } | ParanamerNameProvider implements ParameterNameProvider { @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } @Override Parameter[] parametersFor(final AccessibleObject executable); } |
@Test public void shouldNameGenericCollectionUsingOf() throws SecurityException, NoSuchMethodException { Parameter[] namesFor = provider.parametersFor(Cat.class.getDeclaredMethod("fightWith", List.class)); assertThat(toNames(namesFor), contains("cats")); } | @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } | ParanamerNameProvider implements ParameterNameProvider { @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } } | ParanamerNameProvider implements ParameterNameProvider { @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } } | ParanamerNameProvider implements ParameterNameProvider { @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } @Override Parameter[] parametersFor(final AccessibleObject executable); } | ParanamerNameProvider implements ParameterNameProvider { @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } @Override Parameter[] parametersFor(final AccessibleObject executable); } |
@Test public void shouldIgnoreChangesToTheReturnedArrayInSubsequentCalls() throws Exception { Parameter[] firstCall = provider.parametersFor(Horse.class.getMethod("setLeg", int[].class)); firstCall[0] = null; Parameter[] secondCall = provider.parametersFor(Horse.class.getMethod("setLeg", int[].class)); assertThat(secondCall[0], notNullValue()); } | @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } | ParanamerNameProvider implements ParameterNameProvider { @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } } | ParanamerNameProvider implements ParameterNameProvider { @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } } | ParanamerNameProvider implements ParameterNameProvider { @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } @Override Parameter[] parametersFor(final AccessibleObject executable); } | ParanamerNameProvider implements ParameterNameProvider { @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } @Override Parameter[] parametersFor(final AccessibleObject executable); } |
@Test public void shouldNameFieldsAnnotatedWithNamed() throws SecurityException, NoSuchMethodException { Parameter[] namesFor = provider.parametersFor(Horse.class.getMethod("runThroughWithAnnotation", Field.class)); assertThat(toNames(namesFor), contains("one")); } | @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } | ParanamerNameProvider implements ParameterNameProvider { @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } } | ParanamerNameProvider implements ParameterNameProvider { @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } } | ParanamerNameProvider implements ParameterNameProvider { @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } @Override Parameter[] parametersFor(final AccessibleObject executable); } | ParanamerNameProvider implements ParameterNameProvider { @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } @Override Parameter[] parametersFor(final AccessibleObject executable); } |
@Test public void shouldNotNameFieldsByTheFieldNameWhenUsingAnnotation() throws SecurityException, NoSuchMethodException { Parameter[] namesFor = provider.parametersFor(Horse.class.getMethod("runThroughWithAnnotation", Field.class)); assertThat(toNames(namesFor), not(contains("field"))); } | @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } | ParanamerNameProvider implements ParameterNameProvider { @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } } | ParanamerNameProvider implements ParameterNameProvider { @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } } | ParanamerNameProvider implements ParameterNameProvider { @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } @Override Parameter[] parametersFor(final AccessibleObject executable); } | ParanamerNameProvider implements ParameterNameProvider { @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } @Override Parameter[] parametersFor(final AccessibleObject executable); } |
@Test public void shouldNameMethodsFieldsWhenAnnotatedOrNot() throws SecurityException, NoSuchMethodException { Parameter[] namesFor = provider.parametersFor(Horse.class.getMethod("runThroughWithAnnotation2", Field.class, Field.class)); assertThat(toNames(namesFor), contains("one", "two")); } | @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } | ParanamerNameProvider implements ParameterNameProvider { @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } } | ParanamerNameProvider implements ParameterNameProvider { @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } } | ParanamerNameProvider implements ParameterNameProvider { @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } @Override Parameter[] parametersFor(final AccessibleObject executable); } | ParanamerNameProvider implements ParameterNameProvider { @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } @Override Parameter[] parametersFor(final AccessibleObject executable); } |
@Test public void shouldNameMethodsFieldsWhenAnnotatedOrNot2() throws SecurityException, NoSuchMethodException { Parameter[] namesFor = provider.parametersFor(Horse.class.getMethod("runThroughWithAnnotation3", Field.class, Field.class)); assertThat(toNames(namesFor), contains("one", "size")); } | @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } | ParanamerNameProvider implements ParameterNameProvider { @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } } | ParanamerNameProvider implements ParameterNameProvider { @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } } | ParanamerNameProvider implements ParameterNameProvider { @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } @Override Parameter[] parametersFor(final AccessibleObject executable); } | ParanamerNameProvider implements ParameterNameProvider { @Override public Parameter[] parametersFor(final AccessibleObject executable) { try { String[] names = info.lookupParameterNames(executable); Parameter[] params = new Parameter[names.length]; logger.debug("Found parameter names with paranamer for {} as {}", executable, (Object) names); for (int i = 0; i < names.length; i++) { params[i] = new Parameter(i, names[i], executable); } return defensiveCopy(params); } catch (ParameterNamesNotFoundException e) { throw new IllegalStateException("Paranamer were not able to find your parameter names for " + executable + "You must compile your code with debug information (javac -g), or using @Named on " + "each method parameter.", e); } } @Override Parameter[] parametersFor(final AccessibleObject executable); } |
@Test public void handlesInclude() { when(request.getAttribute(INCLUDE_REQUEST_URI)).thenReturn("/url"); when(request.getMethod()).thenReturn("POST"); when(router.parse("/url", HttpMethod.POST, webRequest)).thenReturn(method); ControllerMethod controller = translator.translate(webRequest); assertThat(controller, is(sameInstance(method))); } | @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } protected DefaultControllerTranslator(); @Inject DefaultControllerTranslator(Router router); } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } protected DefaultControllerTranslator(); @Inject DefaultControllerTranslator(Router router); @Override ControllerMethod translate(MutableRequest request); } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } protected DefaultControllerTranslator(); @Inject DefaultControllerTranslator(Router router); @Override ControllerMethod translate(MutableRequest request); } |
@Test public void canHandleTheCorrectMethod() { when(request.getRequestURI()).thenReturn("/url"); when(request.getMethod()).thenReturn("POST"); when(router.parse("/url", HttpMethod.POST,webRequest)).thenReturn(method); ControllerMethod controller = translator.translate(webRequest); assertThat(controller, is(equalTo(method))); } | @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } protected DefaultControllerTranslator(); @Inject DefaultControllerTranslator(Router router); } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } protected DefaultControllerTranslator(); @Inject DefaultControllerTranslator(Router router); @Override ControllerMethod translate(MutableRequest request); } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } protected DefaultControllerTranslator(); @Inject DefaultControllerTranslator(Router router); @Override ControllerMethod translate(MutableRequest request); } |
@Test public void registerParametersWithAsterisks() throws SecurityException, NoSuchMethodException { DefaultParametersControl control = getDefaultParameterControlForUrl("/clients/{my.path*}"); control.fillIntoRequest("/clients/one/path", request); verify(request).setParameter("my.path", new String[] {"one/path"}); } | @Override public void fillIntoRequest(String uri, MutableRequest request) { Matcher m = pattern.matcher(uri); m.matches(); for (int i = 1; i <= m.groupCount(); i++) { String name = parameters.get(i - 1); try { request.setParameter(name, URLDecoder.decode(m.group(i), encodingHandler.getEncoding())); } catch (UnsupportedEncodingException e) { logger.error("Error when decoding url parameters"); } } } | DefaultParametersControl implements ParametersControl { @Override public void fillIntoRequest(String uri, MutableRequest request) { Matcher m = pattern.matcher(uri); m.matches(); for (int i = 1; i <= m.groupCount(); i++) { String name = parameters.get(i - 1); try { request.setParameter(name, URLDecoder.decode(m.group(i), encodingHandler.getEncoding())); } catch (UnsupportedEncodingException e) { logger.error("Error when decoding url parameters"); } } } } | DefaultParametersControl implements ParametersControl { @Override public void fillIntoRequest(String uri, MutableRequest request) { Matcher m = pattern.matcher(uri); m.matches(); for (int i = 1; i <= m.groupCount(); i++) { String name = parameters.get(i - 1); try { request.setParameter(name, URLDecoder.decode(m.group(i), encodingHandler.getEncoding())); } catch (UnsupportedEncodingException e) { logger.error("Error when decoding url parameters"); } } } DefaultParametersControl(String originalPattern, Map<String, String> parameterPatterns, Converters converters, Evaluator evaluator, EncodingHandler encodingHandler); DefaultParametersControl(String originalPattern, Converters converters, Evaluator evaluator, EncodingHandler encodingHandler); } | DefaultParametersControl implements ParametersControl { @Override public void fillIntoRequest(String uri, MutableRequest request) { Matcher m = pattern.matcher(uri); m.matches(); for (int i = 1; i <= m.groupCount(); i++) { String name = parameters.get(i - 1); try { request.setParameter(name, URLDecoder.decode(m.group(i), encodingHandler.getEncoding())); } catch (UnsupportedEncodingException e) { logger.error("Error when decoding url parameters"); } } } DefaultParametersControl(String originalPattern, Map<String, String> parameterPatterns, Converters converters, Evaluator evaluator, EncodingHandler encodingHandler); DefaultParametersControl(String originalPattern, Converters converters, Evaluator evaluator, EncodingHandler encodingHandler); @Override String fillUri(Parameter[] paramNames, Object... paramValues); @Override boolean matches(String uri); @Override void fillIntoRequest(String uri, MutableRequest request); @Override String apply(String[] values); } | DefaultParametersControl implements ParametersControl { @Override public void fillIntoRequest(String uri, MutableRequest request) { Matcher m = pattern.matcher(uri); m.matches(); for (int i = 1; i <= m.groupCount(); i++) { String name = parameters.get(i - 1); try { request.setParameter(name, URLDecoder.decode(m.group(i), encodingHandler.getEncoding())); } catch (UnsupportedEncodingException e) { logger.error("Error when decoding url parameters"); } } } DefaultParametersControl(String originalPattern, Map<String, String> parameterPatterns, Converters converters, Evaluator evaluator, EncodingHandler encodingHandler); DefaultParametersControl(String originalPattern, Converters converters, Evaluator evaluator, EncodingHandler encodingHandler); @Override String fillUri(Parameter[] paramNames, Object... paramValues); @Override boolean matches(String uri); @Override void fillIntoRequest(String uri, MutableRequest request); @Override String apply(String[] values); } |
@Test public void shouldAcceptCaseInsensitiveRequestMethods() { when(request.getRequestURI()).thenReturn("/url"); when(request.getMethod()).thenReturn("pOsT"); when(router.parse("/url", HttpMethod.POST,webRequest)).thenReturn(method); ControllerMethod controller = translator.translate(webRequest); assertThat(controller, is(equalTo(method))); } | @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } protected DefaultControllerTranslator(); @Inject DefaultControllerTranslator(Router router); } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } protected DefaultControllerTranslator(); @Inject DefaultControllerTranslator(Router router); @Override ControllerMethod translate(MutableRequest request); } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } protected DefaultControllerTranslator(); @Inject DefaultControllerTranslator(Router router); @Override ControllerMethod translate(MutableRequest request); } |
@Test public void shouldAcceptCaseInsensitiveGetRequestUsingThe_methodParameter() { when(request.getRequestURI()).thenReturn("/url"); when(request.getParameter("_method")).thenReturn("gEt"); when(request.getMethod()).thenReturn("POST"); when(router.parse("/url", HttpMethod.GET, webRequest)).thenReturn(method); ControllerMethod controller = translator.translate(webRequest); assertThat(controller, is(equalTo(method))); } | @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } protected DefaultControllerTranslator(); @Inject DefaultControllerTranslator(Router router); } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } protected DefaultControllerTranslator(); @Inject DefaultControllerTranslator(Router router); @Override ControllerMethod translate(MutableRequest request); } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } protected DefaultControllerTranslator(); @Inject DefaultControllerTranslator(Router router); @Override ControllerMethod translate(MutableRequest request); } |
@Test public void shouldThrowExceptionWhenRequestANotKnownMethod() { exception.expect(MethodNotAllowedException.class); exception.expectMessage("Method COOK is not allowed for requested URI. Allowed Methods are [GET, POST]"); when(request.getRequestURI()).thenReturn("/url"); when(request.getMethod()).thenReturn("COOK"); when(router.parse(anyString(), any(HttpMethod.class), any(MutableRequest.class))).thenReturn(method); when(router.allowedMethodsFor("/url")).thenReturn(EnumSet.of(HttpMethod.GET, HttpMethod.POST)); translator.translate(webRequest); } | @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } protected DefaultControllerTranslator(); @Inject DefaultControllerTranslator(Router router); } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } protected DefaultControllerTranslator(); @Inject DefaultControllerTranslator(Router router); @Override ControllerMethod translate(MutableRequest request); } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } protected DefaultControllerTranslator(); @Inject DefaultControllerTranslator(Router router); @Override ControllerMethod translate(MutableRequest request); } |
@Test public void shouldOverrideTheHttpMethodByUsingThe_methodParameter() { when(request.getRequestURI()).thenReturn("/url"); when(request.getParameter("_method")).thenReturn("DELETE"); when(request.getMethod()).thenReturn("POST"); when(router.parse("/url", HttpMethod.DELETE, webRequest)).thenReturn(method); ControllerMethod controller = translator.translate(webRequest); assertThat(controller, is(equalTo(method))); } | @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } protected DefaultControllerTranslator(); @Inject DefaultControllerTranslator(Router router); } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } protected DefaultControllerTranslator(); @Inject DefaultControllerTranslator(Router router); @Override ControllerMethod translate(MutableRequest request); } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } protected DefaultControllerTranslator(); @Inject DefaultControllerTranslator(Router router); @Override ControllerMethod translate(MutableRequest request); } |
@Test public void canHandleUrlIfRootContext() { when(request.getRequestURI()).thenReturn("/url"); when(request.getContextPath()).thenReturn(""); when(request.getMethod()).thenReturn("GET"); when(router.parse("/url", HttpMethod.GET, webRequest)).thenReturn(method); ControllerMethod controller = translator.translate(webRequest); assertThat(controller, is(equalTo(method))); } | @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } protected DefaultControllerTranslator(); @Inject DefaultControllerTranslator(Router router); } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } protected DefaultControllerTranslator(); @Inject DefaultControllerTranslator(Router router); @Override ControllerMethod translate(MutableRequest request); } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } protected DefaultControllerTranslator(); @Inject DefaultControllerTranslator(Router router); @Override ControllerMethod translate(MutableRequest request); } |
@Test public void canHandleUrlIfNonRootContext() { when(request.getRequestURI()).thenReturn("/custom_context/url"); when(request.getContextPath()).thenReturn("/custom_context"); when(request.getMethod()).thenReturn("GET"); when(router.parse("/url", HttpMethod.GET, webRequest)).thenReturn(method); ControllerMethod controller = translator.translate(webRequest); assertThat(controller, is(equalTo(method))); } | @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } protected DefaultControllerTranslator(); @Inject DefaultControllerTranslator(Router router); } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } protected DefaultControllerTranslator(); @Inject DefaultControllerTranslator(Router router); @Override ControllerMethod translate(MutableRequest request); } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } protected DefaultControllerTranslator(); @Inject DefaultControllerTranslator(Router router); @Override ControllerMethod translate(MutableRequest request); } |
@Test public void canHandleUrlIfPlainRootContext() { when(request.getRequestURI()).thenReturn("/"); when(request.getMethod()).thenReturn("GET"); when(router.parse("/", HttpMethod.GET, webRequest)).thenReturn(method); ControllerMethod controller = translator.translate(webRequest); assertThat(controller, is(equalTo(method))); } | @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } protected DefaultControllerTranslator(); @Inject DefaultControllerTranslator(Router router); } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } protected DefaultControllerTranslator(); @Inject DefaultControllerTranslator(Router router); @Override ControllerMethod translate(MutableRequest request); } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } protected DefaultControllerTranslator(); @Inject DefaultControllerTranslator(Router router); @Override ControllerMethod translate(MutableRequest request); } |
@Test public void canHandleComposedUrlIfPlainRootContext() { when(request.getRequestURI()).thenReturn("/products/1"); when(request.getMethod()).thenReturn("GET"); when(router.parse("/products/1", HttpMethod.GET, webRequest)).thenReturn(method); ControllerMethod controller = translator.translate(webRequest); assertThat(controller, is(equalTo(method))); } | @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } protected DefaultControllerTranslator(); @Inject DefaultControllerTranslator(Router router); } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } protected DefaultControllerTranslator(); @Inject DefaultControllerTranslator(Router router); @Override ControllerMethod translate(MutableRequest request); } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } protected DefaultControllerTranslator(); @Inject DefaultControllerTranslator(Router router); @Override ControllerMethod translate(MutableRequest request); } |
@Test public void canHandleComposedUrlIfNonRootContext() { when(request.getRequestURI()).thenReturn("/custom_context/products/1"); when(request.getContextPath()).thenReturn("/custom_context"); when(request.getMethod()).thenReturn("GET"); when(router.parse("/products/1", HttpMethod.GET, webRequest)).thenReturn(method); ControllerMethod controller = translator.translate(webRequest); assertThat(controller, is(equalTo(method))); } | @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } protected DefaultControllerTranslator(); @Inject DefaultControllerTranslator(Router router); } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } protected DefaultControllerTranslator(); @Inject DefaultControllerTranslator(Router router); @Override ControllerMethod translate(MutableRequest request); } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } protected DefaultControllerTranslator(); @Inject DefaultControllerTranslator(Router router); @Override ControllerMethod translate(MutableRequest request); } |
@Test public void canHandleUrlWithAppendedJSessionID() { when(request.getRequestURI()).thenReturn( "/custom_context/products/1;jsessionid=aslfasfaslkj22234lkjsdfaklsf", "/custom_context/products/1;JSESSIONID=aslfasfaslkj22234lkjsdfaklsf", "/custom_context/products/1;jsessionID=aslfasfaslkj22234lkjsdfaklsf"); when(request.getContextPath()).thenReturn("/custom_context"); when(request.getMethod()).thenReturn("GET"); when(router.parse("/products/1", HttpMethod.GET, webRequest)).thenReturn(method); assertThat(translator.translate(webRequest), is(equalTo(method))); assertThat(translator.translate(webRequest), is(equalTo(method))); assertThat(translator.translate(webRequest), is(equalTo(method))); } | @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } protected DefaultControllerTranslator(); @Inject DefaultControllerTranslator(Router router); } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } protected DefaultControllerTranslator(); @Inject DefaultControllerTranslator(Router router); @Override ControllerMethod translate(MutableRequest request); } | DefaultControllerTranslator implements UrlToControllerTranslator { @Override public ControllerMethod translate(MutableRequest request) { String controllerName = request.getRequestedUri(); logger.debug("trying to access {}", controllerName); HttpMethod method = getHttpMethod(request, controllerName); ControllerMethod controller = router.parse(controllerName, method, request); logger.debug("found controller {}", controller); return controller; } protected DefaultControllerTranslator(); @Inject DefaultControllerTranslator(Router router); @Override ControllerMethod translate(MutableRequest request); } |
@Test public void registerParametersWithRegexes() throws SecurityException, NoSuchMethodException { DefaultParametersControl control = getDefaultParameterControlForUrl("/clients/{hexa:[0-9A-Z]+}"); control.fillIntoRequest("/clients/FAF323", request); verify(request).setParameter("hexa", new String[] {"FAF323"}); } | @Override public void fillIntoRequest(String uri, MutableRequest request) { Matcher m = pattern.matcher(uri); m.matches(); for (int i = 1; i <= m.groupCount(); i++) { String name = parameters.get(i - 1); try { request.setParameter(name, URLDecoder.decode(m.group(i), encodingHandler.getEncoding())); } catch (UnsupportedEncodingException e) { logger.error("Error when decoding url parameters"); } } } | DefaultParametersControl implements ParametersControl { @Override public void fillIntoRequest(String uri, MutableRequest request) { Matcher m = pattern.matcher(uri); m.matches(); for (int i = 1; i <= m.groupCount(); i++) { String name = parameters.get(i - 1); try { request.setParameter(name, URLDecoder.decode(m.group(i), encodingHandler.getEncoding())); } catch (UnsupportedEncodingException e) { logger.error("Error when decoding url parameters"); } } } } | DefaultParametersControl implements ParametersControl { @Override public void fillIntoRequest(String uri, MutableRequest request) { Matcher m = pattern.matcher(uri); m.matches(); for (int i = 1; i <= m.groupCount(); i++) { String name = parameters.get(i - 1); try { request.setParameter(name, URLDecoder.decode(m.group(i), encodingHandler.getEncoding())); } catch (UnsupportedEncodingException e) { logger.error("Error when decoding url parameters"); } } } DefaultParametersControl(String originalPattern, Map<String, String> parameterPatterns, Converters converters, Evaluator evaluator, EncodingHandler encodingHandler); DefaultParametersControl(String originalPattern, Converters converters, Evaluator evaluator, EncodingHandler encodingHandler); } | DefaultParametersControl implements ParametersControl { @Override public void fillIntoRequest(String uri, MutableRequest request) { Matcher m = pattern.matcher(uri); m.matches(); for (int i = 1; i <= m.groupCount(); i++) { String name = parameters.get(i - 1); try { request.setParameter(name, URLDecoder.decode(m.group(i), encodingHandler.getEncoding())); } catch (UnsupportedEncodingException e) { logger.error("Error when decoding url parameters"); } } } DefaultParametersControl(String originalPattern, Map<String, String> parameterPatterns, Converters converters, Evaluator evaluator, EncodingHandler encodingHandler); DefaultParametersControl(String originalPattern, Converters converters, Evaluator evaluator, EncodingHandler encodingHandler); @Override String fillUri(Parameter[] paramNames, Object... paramValues); @Override boolean matches(String uri); @Override void fillIntoRequest(String uri, MutableRequest request); @Override String apply(String[] values); } | DefaultParametersControl implements ParametersControl { @Override public void fillIntoRequest(String uri, MutableRequest request) { Matcher m = pattern.matcher(uri); m.matches(); for (int i = 1; i <= m.groupCount(); i++) { String name = parameters.get(i - 1); try { request.setParameter(name, URLDecoder.decode(m.group(i), encodingHandler.getEncoding())); } catch (UnsupportedEncodingException e) { logger.error("Error when decoding url parameters"); } } } DefaultParametersControl(String originalPattern, Map<String, String> parameterPatterns, Converters converters, Evaluator evaluator, EncodingHandler encodingHandler); DefaultParametersControl(String originalPattern, Converters converters, Evaluator evaluator, EncodingHandler encodingHandler); @Override String fillUri(Parameter[] paramNames, Object... paramValues); @Override boolean matches(String uri); @Override void fillIntoRequest(String uri, MutableRequest request); @Override String apply(String[] values); } |
@Test public void testRemoveNotExistTag() { AVSessionCacheHelper.getTagCacheInstance().addSession(testClientId, testClientTag); AVSessionCacheHelper.getTagCacheInstance().removeSession("test11"); Map<String, String> map = AVSessionCacheHelper.getTagCacheInstance().getAllSession(); Assert.assertTrue(map.size() == 1); Assert.assertTrue(testClientTag.equals(map.get(testClientId))); } | static synchronized SessionTagCache getTagCacheInstance() { if (null == tagCacheInstance) { tagCacheInstance = new SessionTagCache(); } return tagCacheInstance; } | AVSessionCacheHelper { static synchronized SessionTagCache getTagCacheInstance() { if (null == tagCacheInstance) { tagCacheInstance = new SessionTagCache(); } return tagCacheInstance; } } | AVSessionCacheHelper { static synchronized SessionTagCache getTagCacheInstance() { if (null == tagCacheInstance) { tagCacheInstance = new SessionTagCache(); } return tagCacheInstance; } } | AVSessionCacheHelper { static synchronized SessionTagCache getTagCacheInstance() { if (null == tagCacheInstance) { tagCacheInstance = new SessionTagCache(); } return tagCacheInstance; } } | AVSessionCacheHelper { static synchronized SessionTagCache getTagCacheInstance() { if (null == tagCacheInstance) { tagCacheInstance = new SessionTagCache(); } return tagCacheInstance; } } |
@Test public void testRemoveMetaData() { String key = "key"; String value = "value"; AVFile file = new AVFile("name", TEST_FILE_CONTENT.getBytes()); Assert.assertTrue(!file.getMetaData().containsKey(key)); file.addMetaData(key, value); Assert.assertEquals(file.getMetaData().get(key), value); file.removeMetaData(key); Assert.assertTrue(!file.getMetaData().containsKey(key)); } | public Object removeMetaData(String key) { return metaData.remove(key); } | AVFile { public Object removeMetaData(String key) { return metaData.remove(key); } } | AVFile { public Object removeMetaData(String key) { return metaData.remove(key); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); } | AVFile { public Object removeMetaData(String key) { return metaData.remove(key); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); } | AVFile { public Object removeMetaData(String key) { return metaData.remove(key); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); static String DEFAULTMIMETYPE; static final String AVFILE_ENDPOINT; } |
@Test public void testClearMetaData() { AVFile file = new AVFile("name", TEST_FILE_CONTENT.getBytes()); Assert.assertTrue(!file.getMetaData().isEmpty()); file.clearMetaData(); Assert.assertTrue(file.getMetaData().isEmpty()); } | public void clearMetaData() { this.metaData.clear(); } | AVFile { public void clearMetaData() { this.metaData.clear(); } } | AVFile { public void clearMetaData() { this.metaData.clear(); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); } | AVFile { public void clearMetaData() { this.metaData.clear(); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); } | AVFile { public void clearMetaData() { this.metaData.clear(); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); static String DEFAULTMIMETYPE; static final String AVFILE_ENDPOINT; } |
@Test public void testGetOwnerObjectId() { AVFile file = new AVFile("name", TEST_FILE_CONTENT.getBytes()); Assert.assertTrue(AVUtils.isBlankContent(file.getOwnerObjectId())); } | public String getOwnerObjectId() { return (String) getMetaData("owner"); } | AVFile { public String getOwnerObjectId() { return (String) getMetaData("owner"); } } | AVFile { public String getOwnerObjectId() { return (String) getMetaData("owner"); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); } | AVFile { public String getOwnerObjectId() { return (String) getMetaData("owner"); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); } | AVFile { public String getOwnerObjectId() { return (String) getMetaData("owner"); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); static String DEFAULTMIMETYPE; static final String AVFILE_ENDPOINT; } |
@Test public void testWithObjectIdInBackground() throws Exception { final AVFile file = new AVFile("name", TEST_FILE_CONTENT.getBytes()); file.save(); final CountDownLatch latch = new CountDownLatch(1); AVFile.withObjectIdInBackground(file.getObjectId(), new GetFileCallback<AVFile>() { @Override public void done(AVFile object, AVException e) { Assert.assertEquals(file.getOriginalName(), object.getOriginalName()); Assert.assertEquals(file.getObjectId(), object.getObjectId()); Assert.assertEquals(file.getUrl(), object.getUrl()); Assert.assertNotNull(object.getBucket()); Assert.assertEquals(file.getMetaData(), object.getMetaData()); latch.countDown(); } }); file.delete(); } | public static void withObjectIdInBackground(final String objectId, final GetFileCallback<AVFile> cb) { AVQuery<AVObject> query = new AVQuery<AVObject>("_File"); query.getInBackground(objectId, new GetCallback<AVObject>() { @Override public void done(AVObject object, AVException e) { if (e != null) { if (null != cb) { cb.internalDone(null, e); } return; } if (object != null && !AVUtils.isBlankString(object.getObjectId())) { AVFile file = createFileFromAVObject(object); if (cb != null) { cb.internalDone(file, null); } } else if (null != cb) { cb.internalDone(null, new AVException(AVException.OBJECT_NOT_FOUND, "Could not find file object by id:" + objectId)); } } }); } | AVFile { public static void withObjectIdInBackground(final String objectId, final GetFileCallback<AVFile> cb) { AVQuery<AVObject> query = new AVQuery<AVObject>("_File"); query.getInBackground(objectId, new GetCallback<AVObject>() { @Override public void done(AVObject object, AVException e) { if (e != null) { if (null != cb) { cb.internalDone(null, e); } return; } if (object != null && !AVUtils.isBlankString(object.getObjectId())) { AVFile file = createFileFromAVObject(object); if (cb != null) { cb.internalDone(file, null); } } else if (null != cb) { cb.internalDone(null, new AVException(AVException.OBJECT_NOT_FOUND, "Could not find file object by id:" + objectId)); } } }); } } | AVFile { public static void withObjectIdInBackground(final String objectId, final GetFileCallback<AVFile> cb) { AVQuery<AVObject> query = new AVQuery<AVObject>("_File"); query.getInBackground(objectId, new GetCallback<AVObject>() { @Override public void done(AVObject object, AVException e) { if (e != null) { if (null != cb) { cb.internalDone(null, e); } return; } if (object != null && !AVUtils.isBlankString(object.getObjectId())) { AVFile file = createFileFromAVObject(object); if (cb != null) { cb.internalDone(file, null); } } else if (null != cb) { cb.internalDone(null, new AVException(AVException.OBJECT_NOT_FOUND, "Could not find file object by id:" + objectId)); } } }); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); } | AVFile { public static void withObjectIdInBackground(final String objectId, final GetFileCallback<AVFile> cb) { AVQuery<AVObject> query = new AVQuery<AVObject>("_File"); query.getInBackground(objectId, new GetCallback<AVObject>() { @Override public void done(AVObject object, AVException e) { if (e != null) { if (null != cb) { cb.internalDone(null, e); } return; } if (object != null && !AVUtils.isBlankString(object.getObjectId())) { AVFile file = createFileFromAVObject(object); if (cb != null) { cb.internalDone(file, null); } } else if (null != cb) { cb.internalDone(null, new AVException(AVException.OBJECT_NOT_FOUND, "Could not find file object by id:" + objectId)); } } }); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); } | AVFile { public static void withObjectIdInBackground(final String objectId, final GetFileCallback<AVFile> cb) { AVQuery<AVObject> query = new AVQuery<AVObject>("_File"); query.getInBackground(objectId, new GetCallback<AVObject>() { @Override public void done(AVObject object, AVException e) { if (e != null) { if (null != cb) { cb.internalDone(null, e); } return; } if (object != null && !AVUtils.isBlankString(object.getObjectId())) { AVFile file = createFileFromAVObject(object); if (cb != null) { cb.internalDone(file, null); } } else if (null != cb) { cb.internalDone(null, new AVException(AVException.OBJECT_NOT_FOUND, "Could not find file object by id:" + objectId)); } } }); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); static String DEFAULTMIMETYPE; static final String AVFILE_ENDPOINT; } |
@Test public void testSaveInBackground() throws Exception { final CountDownLatch latch = new CountDownLatch(1); final AVFile file = new AVFile("name", TEST_FILE_CONTENT.getBytes()); file.saveInBackground(new SaveCallback() { @Override protected boolean mustRunOnUIThread() { return false; } @Override public void done(AVException e) { System.out.println("file saved. objectId=" + file.getObjectId()); System.out.println("url=" + file.getUrl()); Assert.assertNull(e); Assert.assertTrue(file.getObjectId().length() > 0); Assert.assertTrue(file.getUrl().length() > 0); latch.countDown(); } }); latch.await(60, TimeUnit.SECONDS); file.delete(); } | public synchronized void saveInBackground(final SaveCallback saveCallback, final ProgressCallback progressCallback) { if (AVUtils.isBlankString(objectId)) { cancelUploadIfNeed(); uploader = getUploader(saveCallback, progressCallback); uploader.execute(); } else { if (null != saveCallback) { saveCallback.internalDone(null); } if (null != progressCallback) { progressCallback.internalDone(100, null); } } } | AVFile { public synchronized void saveInBackground(final SaveCallback saveCallback, final ProgressCallback progressCallback) { if (AVUtils.isBlankString(objectId)) { cancelUploadIfNeed(); uploader = getUploader(saveCallback, progressCallback); uploader.execute(); } else { if (null != saveCallback) { saveCallback.internalDone(null); } if (null != progressCallback) { progressCallback.internalDone(100, null); } } } } | AVFile { public synchronized void saveInBackground(final SaveCallback saveCallback, final ProgressCallback progressCallback) { if (AVUtils.isBlankString(objectId)) { cancelUploadIfNeed(); uploader = getUploader(saveCallback, progressCallback); uploader.execute(); } else { if (null != saveCallback) { saveCallback.internalDone(null); } if (null != progressCallback) { progressCallback.internalDone(100, null); } } } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); } | AVFile { public synchronized void saveInBackground(final SaveCallback saveCallback, final ProgressCallback progressCallback) { if (AVUtils.isBlankString(objectId)) { cancelUploadIfNeed(); uploader = getUploader(saveCallback, progressCallback); uploader.execute(); } else { if (null != saveCallback) { saveCallback.internalDone(null); } if (null != progressCallback) { progressCallback.internalDone(100, null); } } } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); } | AVFile { public synchronized void saveInBackground(final SaveCallback saveCallback, final ProgressCallback progressCallback) { if (AVUtils.isBlankString(objectId)) { cancelUploadIfNeed(); uploader = getUploader(saveCallback, progressCallback); uploader.execute(); } else { if (null != saveCallback) { saveCallback.internalDone(null); } if (null != progressCallback) { progressCallback.internalDone(100, null); } } } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); static String DEFAULTMIMETYPE; static final String AVFILE_ENDPOINT; } |
@Test public void testParseFileWithObjectId() throws Exception { AVFile file = new AVFile("name", TEST_FILE_CONTENT.getBytes()); file.save(); AVFile newFile = AVFile.parseFileWithObjectId(file.getObjectId()); Assert.assertNotNull(newFile); Assert.assertNotNull(newFile.getObjectId()); Assert.assertNotNull(newFile.getOriginalName()); Assert.assertNotNull(newFile.getBucket()); Assert.assertNotNull(newFile.getMetaData()); file.delete(); } | @Deprecated static public AVFile parseFileWithObjectId(String objectId) throws AVException, FileNotFoundException { return withObjectId(objectId); } | AVFile { @Deprecated static public AVFile parseFileWithObjectId(String objectId) throws AVException, FileNotFoundException { return withObjectId(objectId); } } | AVFile { @Deprecated static public AVFile parseFileWithObjectId(String objectId) throws AVException, FileNotFoundException { return withObjectId(objectId); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); } | AVFile { @Deprecated static public AVFile parseFileWithObjectId(String objectId) throws AVException, FileNotFoundException { return withObjectId(objectId); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); } | AVFile { @Deprecated static public AVFile parseFileWithObjectId(String objectId) throws AVException, FileNotFoundException { return withObjectId(objectId); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); static String DEFAULTMIMETYPE; static final String AVFILE_ENDPOINT; } |
@Test public void testWithObjectId() throws Exception { AVFile file = new AVFile("name", TEST_FILE_CONTENT.getBytes()); file.save(); AVFile newFile = AVFile.withObjectId(file.getObjectId()); Assert.assertNotNull(newFile); Assert.assertNotNull(newFile.getObjectId()); Assert.assertNotNull(newFile.getOriginalName()); Assert.assertNotNull(newFile.getBucket()); Assert.assertNotNull(newFile.getMetaData()); file.delete(); } | public static AVFile withObjectId(String objectId) throws AVException, FileNotFoundException { AVQuery<AVObject> query = new AVQuery<AVObject>("_File"); AVObject object = query.get(objectId); if (object != null && !AVUtils.isBlankString(object.getObjectId())) { AVFile file = createFileFromAVObject(object); return file; } else { throw new FileNotFoundException("Could not find file object by id:" + objectId); } } | AVFile { public static AVFile withObjectId(String objectId) throws AVException, FileNotFoundException { AVQuery<AVObject> query = new AVQuery<AVObject>("_File"); AVObject object = query.get(objectId); if (object != null && !AVUtils.isBlankString(object.getObjectId())) { AVFile file = createFileFromAVObject(object); return file; } else { throw new FileNotFoundException("Could not find file object by id:" + objectId); } } } | AVFile { public static AVFile withObjectId(String objectId) throws AVException, FileNotFoundException { AVQuery<AVObject> query = new AVQuery<AVObject>("_File"); AVObject object = query.get(objectId); if (object != null && !AVUtils.isBlankString(object.getObjectId())) { AVFile file = createFileFromAVObject(object); return file; } else { throw new FileNotFoundException("Could not find file object by id:" + objectId); } } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); } | AVFile { public static AVFile withObjectId(String objectId) throws AVException, FileNotFoundException { AVQuery<AVObject> query = new AVQuery<AVObject>("_File"); AVObject object = query.get(objectId); if (object != null && !AVUtils.isBlankString(object.getObjectId())) { AVFile file = createFileFromAVObject(object); return file; } else { throw new FileNotFoundException("Could not find file object by id:" + objectId); } } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); } | AVFile { public static AVFile withObjectId(String objectId) throws AVException, FileNotFoundException { AVQuery<AVObject> query = new AVQuery<AVObject>("_File"); AVObject object = query.get(objectId); if (object != null && !AVUtils.isBlankString(object.getObjectId())) { AVFile file = createFileFromAVObject(object); return file; } else { throw new FileNotFoundException("Could not find file object by id:" + objectId); } } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); static String DEFAULTMIMETYPE; static final String AVFILE_ENDPOINT; } |
@Test public void testWithAVObject() throws Exception { AVFile file = new AVFile("name", TEST_FILE_CONTENT.getBytes()); file.save(); AVQuery<AVObject> query = new AVQuery<AVObject>("_File"); AVObject object = query.get(file.getObjectId()); AVFile newFile = AVFile.withAVObject(object); Assert.assertEquals(file.getOriginalName(), newFile.getOriginalName()); Assert.assertEquals(file.getObjectId(), newFile.getObjectId()); Assert.assertEquals(file.getUrl(), newFile.getUrl()); Assert.assertNotNull(newFile.getBucket()); Assert.assertEquals(file.getMetaData(), newFile.getMetaData()); file.delete(); } | public static AVFile withAVObject(AVObject obj) { if (obj != null && !AVUtils.isBlankString(obj.getObjectId())) { AVFile file = createFileFromAVObject(obj); return file; } else { throw new IllegalArgumentException("Invalid AVObject."); } } | AVFile { public static AVFile withAVObject(AVObject obj) { if (obj != null && !AVUtils.isBlankString(obj.getObjectId())) { AVFile file = createFileFromAVObject(obj); return file; } else { throw new IllegalArgumentException("Invalid AVObject."); } } } | AVFile { public static AVFile withAVObject(AVObject obj) { if (obj != null && !AVUtils.isBlankString(obj.getObjectId())) { AVFile file = createFileFromAVObject(obj); return file; } else { throw new IllegalArgumentException("Invalid AVObject."); } } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); } | AVFile { public static AVFile withAVObject(AVObject obj) { if (obj != null && !AVUtils.isBlankString(obj.getObjectId())) { AVFile file = createFileFromAVObject(obj); return file; } else { throw new IllegalArgumentException("Invalid AVObject."); } } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); } | AVFile { public static AVFile withAVObject(AVObject obj) { if (obj != null && !AVUtils.isBlankString(obj.getObjectId())) { AVFile file = createFileFromAVObject(obj); return file; } else { throw new IllegalArgumentException("Invalid AVObject."); } } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); static String DEFAULTMIMETYPE; static final String AVFILE_ENDPOINT; } |
@Test public void testWithAbsoluteLocalPath() throws Exception { File file = new File(getAVFileCachePath(), "test"); AVPersistenceUtils.saveContentToFile(TEST_FILE_CONTENT, file); AVFile newFile = AVFile.withAbsoluteLocalPath("name", file.getAbsolutePath()); Assert.assertNotNull(newFile); Assert.assertNotNull(newFile.getOriginalName()); Assert.assertNotNull(newFile.getMetaData()); Assert.assertArrayEquals(TEST_FILE_CONTENT.getBytes(), newFile.getData()); } | public static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath) throws FileNotFoundException { return withFile(name, new File(absoluteLocalFilePath)); } | AVFile { public static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath) throws FileNotFoundException { return withFile(name, new File(absoluteLocalFilePath)); } } | AVFile { public static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath) throws FileNotFoundException { return withFile(name, new File(absoluteLocalFilePath)); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); } | AVFile { public static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath) throws FileNotFoundException { return withFile(name, new File(absoluteLocalFilePath)); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); } | AVFile { public static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath) throws FileNotFoundException { return withFile(name, new File(absoluteLocalFilePath)); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); static String DEFAULTMIMETYPE; static final String AVFILE_ENDPOINT; } |
@Test public void testWithFile() throws Exception { File file = new File(getAVFileCachePath(), "test"); AVPersistenceUtils.saveContentToFile(TEST_FILE_CONTENT, file); AVFile newFile = AVFile.withFile("name", file); Assert.assertNotNull(newFile); Assert.assertNotNull(newFile.getOriginalName()); Assert.assertNotNull(newFile.getMetaData()); Assert.assertArrayEquals(TEST_FILE_CONTENT.getBytes(), newFile.getData()); } | public static AVFile withFile(String name, File file) throws FileNotFoundException { if (file == null) { throw new IllegalArgumentException("null file object."); } if (!file.exists() || !file.isFile()) { throw new FileNotFoundException(); } AVFile avFile = new AVFile(); avFile.setLocalPath(file.getAbsolutePath()); avFile.setName(name); avFile.dirty = true; avFile.name = name; long fileSize = file.length(); String fileMD5 = ""; try { InputStream is = AVPersistenceUtils.getInputStreamFromFile(file); MessageDigest md = MessageDigest.getInstance("MD5"); if (null != is) { byte buf[] = new byte[(int)MAX_FILE_BUF_SIZE]; int len; while ((len = is.read(buf)) != -1) { md.update(buf, 0, len); } byte[] md5bytes = md.digest(); fileMD5 = AVUtils.hexEncodeBytes(md5bytes); is.close(); } } catch (Exception ex) { fileMD5 = ""; } avFile.metaData.put("size", fileSize); avFile.metaData.put(FILE_SUM_KEY, fileMD5); AVUser currentUser = AVUser.getCurrentUser(); avFile.metaData.put("owner", currentUser != null ? currentUser.getObjectId() : ""); avFile.metaData.put(FILE_NAME_KEY, name); return avFile; } | AVFile { public static AVFile withFile(String name, File file) throws FileNotFoundException { if (file == null) { throw new IllegalArgumentException("null file object."); } if (!file.exists() || !file.isFile()) { throw new FileNotFoundException(); } AVFile avFile = new AVFile(); avFile.setLocalPath(file.getAbsolutePath()); avFile.setName(name); avFile.dirty = true; avFile.name = name; long fileSize = file.length(); String fileMD5 = ""; try { InputStream is = AVPersistenceUtils.getInputStreamFromFile(file); MessageDigest md = MessageDigest.getInstance("MD5"); if (null != is) { byte buf[] = new byte[(int)MAX_FILE_BUF_SIZE]; int len; while ((len = is.read(buf)) != -1) { md.update(buf, 0, len); } byte[] md5bytes = md.digest(); fileMD5 = AVUtils.hexEncodeBytes(md5bytes); is.close(); } } catch (Exception ex) { fileMD5 = ""; } avFile.metaData.put("size", fileSize); avFile.metaData.put(FILE_SUM_KEY, fileMD5); AVUser currentUser = AVUser.getCurrentUser(); avFile.metaData.put("owner", currentUser != null ? currentUser.getObjectId() : ""); avFile.metaData.put(FILE_NAME_KEY, name); return avFile; } } | AVFile { public static AVFile withFile(String name, File file) throws FileNotFoundException { if (file == null) { throw new IllegalArgumentException("null file object."); } if (!file.exists() || !file.isFile()) { throw new FileNotFoundException(); } AVFile avFile = new AVFile(); avFile.setLocalPath(file.getAbsolutePath()); avFile.setName(name); avFile.dirty = true; avFile.name = name; long fileSize = file.length(); String fileMD5 = ""; try { InputStream is = AVPersistenceUtils.getInputStreamFromFile(file); MessageDigest md = MessageDigest.getInstance("MD5"); if (null != is) { byte buf[] = new byte[(int)MAX_FILE_BUF_SIZE]; int len; while ((len = is.read(buf)) != -1) { md.update(buf, 0, len); } byte[] md5bytes = md.digest(); fileMD5 = AVUtils.hexEncodeBytes(md5bytes); is.close(); } } catch (Exception ex) { fileMD5 = ""; } avFile.metaData.put("size", fileSize); avFile.metaData.put(FILE_SUM_KEY, fileMD5); AVUser currentUser = AVUser.getCurrentUser(); avFile.metaData.put("owner", currentUser != null ? currentUser.getObjectId() : ""); avFile.metaData.put(FILE_NAME_KEY, name); return avFile; } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); } | AVFile { public static AVFile withFile(String name, File file) throws FileNotFoundException { if (file == null) { throw new IllegalArgumentException("null file object."); } if (!file.exists() || !file.isFile()) { throw new FileNotFoundException(); } AVFile avFile = new AVFile(); avFile.setLocalPath(file.getAbsolutePath()); avFile.setName(name); avFile.dirty = true; avFile.name = name; long fileSize = file.length(); String fileMD5 = ""; try { InputStream is = AVPersistenceUtils.getInputStreamFromFile(file); MessageDigest md = MessageDigest.getInstance("MD5"); if (null != is) { byte buf[] = new byte[(int)MAX_FILE_BUF_SIZE]; int len; while ((len = is.read(buf)) != -1) { md.update(buf, 0, len); } byte[] md5bytes = md.digest(); fileMD5 = AVUtils.hexEncodeBytes(md5bytes); is.close(); } } catch (Exception ex) { fileMD5 = ""; } avFile.metaData.put("size", fileSize); avFile.metaData.put(FILE_SUM_KEY, fileMD5); AVUser currentUser = AVUser.getCurrentUser(); avFile.metaData.put("owner", currentUser != null ? currentUser.getObjectId() : ""); avFile.metaData.put(FILE_NAME_KEY, name); return avFile; } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); } | AVFile { public static AVFile withFile(String name, File file) throws FileNotFoundException { if (file == null) { throw new IllegalArgumentException("null file object."); } if (!file.exists() || !file.isFile()) { throw new FileNotFoundException(); } AVFile avFile = new AVFile(); avFile.setLocalPath(file.getAbsolutePath()); avFile.setName(name); avFile.dirty = true; avFile.name = name; long fileSize = file.length(); String fileMD5 = ""; try { InputStream is = AVPersistenceUtils.getInputStreamFromFile(file); MessageDigest md = MessageDigest.getInstance("MD5"); if (null != is) { byte buf[] = new byte[(int)MAX_FILE_BUF_SIZE]; int len; while ((len = is.read(buf)) != -1) { md.update(buf, 0, len); } byte[] md5bytes = md.digest(); fileMD5 = AVUtils.hexEncodeBytes(md5bytes); is.close(); } } catch (Exception ex) { fileMD5 = ""; } avFile.metaData.put("size", fileSize); avFile.metaData.put(FILE_SUM_KEY, fileMD5); AVUser currentUser = AVUser.getCurrentUser(); avFile.metaData.put("owner", currentUser != null ? currentUser.getObjectId() : ""); avFile.metaData.put(FILE_NAME_KEY, name); return avFile; } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); static String DEFAULTMIMETYPE; static final String AVFILE_ENDPOINT; } |
@Test public void testRemoveExistTag() { AVSessionCacheHelper.getTagCacheInstance().addSession(testClientId, testClientTag); AVSessionCacheHelper.getTagCacheInstance().removeSession(testClientId); Map<String, String> map = AVSessionCacheHelper.getTagCacheInstance().getAllSession(); Assert.assertTrue(map.size() == 0); } | static synchronized SessionTagCache getTagCacheInstance() { if (null == tagCacheInstance) { tagCacheInstance = new SessionTagCache(); } return tagCacheInstance; } | AVSessionCacheHelper { static synchronized SessionTagCache getTagCacheInstance() { if (null == tagCacheInstance) { tagCacheInstance = new SessionTagCache(); } return tagCacheInstance; } } | AVSessionCacheHelper { static synchronized SessionTagCache getTagCacheInstance() { if (null == tagCacheInstance) { tagCacheInstance = new SessionTagCache(); } return tagCacheInstance; } } | AVSessionCacheHelper { static synchronized SessionTagCache getTagCacheInstance() { if (null == tagCacheInstance) { tagCacheInstance = new SessionTagCache(); } return tagCacheInstance; } } | AVSessionCacheHelper { static synchronized SessionTagCache getTagCacheInstance() { if (null == tagCacheInstance) { tagCacheInstance = new SessionTagCache(); } return tagCacheInstance; } } |
@Test public void testGetData() throws Exception { AVFile file = new AVFile("name", TEST_FILE_CONTENT.getBytes()); file.save(); AVQuery<AVObject> query = new AVQuery<AVObject>("_File"); AVObject object = query.get(file.getObjectId()); AVFile newFile = AVFile.withAVObject(object); byte[] byteData = newFile.getData(); Assert.assertArrayEquals(TEST_FILE_CONTENT.getBytes(), byteData); file.delete(); } | @Deprecated @JSONField(serialize = false) public byte[] getData() throws AVException { if (!AVUtils.isBlankString(localPath)) { return getLocalFileData(); } else if (!AVUtils.isBlankString(localTmpFilePath)) { return getTmpFileData(); } else if (!AVUtils.isBlankString(url)) { byte[] data = getCacheData(); if (null != data) { return data; } if (!AVUtils.isConnected(AVOSCloud.applicationContext)) { throw new AVException(AVException.CONNECTION_FAILED, "Connection lost"); } else { cancelDownloadIfNeed(); downloader = new AVFileDownloader(); AVException exception = downloader.doWork(getUrl()); if (exception != null) { throw exception; } return getCacheData(); } } return null; } | AVFile { @Deprecated @JSONField(serialize = false) public byte[] getData() throws AVException { if (!AVUtils.isBlankString(localPath)) { return getLocalFileData(); } else if (!AVUtils.isBlankString(localTmpFilePath)) { return getTmpFileData(); } else if (!AVUtils.isBlankString(url)) { byte[] data = getCacheData(); if (null != data) { return data; } if (!AVUtils.isConnected(AVOSCloud.applicationContext)) { throw new AVException(AVException.CONNECTION_FAILED, "Connection lost"); } else { cancelDownloadIfNeed(); downloader = new AVFileDownloader(); AVException exception = downloader.doWork(getUrl()); if (exception != null) { throw exception; } return getCacheData(); } } return null; } } | AVFile { @Deprecated @JSONField(serialize = false) public byte[] getData() throws AVException { if (!AVUtils.isBlankString(localPath)) { return getLocalFileData(); } else if (!AVUtils.isBlankString(localTmpFilePath)) { return getTmpFileData(); } else if (!AVUtils.isBlankString(url)) { byte[] data = getCacheData(); if (null != data) { return data; } if (!AVUtils.isConnected(AVOSCloud.applicationContext)) { throw new AVException(AVException.CONNECTION_FAILED, "Connection lost"); } else { cancelDownloadIfNeed(); downloader = new AVFileDownloader(); AVException exception = downloader.doWork(getUrl()); if (exception != null) { throw exception; } return getCacheData(); } } return null; } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); } | AVFile { @Deprecated @JSONField(serialize = false) public byte[] getData() throws AVException { if (!AVUtils.isBlankString(localPath)) { return getLocalFileData(); } else if (!AVUtils.isBlankString(localTmpFilePath)) { return getTmpFileData(); } else if (!AVUtils.isBlankString(url)) { byte[] data = getCacheData(); if (null != data) { return data; } if (!AVUtils.isConnected(AVOSCloud.applicationContext)) { throw new AVException(AVException.CONNECTION_FAILED, "Connection lost"); } else { cancelDownloadIfNeed(); downloader = new AVFileDownloader(); AVException exception = downloader.doWork(getUrl()); if (exception != null) { throw exception; } return getCacheData(); } } return null; } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); } | AVFile { @Deprecated @JSONField(serialize = false) public byte[] getData() throws AVException { if (!AVUtils.isBlankString(localPath)) { return getLocalFileData(); } else if (!AVUtils.isBlankString(localTmpFilePath)) { return getTmpFileData(); } else if (!AVUtils.isBlankString(url)) { byte[] data = getCacheData(); if (null != data) { return data; } if (!AVUtils.isConnected(AVOSCloud.applicationContext)) { throw new AVException(AVException.CONNECTION_FAILED, "Connection lost"); } else { cancelDownloadIfNeed(); downloader = new AVFileDownloader(); AVException exception = downloader.doWork(getUrl()); if (exception != null) { throw exception; } return getCacheData(); } } return null; } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); static String DEFAULTMIMETYPE; static final String AVFILE_ENDPOINT; } |
@Test public void testGetDataNonExistentFile() throws Exception { AVFile file = new AVFile(null, "http: boolean result = false; try { file.getData(); } catch (Exception e) { result = true; } Assert.assertTrue(result); } | @Deprecated @JSONField(serialize = false) public byte[] getData() throws AVException { if (!AVUtils.isBlankString(localPath)) { return getLocalFileData(); } else if (!AVUtils.isBlankString(localTmpFilePath)) { return getTmpFileData(); } else if (!AVUtils.isBlankString(url)) { byte[] data = getCacheData(); if (null != data) { return data; } if (!AVUtils.isConnected(AVOSCloud.applicationContext)) { throw new AVException(AVException.CONNECTION_FAILED, "Connection lost"); } else { cancelDownloadIfNeed(); downloader = new AVFileDownloader(); AVException exception = downloader.doWork(getUrl()); if (exception != null) { throw exception; } return getCacheData(); } } return null; } | AVFile { @Deprecated @JSONField(serialize = false) public byte[] getData() throws AVException { if (!AVUtils.isBlankString(localPath)) { return getLocalFileData(); } else if (!AVUtils.isBlankString(localTmpFilePath)) { return getTmpFileData(); } else if (!AVUtils.isBlankString(url)) { byte[] data = getCacheData(); if (null != data) { return data; } if (!AVUtils.isConnected(AVOSCloud.applicationContext)) { throw new AVException(AVException.CONNECTION_FAILED, "Connection lost"); } else { cancelDownloadIfNeed(); downloader = new AVFileDownloader(); AVException exception = downloader.doWork(getUrl()); if (exception != null) { throw exception; } return getCacheData(); } } return null; } } | AVFile { @Deprecated @JSONField(serialize = false) public byte[] getData() throws AVException { if (!AVUtils.isBlankString(localPath)) { return getLocalFileData(); } else if (!AVUtils.isBlankString(localTmpFilePath)) { return getTmpFileData(); } else if (!AVUtils.isBlankString(url)) { byte[] data = getCacheData(); if (null != data) { return data; } if (!AVUtils.isConnected(AVOSCloud.applicationContext)) { throw new AVException(AVException.CONNECTION_FAILED, "Connection lost"); } else { cancelDownloadIfNeed(); downloader = new AVFileDownloader(); AVException exception = downloader.doWork(getUrl()); if (exception != null) { throw exception; } return getCacheData(); } } return null; } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); } | AVFile { @Deprecated @JSONField(serialize = false) public byte[] getData() throws AVException { if (!AVUtils.isBlankString(localPath)) { return getLocalFileData(); } else if (!AVUtils.isBlankString(localTmpFilePath)) { return getTmpFileData(); } else if (!AVUtils.isBlankString(url)) { byte[] data = getCacheData(); if (null != data) { return data; } if (!AVUtils.isConnected(AVOSCloud.applicationContext)) { throw new AVException(AVException.CONNECTION_FAILED, "Connection lost"); } else { cancelDownloadIfNeed(); downloader = new AVFileDownloader(); AVException exception = downloader.doWork(getUrl()); if (exception != null) { throw exception; } return getCacheData(); } } return null; } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); } | AVFile { @Deprecated @JSONField(serialize = false) public byte[] getData() throws AVException { if (!AVUtils.isBlankString(localPath)) { return getLocalFileData(); } else if (!AVUtils.isBlankString(localTmpFilePath)) { return getTmpFileData(); } else if (!AVUtils.isBlankString(url)) { byte[] data = getCacheData(); if (null != data) { return data; } if (!AVUtils.isConnected(AVOSCloud.applicationContext)) { throw new AVException(AVException.CONNECTION_FAILED, "Connection lost"); } else { cancelDownloadIfNeed(); downloader = new AVFileDownloader(); AVException exception = downloader.doWork(getUrl()); if (exception != null) { throw exception; } return getCacheData(); } } return null; } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); static String DEFAULTMIMETYPE; static final String AVFILE_ENDPOINT; } |
@Test public void testGetDataInBackground() throws Exception { AVFile file = new AVFile("name", TEST_FILE_CONTENT.getBytes()); file.save(); AVQuery<AVObject> query = new AVQuery<AVObject>("_File"); AVObject object = query.get(file.getObjectId()); AVFile newFile = AVFile.withAVObject(object); final CountDownLatch latch = new CountDownLatch(1); final StringBuffer content = new StringBuffer(); newFile.getDataInBackground(new GetDataCallback() { @Override public void done(byte[] data, AVException e) { content.append(new String(data)); Assert.assertNull(e); Assert.assertNotNull(data); latch.countDown(); } }); latch.await(60, TimeUnit.SECONDS); Assert.assertEquals(TEST_FILE_CONTENT, content.toString()); file.delete(); } | public void getDataInBackground(final GetDataCallback dataCallback, final ProgressCallback progressCallback) { if (!AVUtils.isBlankString(localPath)) { if (null != progressCallback) { progressCallback.done(100); } if (dataCallback != null) { dataCallback.internalDone(getLocalFileData(), null); } } else if (!AVUtils.isBlankString(localTmpFilePath)) { if (null != progressCallback) { progressCallback.done(100); } if (dataCallback != null) { dataCallback.internalDone(getTmpFileData(), null); } } else if (!AVUtils.isBlankString(getUrl())) { cancelDownloadIfNeed(); downloader = new AVFileDownloader(progressCallback, dataCallback); downloader.execute(getUrl()); } else if (dataCallback != null) { dataCallback.internalDone(new AVException(AVException.INVALID_FILE_URL, "")); } } | AVFile { public void getDataInBackground(final GetDataCallback dataCallback, final ProgressCallback progressCallback) { if (!AVUtils.isBlankString(localPath)) { if (null != progressCallback) { progressCallback.done(100); } if (dataCallback != null) { dataCallback.internalDone(getLocalFileData(), null); } } else if (!AVUtils.isBlankString(localTmpFilePath)) { if (null != progressCallback) { progressCallback.done(100); } if (dataCallback != null) { dataCallback.internalDone(getTmpFileData(), null); } } else if (!AVUtils.isBlankString(getUrl())) { cancelDownloadIfNeed(); downloader = new AVFileDownloader(progressCallback, dataCallback); downloader.execute(getUrl()); } else if (dataCallback != null) { dataCallback.internalDone(new AVException(AVException.INVALID_FILE_URL, "")); } } } | AVFile { public void getDataInBackground(final GetDataCallback dataCallback, final ProgressCallback progressCallback) { if (!AVUtils.isBlankString(localPath)) { if (null != progressCallback) { progressCallback.done(100); } if (dataCallback != null) { dataCallback.internalDone(getLocalFileData(), null); } } else if (!AVUtils.isBlankString(localTmpFilePath)) { if (null != progressCallback) { progressCallback.done(100); } if (dataCallback != null) { dataCallback.internalDone(getTmpFileData(), null); } } else if (!AVUtils.isBlankString(getUrl())) { cancelDownloadIfNeed(); downloader = new AVFileDownloader(progressCallback, dataCallback); downloader.execute(getUrl()); } else if (dataCallback != null) { dataCallback.internalDone(new AVException(AVException.INVALID_FILE_URL, "")); } } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); } | AVFile { public void getDataInBackground(final GetDataCallback dataCallback, final ProgressCallback progressCallback) { if (!AVUtils.isBlankString(localPath)) { if (null != progressCallback) { progressCallback.done(100); } if (dataCallback != null) { dataCallback.internalDone(getLocalFileData(), null); } } else if (!AVUtils.isBlankString(localTmpFilePath)) { if (null != progressCallback) { progressCallback.done(100); } if (dataCallback != null) { dataCallback.internalDone(getTmpFileData(), null); } } else if (!AVUtils.isBlankString(getUrl())) { cancelDownloadIfNeed(); downloader = new AVFileDownloader(progressCallback, dataCallback); downloader.execute(getUrl()); } else if (dataCallback != null) { dataCallback.internalDone(new AVException(AVException.INVALID_FILE_URL, "")); } } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); } | AVFile { public void getDataInBackground(final GetDataCallback dataCallback, final ProgressCallback progressCallback) { if (!AVUtils.isBlankString(localPath)) { if (null != progressCallback) { progressCallback.done(100); } if (dataCallback != null) { dataCallback.internalDone(getLocalFileData(), null); } } else if (!AVUtils.isBlankString(localTmpFilePath)) { if (null != progressCallback) { progressCallback.done(100); } if (dataCallback != null) { dataCallback.internalDone(getTmpFileData(), null); } } else if (!AVUtils.isBlankString(getUrl())) { cancelDownloadIfNeed(); downloader = new AVFileDownloader(progressCallback, dataCallback); downloader.execute(getUrl()); } else if (dataCallback != null) { dataCallback.internalDone(new AVException(AVException.INVALID_FILE_URL, "")); } } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); static String DEFAULTMIMETYPE; static final String AVFILE_ENDPOINT; } |
@Test public void testGetDataStreamForLargeFile() throws Exception { final String testUrl = "http: AVFile file = new AVFile("jiuzai", testUrl); final CountDownLatch latch = new CountDownLatch(1); file.getDataStreamInBackground(new GetDataStreamCallback() { @Override public void done(InputStream data, AVException e) { if (null != e || null == data) { Assert.fail(); } else { byte content[] = new byte[10240]; try { int totalRead = 0; int curRead = data.read(content); while (curRead > 0) { totalRead += curRead; curRead = data.read(content); } data.close(); Assert.assertTrue(totalRead > 0); System.out.println("download url:" + testUrl + ", fileSize:" + totalRead); } catch (Exception ex) { ex.printStackTrace(); Assert.fail(); } } latch.countDown(); } }); latch.await(60, TimeUnit.SECONDS); } | public void getDataStreamInBackground(GetDataStreamCallback callback) { getDataStreamInBackground(callback, null); } | AVFile { public void getDataStreamInBackground(GetDataStreamCallback callback) { getDataStreamInBackground(callback, null); } } | AVFile { public void getDataStreamInBackground(GetDataStreamCallback callback) { getDataStreamInBackground(callback, null); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); } | AVFile { public void getDataStreamInBackground(GetDataStreamCallback callback) { getDataStreamInBackground(callback, null); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); } | AVFile { public void getDataStreamInBackground(GetDataStreamCallback callback) { getDataStreamInBackground(callback, null); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); static String DEFAULTMIMETYPE; static final String AVFILE_ENDPOINT; } |
@Test public void testGetDataStreamForExternalFile() throws Exception { final String testUrl = "http: AVFile file = new AVFile("jiuzai", testUrl); final CountDownLatch latch = new CountDownLatch(1); file.getDataStreamInBackground(new GetDataStreamCallback() { @Override public void done(InputStream data, AVException e) { if (null != e || null == data) { Assert.fail(); } else { byte content[] = new byte[10240]; try { int totalRead = 0; int curRead = data.read(content); while (curRead > 0) { totalRead += curRead; curRead = data.read(content); } data.close(); Assert.assertTrue(totalRead > 0); System.out.println("download url:" + testUrl + ", fileSize:" + totalRead); } catch (Exception ex) { ex.printStackTrace(); Assert.fail(); } } latch.countDown(); } }); latch.await(60, TimeUnit.SECONDS); } | public void getDataStreamInBackground(GetDataStreamCallback callback) { getDataStreamInBackground(callback, null); } | AVFile { public void getDataStreamInBackground(GetDataStreamCallback callback) { getDataStreamInBackground(callback, null); } } | AVFile { public void getDataStreamInBackground(GetDataStreamCallback callback) { getDataStreamInBackground(callback, null); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); } | AVFile { public void getDataStreamInBackground(GetDataStreamCallback callback) { getDataStreamInBackground(callback, null); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); } | AVFile { public void getDataStreamInBackground(GetDataStreamCallback callback) { getDataStreamInBackground(callback, null); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); static String DEFAULTMIMETYPE; static final String AVFILE_ENDPOINT; } |
@Test public void testDelete() throws Exception { AVFile file = new AVFile("name", TEST_FILE_CONTENT.getBytes()); file.save(); AVFile cloudFile = AVFile.withObjectId(file.getObjectId()); Assert.assertNotNull(cloudFile); Assert.assertEquals(file.getUrl(), cloudFile.getUrl()); file.delete(); AVException exception = null; AVFile deletedFile = null; try { deletedFile = AVFile.withObjectId(file.getObjectId()); } catch (AVException e) { exception = e; } Assert.assertEquals(exception.code, AVException.OBJECT_NOT_FOUND); Assert.assertNull(deletedFile); } | public void delete() throws AVException { if (getFileObject() != null) getFileObject().delete(); else throw AVErrorUtils.createException(AVException.FILE_DELETE_ERROR, "File object is not exists."); } | AVFile { public void delete() throws AVException { if (getFileObject() != null) getFileObject().delete(); else throw AVErrorUtils.createException(AVException.FILE_DELETE_ERROR, "File object is not exists."); } } | AVFile { public void delete() throws AVException { if (getFileObject() != null) getFileObject().delete(); else throw AVErrorUtils.createException(AVException.FILE_DELETE_ERROR, "File object is not exists."); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); } | AVFile { public void delete() throws AVException { if (getFileObject() != null) getFileObject().delete(); else throw AVErrorUtils.createException(AVException.FILE_DELETE_ERROR, "File object is not exists."); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); } | AVFile { public void delete() throws AVException { if (getFileObject() != null) getFileObject().delete(); else throw AVErrorUtils.createException(AVException.FILE_DELETE_ERROR, "File object is not exists."); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); static String DEFAULTMIMETYPE; static final String AVFILE_ENDPOINT; } |
@Test public void testDeleteInBackground() throws Exception { AVFile file = new AVFile("name", TEST_FILE_CONTENT.getBytes()); file.save(); AVFile cloudFile = AVFile.withObjectId(file.getObjectId()); Assert.assertNotNull(cloudFile); Assert.assertEquals(file.getUrl(), cloudFile.getUrl()); final CountDownLatch latch = new CountDownLatch(1); file.deleteInBackground(new DeleteCallback() { @Override public void done(AVException e) { Assert.assertNull(e); latch.countDown(); } }); latch.await(1, TimeUnit.MINUTES); AVException exception = null; AVFile deletedFile = null; try { deletedFile = AVFile.withObjectId(file.getObjectId()); } catch (AVException e) { exception = e; } Assert.assertEquals(exception.code, AVException.OBJECT_NOT_FOUND); Assert.assertNull(deletedFile); } | public void deleteInBackground() { if (getFileObject() != null) getFileObject().deleteInBackground(); } | AVFile { public void deleteInBackground() { if (getFileObject() != null) getFileObject().deleteInBackground(); } } | AVFile { public void deleteInBackground() { if (getFileObject() != null) getFileObject().deleteInBackground(); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); } | AVFile { public void deleteInBackground() { if (getFileObject() != null) getFileObject().deleteInBackground(); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); } | AVFile { public void deleteInBackground() { if (getFileObject() != null) getFileObject().deleteInBackground(); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); static String DEFAULTMIMETYPE; static final String AVFILE_ENDPOINT; } |
@Test public void testClearCachedFileBeforeDays() throws Exception { AVFile.clearCacheMoreThanDays(6); } | public static void clearCacheMoreThanDays(int days) { long curTime = System.currentTimeMillis(); if ( days > 0) { curTime -= days * 86400000; } String cacheDir = AVFileDownloader.getAVFileCachePath(); clearDir(new File(cacheDir), curTime); } | AVFile { public static void clearCacheMoreThanDays(int days) { long curTime = System.currentTimeMillis(); if ( days > 0) { curTime -= days * 86400000; } String cacheDir = AVFileDownloader.getAVFileCachePath(); clearDir(new File(cacheDir), curTime); } } | AVFile { public static void clearCacheMoreThanDays(int days) { long curTime = System.currentTimeMillis(); if ( days > 0) { curTime -= days * 86400000; } String cacheDir = AVFileDownloader.getAVFileCachePath(); clearDir(new File(cacheDir), curTime); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); } | AVFile { public static void clearCacheMoreThanDays(int days) { long curTime = System.currentTimeMillis(); if ( days > 0) { curTime -= days * 86400000; } String cacheDir = AVFileDownloader.getAVFileCachePath(); clearDir(new File(cacheDir), curTime); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); } | AVFile { public static void clearCacheMoreThanDays(int days) { long curTime = System.currentTimeMillis(); if ( days > 0) { curTime -= days * 86400000; } String cacheDir = AVFileDownloader.getAVFileCachePath(); clearDir(new File(cacheDir), curTime); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); static String DEFAULTMIMETYPE; static final String AVFILE_ENDPOINT; } |
@Test public void testClearAllCachedFile() throws Exception { AVFile.clearAllCachedFiles(); } | public static void clearAllCachedFiles() { clearCacheMoreThanDays(0); } | AVFile { public static void clearAllCachedFiles() { clearCacheMoreThanDays(0); } } | AVFile { public static void clearAllCachedFiles() { clearCacheMoreThanDays(0); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); } | AVFile { public static void clearAllCachedFiles() { clearCacheMoreThanDays(0); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); } | AVFile { public static void clearAllCachedFiles() { clearCacheMoreThanDays(0); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); static String DEFAULTMIMETYPE; static final String AVFILE_ENDPOINT; } |
@Test public void testRequestSMSCode() throws AVException { AVOSCloud.requestSMSCode(PHONE); } | public static void requestSMSCode(String phone, AVSMSOption smsOption) throws AVException { requestSMSCodeInBackground(phone, smsOption, true, new RequestMobileCodeCallback() { @Override public void done(AVException e) { if (e != null) { AVExceptionHolder.add(e); } } @Override public boolean mustRunOnUIThread() { return false; } }); if (AVExceptionHolder.exists()) { throw AVExceptionHolder.remove(); } } | AVSMS { public static void requestSMSCode(String phone, AVSMSOption smsOption) throws AVException { requestSMSCodeInBackground(phone, smsOption, true, new RequestMobileCodeCallback() { @Override public void done(AVException e) { if (e != null) { AVExceptionHolder.add(e); } } @Override public boolean mustRunOnUIThread() { return false; } }); if (AVExceptionHolder.exists()) { throw AVExceptionHolder.remove(); } } } | AVSMS { public static void requestSMSCode(String phone, AVSMSOption smsOption) throws AVException { requestSMSCodeInBackground(phone, smsOption, true, new RequestMobileCodeCallback() { @Override public void done(AVException e) { if (e != null) { AVExceptionHolder.add(e); } } @Override public boolean mustRunOnUIThread() { return false; } }); if (AVExceptionHolder.exists()) { throw AVExceptionHolder.remove(); } } } | AVSMS { public static void requestSMSCode(String phone, AVSMSOption smsOption) throws AVException { requestSMSCodeInBackground(phone, smsOption, true, new RequestMobileCodeCallback() { @Override public void done(AVException e) { if (e != null) { AVExceptionHolder.add(e); } } @Override public boolean mustRunOnUIThread() { return false; } }); if (AVExceptionHolder.exists()) { throw AVExceptionHolder.remove(); } } static void requestSMSCode(String phone, AVSMSOption smsOption); static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback); static void verifySMSCode(String code, String mobilePhoneNumber); static void verifySMSCodeInBackground(String code, String phoneNumber,
AVMobilePhoneVerifyCallback callback); } | AVSMS { public static void requestSMSCode(String phone, AVSMSOption smsOption) throws AVException { requestSMSCodeInBackground(phone, smsOption, true, new RequestMobileCodeCallback() { @Override public void done(AVException e) { if (e != null) { AVExceptionHolder.add(e); } } @Override public boolean mustRunOnUIThread() { return false; } }); if (AVExceptionHolder.exists()) { throw AVExceptionHolder.remove(); } } static void requestSMSCode(String phone, AVSMSOption smsOption); static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback); static void verifySMSCode(String code, String mobilePhoneNumber); static void verifySMSCodeInBackground(String code, String phoneNumber,
AVMobilePhoneVerifyCallback callback); } |
@Test public void testTagCacheAdd() { AVSessionCacheHelper.getTagCacheInstance().addSession(testClientId, testClientTag); Map<String, String> clientMap = AVSessionCacheHelper.getTagCacheInstance().getAllSession(); Assert.assertTrue(clientMap.size() == 1); Assert.assertTrue(testClientTag.equals(clientMap.get(testClientId))); } | static synchronized SessionTagCache getTagCacheInstance() { if (null == tagCacheInstance) { tagCacheInstance = new SessionTagCache(); } return tagCacheInstance; } | AVSessionCacheHelper { static synchronized SessionTagCache getTagCacheInstance() { if (null == tagCacheInstance) { tagCacheInstance = new SessionTagCache(); } return tagCacheInstance; } } | AVSessionCacheHelper { static synchronized SessionTagCache getTagCacheInstance() { if (null == tagCacheInstance) { tagCacheInstance = new SessionTagCache(); } return tagCacheInstance; } } | AVSessionCacheHelper { static synchronized SessionTagCache getTagCacheInstance() { if (null == tagCacheInstance) { tagCacheInstance = new SessionTagCache(); } return tagCacheInstance; } } | AVSessionCacheHelper { static synchronized SessionTagCache getTagCacheInstance() { if (null == tagCacheInstance) { tagCacheInstance = new SessionTagCache(); } return tagCacheInstance; } } |
@Test public void testRequestSMSCode1() throws AVException { AVOSCloud.requestSMSCode(PHONE, APPLICATION_NAME, OPERATION, TTL); } | public static void requestSMSCode(String phone, AVSMSOption smsOption) throws AVException { requestSMSCodeInBackground(phone, smsOption, true, new RequestMobileCodeCallback() { @Override public void done(AVException e) { if (e != null) { AVExceptionHolder.add(e); } } @Override public boolean mustRunOnUIThread() { return false; } }); if (AVExceptionHolder.exists()) { throw AVExceptionHolder.remove(); } } | AVSMS { public static void requestSMSCode(String phone, AVSMSOption smsOption) throws AVException { requestSMSCodeInBackground(phone, smsOption, true, new RequestMobileCodeCallback() { @Override public void done(AVException e) { if (e != null) { AVExceptionHolder.add(e); } } @Override public boolean mustRunOnUIThread() { return false; } }); if (AVExceptionHolder.exists()) { throw AVExceptionHolder.remove(); } } } | AVSMS { public static void requestSMSCode(String phone, AVSMSOption smsOption) throws AVException { requestSMSCodeInBackground(phone, smsOption, true, new RequestMobileCodeCallback() { @Override public void done(AVException e) { if (e != null) { AVExceptionHolder.add(e); } } @Override public boolean mustRunOnUIThread() { return false; } }); if (AVExceptionHolder.exists()) { throw AVExceptionHolder.remove(); } } } | AVSMS { public static void requestSMSCode(String phone, AVSMSOption smsOption) throws AVException { requestSMSCodeInBackground(phone, smsOption, true, new RequestMobileCodeCallback() { @Override public void done(AVException e) { if (e != null) { AVExceptionHolder.add(e); } } @Override public boolean mustRunOnUIThread() { return false; } }); if (AVExceptionHolder.exists()) { throw AVExceptionHolder.remove(); } } static void requestSMSCode(String phone, AVSMSOption smsOption); static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback); static void verifySMSCode(String code, String mobilePhoneNumber); static void verifySMSCodeInBackground(String code, String phoneNumber,
AVMobilePhoneVerifyCallback callback); } | AVSMS { public static void requestSMSCode(String phone, AVSMSOption smsOption) throws AVException { requestSMSCodeInBackground(phone, smsOption, true, new RequestMobileCodeCallback() { @Override public void done(AVException e) { if (e != null) { AVExceptionHolder.add(e); } } @Override public boolean mustRunOnUIThread() { return false; } }); if (AVExceptionHolder.exists()) { throw AVExceptionHolder.remove(); } } static void requestSMSCode(String phone, AVSMSOption smsOption); static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback); static void verifySMSCode(String code, String mobilePhoneNumber); static void verifySMSCodeInBackground(String code, String phoneNumber,
AVMobilePhoneVerifyCallback callback); } |
@Test public void testRequestSMSCode2() throws AVException { AVOSCloud.requestSMSCode(PHONE, TEMPLATE_NAME, ENV_MAP); } | public static void requestSMSCode(String phone, AVSMSOption smsOption) throws AVException { requestSMSCodeInBackground(phone, smsOption, true, new RequestMobileCodeCallback() { @Override public void done(AVException e) { if (e != null) { AVExceptionHolder.add(e); } } @Override public boolean mustRunOnUIThread() { return false; } }); if (AVExceptionHolder.exists()) { throw AVExceptionHolder.remove(); } } | AVSMS { public static void requestSMSCode(String phone, AVSMSOption smsOption) throws AVException { requestSMSCodeInBackground(phone, smsOption, true, new RequestMobileCodeCallback() { @Override public void done(AVException e) { if (e != null) { AVExceptionHolder.add(e); } } @Override public boolean mustRunOnUIThread() { return false; } }); if (AVExceptionHolder.exists()) { throw AVExceptionHolder.remove(); } } } | AVSMS { public static void requestSMSCode(String phone, AVSMSOption smsOption) throws AVException { requestSMSCodeInBackground(phone, smsOption, true, new RequestMobileCodeCallback() { @Override public void done(AVException e) { if (e != null) { AVExceptionHolder.add(e); } } @Override public boolean mustRunOnUIThread() { return false; } }); if (AVExceptionHolder.exists()) { throw AVExceptionHolder.remove(); } } } | AVSMS { public static void requestSMSCode(String phone, AVSMSOption smsOption) throws AVException { requestSMSCodeInBackground(phone, smsOption, true, new RequestMobileCodeCallback() { @Override public void done(AVException e) { if (e != null) { AVExceptionHolder.add(e); } } @Override public boolean mustRunOnUIThread() { return false; } }); if (AVExceptionHolder.exists()) { throw AVExceptionHolder.remove(); } } static void requestSMSCode(String phone, AVSMSOption smsOption); static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback); static void verifySMSCode(String code, String mobilePhoneNumber); static void verifySMSCodeInBackground(String code, String phoneNumber,
AVMobilePhoneVerifyCallback callback); } | AVSMS { public static void requestSMSCode(String phone, AVSMSOption smsOption) throws AVException { requestSMSCodeInBackground(phone, smsOption, true, new RequestMobileCodeCallback() { @Override public void done(AVException e) { if (e != null) { AVExceptionHolder.add(e); } } @Override public boolean mustRunOnUIThread() { return false; } }); if (AVExceptionHolder.exists()) { throw AVExceptionHolder.remove(); } } static void requestSMSCode(String phone, AVSMSOption smsOption); static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback); static void verifySMSCode(String code, String mobilePhoneNumber); static void verifySMSCodeInBackground(String code, String phoneNumber,
AVMobilePhoneVerifyCallback callback); } |
@Test public void testRequestSMSCode3() throws AVException { AVOSCloud.requestSMSCode(PHONE, TEMPLATE_NAME, SIGNATURE_NAME, ENV_MAP); } | public static void requestSMSCode(String phone, AVSMSOption smsOption) throws AVException { requestSMSCodeInBackground(phone, smsOption, true, new RequestMobileCodeCallback() { @Override public void done(AVException e) { if (e != null) { AVExceptionHolder.add(e); } } @Override public boolean mustRunOnUIThread() { return false; } }); if (AVExceptionHolder.exists()) { throw AVExceptionHolder.remove(); } } | AVSMS { public static void requestSMSCode(String phone, AVSMSOption smsOption) throws AVException { requestSMSCodeInBackground(phone, smsOption, true, new RequestMobileCodeCallback() { @Override public void done(AVException e) { if (e != null) { AVExceptionHolder.add(e); } } @Override public boolean mustRunOnUIThread() { return false; } }); if (AVExceptionHolder.exists()) { throw AVExceptionHolder.remove(); } } } | AVSMS { public static void requestSMSCode(String phone, AVSMSOption smsOption) throws AVException { requestSMSCodeInBackground(phone, smsOption, true, new RequestMobileCodeCallback() { @Override public void done(AVException e) { if (e != null) { AVExceptionHolder.add(e); } } @Override public boolean mustRunOnUIThread() { return false; } }); if (AVExceptionHolder.exists()) { throw AVExceptionHolder.remove(); } } } | AVSMS { public static void requestSMSCode(String phone, AVSMSOption smsOption) throws AVException { requestSMSCodeInBackground(phone, smsOption, true, new RequestMobileCodeCallback() { @Override public void done(AVException e) { if (e != null) { AVExceptionHolder.add(e); } } @Override public boolean mustRunOnUIThread() { return false; } }); if (AVExceptionHolder.exists()) { throw AVExceptionHolder.remove(); } } static void requestSMSCode(String phone, AVSMSOption smsOption); static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback); static void verifySMSCode(String code, String mobilePhoneNumber); static void verifySMSCodeInBackground(String code, String phoneNumber,
AVMobilePhoneVerifyCallback callback); } | AVSMS { public static void requestSMSCode(String phone, AVSMSOption smsOption) throws AVException { requestSMSCodeInBackground(phone, smsOption, true, new RequestMobileCodeCallback() { @Override public void done(AVException e) { if (e != null) { AVExceptionHolder.add(e); } } @Override public boolean mustRunOnUIThread() { return false; } }); if (AVExceptionHolder.exists()) { throw AVExceptionHolder.remove(); } } static void requestSMSCode(String phone, AVSMSOption smsOption); static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback); static void verifySMSCode(String code, String mobilePhoneNumber); static void verifySMSCodeInBackground(String code, String phoneNumber,
AVMobilePhoneVerifyCallback callback); } |
@Test public void testRequestSMSCodeInBackground() throws AVException, InterruptedException { final CountDownLatch latch = new CountDownLatch(1); AVOSCloud.requestSMSCodeInBackground(PHONE, APPLICATION_NAME, OPERATION, TTL, new RequestMobileCodeCallback() { @Override public void done(AVException e) { latch.countDown(); } }); latch.await(); } | public static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback) { requestSMSCodeInBackground(phone, option, false, callback); } | AVSMS { public static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback) { requestSMSCodeInBackground(phone, option, false, callback); } } | AVSMS { public static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback) { requestSMSCodeInBackground(phone, option, false, callback); } } | AVSMS { public static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback) { requestSMSCodeInBackground(phone, option, false, callback); } static void requestSMSCode(String phone, AVSMSOption smsOption); static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback); static void verifySMSCode(String code, String mobilePhoneNumber); static void verifySMSCodeInBackground(String code, String phoneNumber,
AVMobilePhoneVerifyCallback callback); } | AVSMS { public static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback) { requestSMSCodeInBackground(phone, option, false, callback); } static void requestSMSCode(String phone, AVSMSOption smsOption); static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback); static void verifySMSCode(String code, String mobilePhoneNumber); static void verifySMSCodeInBackground(String code, String phoneNumber,
AVMobilePhoneVerifyCallback callback); } |
@Test public void testRequestSMSCodeInBackground1() throws AVException, InterruptedException { final CountDownLatch latch = new CountDownLatch(1); AVOSCloud.requestSMSCodeInBackground(PHONE, TEMPLATE_NAME, ENV_MAP, new RequestMobileCodeCallback() { @Override public void done(AVException e) { latch.countDown(); } }); latch.await(); } | public static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback) { requestSMSCodeInBackground(phone, option, false, callback); } | AVSMS { public static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback) { requestSMSCodeInBackground(phone, option, false, callback); } } | AVSMS { public static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback) { requestSMSCodeInBackground(phone, option, false, callback); } } | AVSMS { public static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback) { requestSMSCodeInBackground(phone, option, false, callback); } static void requestSMSCode(String phone, AVSMSOption smsOption); static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback); static void verifySMSCode(String code, String mobilePhoneNumber); static void verifySMSCodeInBackground(String code, String phoneNumber,
AVMobilePhoneVerifyCallback callback); } | AVSMS { public static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback) { requestSMSCodeInBackground(phone, option, false, callback); } static void requestSMSCode(String phone, AVSMSOption smsOption); static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback); static void verifySMSCode(String code, String mobilePhoneNumber); static void verifySMSCodeInBackground(String code, String phoneNumber,
AVMobilePhoneVerifyCallback callback); } |
@Test public void testRequestSMSCodeInBackground2() throws AVException, InterruptedException { final CountDownLatch latch = new CountDownLatch(1); AVOSCloud.requestSMSCodeInBackground(PHONE, TEMPLATE_NAME, SIGNATURE_NAME, ENV_MAP, new RequestMobileCodeCallback() { @Override public void done(AVException e) { latch.countDown(); } }); latch.await(); } | public static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback) { requestSMSCodeInBackground(phone, option, false, callback); } | AVSMS { public static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback) { requestSMSCodeInBackground(phone, option, false, callback); } } | AVSMS { public static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback) { requestSMSCodeInBackground(phone, option, false, callback); } } | AVSMS { public static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback) { requestSMSCodeInBackground(phone, option, false, callback); } static void requestSMSCode(String phone, AVSMSOption smsOption); static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback); static void verifySMSCode(String code, String mobilePhoneNumber); static void verifySMSCodeInBackground(String code, String phoneNumber,
AVMobilePhoneVerifyCallback callback); } | AVSMS { public static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback) { requestSMSCodeInBackground(phone, option, false, callback); } static void requestSMSCode(String phone, AVSMSOption smsOption); static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback); static void verifySMSCode(String code, String mobilePhoneNumber); static void verifySMSCodeInBackground(String code, String phoneNumber,
AVMobilePhoneVerifyCallback callback); } |
@Test public void testRequestSMSCodeInBackground3() throws AVException, InterruptedException { final CountDownLatch latch = new CountDownLatch(1); AVOSCloud.requestSMSCodeInBackground(PHONE, new RequestMobileCodeCallback() { @Override public void done(AVException e) { latch.countDown(); } }); latch.await(); } | public static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback) { requestSMSCodeInBackground(phone, option, false, callback); } | AVSMS { public static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback) { requestSMSCodeInBackground(phone, option, false, callback); } } | AVSMS { public static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback) { requestSMSCodeInBackground(phone, option, false, callback); } } | AVSMS { public static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback) { requestSMSCodeInBackground(phone, option, false, callback); } static void requestSMSCode(String phone, AVSMSOption smsOption); static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback); static void verifySMSCode(String code, String mobilePhoneNumber); static void verifySMSCodeInBackground(String code, String phoneNumber,
AVMobilePhoneVerifyCallback callback); } | AVSMS { public static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback) { requestSMSCodeInBackground(phone, option, false, callback); } static void requestSMSCode(String phone, AVSMSOption smsOption); static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback); static void verifySMSCode(String code, String mobilePhoneNumber); static void verifySMSCodeInBackground(String code, String phoneNumber,
AVMobilePhoneVerifyCallback callback); } |
@Test public void testVerifySMSCode() throws AVException { AVOSCloud.verifySMSCode(CODE, PHONE); } | public static void verifySMSCode(String code, String mobilePhoneNumber) throws AVException { verifySMSCodeInBackground(code, mobilePhoneNumber, true, new AVMobilePhoneVerifyCallback() { @Override public void done(AVException e) { if (e != null) { AVExceptionHolder.add(e); } } @Override public boolean mustRunOnUIThread() { return false; } }); if (AVExceptionHolder.exists()) { throw AVExceptionHolder.remove(); } } | AVSMS { public static void verifySMSCode(String code, String mobilePhoneNumber) throws AVException { verifySMSCodeInBackground(code, mobilePhoneNumber, true, new AVMobilePhoneVerifyCallback() { @Override public void done(AVException e) { if (e != null) { AVExceptionHolder.add(e); } } @Override public boolean mustRunOnUIThread() { return false; } }); if (AVExceptionHolder.exists()) { throw AVExceptionHolder.remove(); } } } | AVSMS { public static void verifySMSCode(String code, String mobilePhoneNumber) throws AVException { verifySMSCodeInBackground(code, mobilePhoneNumber, true, new AVMobilePhoneVerifyCallback() { @Override public void done(AVException e) { if (e != null) { AVExceptionHolder.add(e); } } @Override public boolean mustRunOnUIThread() { return false; } }); if (AVExceptionHolder.exists()) { throw AVExceptionHolder.remove(); } } } | AVSMS { public static void verifySMSCode(String code, String mobilePhoneNumber) throws AVException { verifySMSCodeInBackground(code, mobilePhoneNumber, true, new AVMobilePhoneVerifyCallback() { @Override public void done(AVException e) { if (e != null) { AVExceptionHolder.add(e); } } @Override public boolean mustRunOnUIThread() { return false; } }); if (AVExceptionHolder.exists()) { throw AVExceptionHolder.remove(); } } static void requestSMSCode(String phone, AVSMSOption smsOption); static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback); static void verifySMSCode(String code, String mobilePhoneNumber); static void verifySMSCodeInBackground(String code, String phoneNumber,
AVMobilePhoneVerifyCallback callback); } | AVSMS { public static void verifySMSCode(String code, String mobilePhoneNumber) throws AVException { verifySMSCodeInBackground(code, mobilePhoneNumber, true, new AVMobilePhoneVerifyCallback() { @Override public void done(AVException e) { if (e != null) { AVExceptionHolder.add(e); } } @Override public boolean mustRunOnUIThread() { return false; } }); if (AVExceptionHolder.exists()) { throw AVExceptionHolder.remove(); } } static void requestSMSCode(String phone, AVSMSOption smsOption); static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback); static void verifySMSCode(String code, String mobilePhoneNumber); static void verifySMSCodeInBackground(String code, String phoneNumber,
AVMobilePhoneVerifyCallback callback); } |
@Test public void testVerifySMSCodeInBackground() throws AVException, InterruptedException { final CountDownLatch latch = new CountDownLatch(1); AVOSCloud.verifySMSCodeInBackground(CODE, PHONE, new AVMobilePhoneVerifyCallback() { @Override public void done(AVException e) { latch.countDown(); } }); latch.await(); } | public static void verifySMSCodeInBackground(String code, String phoneNumber, AVMobilePhoneVerifyCallback callback) { verifySMSCodeInBackground(code, phoneNumber, false, callback); } | AVSMS { public static void verifySMSCodeInBackground(String code, String phoneNumber, AVMobilePhoneVerifyCallback callback) { verifySMSCodeInBackground(code, phoneNumber, false, callback); } } | AVSMS { public static void verifySMSCodeInBackground(String code, String phoneNumber, AVMobilePhoneVerifyCallback callback) { verifySMSCodeInBackground(code, phoneNumber, false, callback); } } | AVSMS { public static void verifySMSCodeInBackground(String code, String phoneNumber, AVMobilePhoneVerifyCallback callback) { verifySMSCodeInBackground(code, phoneNumber, false, callback); } static void requestSMSCode(String phone, AVSMSOption smsOption); static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback); static void verifySMSCode(String code, String mobilePhoneNumber); static void verifySMSCodeInBackground(String code, String phoneNumber,
AVMobilePhoneVerifyCallback callback); } | AVSMS { public static void verifySMSCodeInBackground(String code, String phoneNumber, AVMobilePhoneVerifyCallback callback) { verifySMSCodeInBackground(code, phoneNumber, false, callback); } static void requestSMSCode(String phone, AVSMSOption smsOption); static void requestSMSCodeInBackground(String phone, AVSMSOption option, RequestMobileCodeCallback callback); static void verifySMSCode(String code, String mobilePhoneNumber); static void verifySMSCodeInBackground(String code, String phoneNumber,
AVMobilePhoneVerifyCallback callback); } |
@Test public void testResetUnreadStatusesCount() throws AVException, InterruptedException { AVUser user = new AVUser(); user.logIn(TestConfig.TEST_USER_NAME, TestConfig.TEST_USER_PWD); final CountDownLatch latch = new CountDownLatch(1); AVStatus.resetUnreadStatusesCount("private", new AVCallback() { @Override protected void internalDone0(Object o, AVException avException) { latch.countDown(); Assert.assertNull(avException); } }); latch.await(); } | public static void resetUnreadStatusesCount(String inboxType, final AVCallback callback) { if (!checkCurrentUser(null)) { if (callback != null) { callback.internalDone(AVErrorUtils.sessionMissingException()); } return; } final String userId = AVUser.getCurrentUser().getObjectId(); final String endPoint = "subscribe/statuses/resetUnreadCount"; Map<String, String> params = getStatusQueryMap(userId, 0, 0, 0, inboxType, null, false, false); String jsonString = AVUtils.jsonStringFromMapWithNull(params); PaasClient.storageInstance().postObject(endPoint, jsonString, false, new GenericObjectCallback() { @Override public void onSuccess(String content, AVException e) { if (callback != null) { callback.internalDone(null); } } @Override public void onFailure(Throwable error, String content) { if (callback != null) { callback.internalDone(AVErrorUtils.createException(error, content)); } } }); } | AVStatus extends AVObject { public static void resetUnreadStatusesCount(String inboxType, final AVCallback callback) { if (!checkCurrentUser(null)) { if (callback != null) { callback.internalDone(AVErrorUtils.sessionMissingException()); } return; } final String userId = AVUser.getCurrentUser().getObjectId(); final String endPoint = "subscribe/statuses/resetUnreadCount"; Map<String, String> params = getStatusQueryMap(userId, 0, 0, 0, inboxType, null, false, false); String jsonString = AVUtils.jsonStringFromMapWithNull(params); PaasClient.storageInstance().postObject(endPoint, jsonString, false, new GenericObjectCallback() { @Override public void onSuccess(String content, AVException e) { if (callback != null) { callback.internalDone(null); } } @Override public void onFailure(Throwable error, String content) { if (callback != null) { callback.internalDone(AVErrorUtils.createException(error, content)); } } }); } } | AVStatus extends AVObject { public static void resetUnreadStatusesCount(String inboxType, final AVCallback callback) { if (!checkCurrentUser(null)) { if (callback != null) { callback.internalDone(AVErrorUtils.sessionMissingException()); } return; } final String userId = AVUser.getCurrentUser().getObjectId(); final String endPoint = "subscribe/statuses/resetUnreadCount"; Map<String, String> params = getStatusQueryMap(userId, 0, 0, 0, inboxType, null, false, false); String jsonString = AVUtils.jsonStringFromMapWithNull(params); PaasClient.storageInstance().postObject(endPoint, jsonString, false, new GenericObjectCallback() { @Override public void onSuccess(String content, AVException e) { if (callback != null) { callback.internalDone(null); } } @Override public void onFailure(Throwable error, String content) { if (callback != null) { callback.internalDone(AVErrorUtils.createException(error, content)); } } }); } AVStatus(); AVStatus(Parcel in); } | AVStatus extends AVObject { public static void resetUnreadStatusesCount(String inboxType, final AVCallback callback) { if (!checkCurrentUser(null)) { if (callback != null) { callback.internalDone(AVErrorUtils.sessionMissingException()); } return; } final String userId = AVUser.getCurrentUser().getObjectId(); final String endPoint = "subscribe/statuses/resetUnreadCount"; Map<String, String> params = getStatusQueryMap(userId, 0, 0, 0, inboxType, null, false, false); String jsonString = AVUtils.jsonStringFromMapWithNull(params); PaasClient.storageInstance().postObject(endPoint, jsonString, false, new GenericObjectCallback() { @Override public void onSuccess(String content, AVException e) { if (callback != null) { callback.internalDone(null); } } @Override public void onFailure(Throwable error, String content) { if (callback != null) { callback.internalDone(AVErrorUtils.createException(error, content)); } } }); } AVStatus(); AVStatus(Parcel in); static AVStatus createStatus(String imageUrl, String message); static AVStatus createStatusWithData(Map<String, Object> data); @Override String getObjectId(); @Override Date getCreatedAt(); void setImageUrl(final String url); String getImageUrl(); AVUser getSource(); void setSource(AVObject source); void setInboxType(final String type); void setQuery(AVQuery query); void setMessage(final String message); String getMessage(); void setData(Map<String, Object> data); Map<String, Object> getData(); @Override void put(String key, Object value); @Override void remove(String key); long getMessageId(); String getInboxType(); void deleteStatusInBackground(final DeleteCallback callback); static void deleteStatusWithIDInBackgroud(String statusId, final DeleteCallback callback); static void deleteInboxStatus(long messageId, String inboxType, AVUser owner); static void deleteInboxStatusInBackground(long messageId, String inboxType, AVUser owner,
DeleteCallback callback); @Deprecated static void getStatuses(long skip, long limit, final StatusListCallback callback); @Deprecated static void getStatusesFromCurrentUserWithType(final String type, long skip, long limit,
final StatusListCallback callback); @Deprecated static void getStatusesFromUser(final String userObejctId, long skip, long limit,
final StatusListCallback callback); @Deprecated static void getInboxStatusesInBackground(long skip, long limit,
final StatusListCallback callback); @Deprecated static void getInboxStatusesWithInboxType(long skip, long limit, final String inboxType,
final StatusListCallback callback); static void getUnreadStatusesCountInBackground(String inboxType,
final CountCallback callback); @Deprecated static void getInboxUnreadStatusesCountInBackgroud(final CountCallback callback); @Deprecated static void getInboxUnreadStatusesCountWithInboxTypeInBackgroud(long sid, long count,
final String inboxType, final CountCallback callback); @Deprecated static void getInboxPrivteStatuses(long sid, long count, final StatusListCallback callback); static void getStatusWithIdInBackgroud(String statusId, final StatusCallback callback); @Deprecated void sendInBackgroundWithBlock(final SaveCallback callback); void sendInBackground(final SaveCallback callback); static void sendStatusToFollowersInBackgroud(AVStatus status, final SaveCallback callback); static void sendPrivateStatusInBackgroud(AVStatus status, final String receiverObjectId,
SaveCallback callback); static AVStatusQuery statusQuery(AVUser owner); static AVStatusQuery inboxQuery(AVUser owner, String inBoxType); @Deprecated @Override void add(String key, Object value); @Deprecated @Override void addAll(String key, Collection<?> values); @Deprecated @Override void addAllUnique(String key, Collection<?> values); @Deprecated @Override void addUnique(String key, Object value); @Deprecated @Override boolean containsKey(String k); @Override void delete(); @Deprecated @Override void deleteEventually(DeleteCallback callback); @Deprecated @Override void deleteEventually(); @Override void deleteInBackground(); AVObject toObject(); @Override boolean equals(Object obj); @Deprecated @Override AVObject fetch(); @Deprecated @Override AVObject fetch(String includedKeys); @Deprecated @Override AVObject fetchIfNeeded(); @Deprecated @Override AVObject fetchIfNeeded(String includedKeys); @Deprecated @Override void fetchIfNeededInBackground(GetCallback<AVObject> callback); @Deprecated @Override void fetchIfNeededInBackground(String includedkeys, GetCallback<AVObject> callback); @Override String toString(); @Deprecated @Override boolean isFetchWhenSave(); @Deprecated @Override void setFetchWhenSave(boolean fetchWhenSave); @Deprecated @Override String getUuid(); @Deprecated @Override void deleteInBackground(DeleteCallback callback); @Deprecated @Override void fetchInBackground(GetCallback<AVObject> callback); @Deprecated @Override void fetchInBackground(String includeKeys, GetCallback<AVObject> callback); @Override Object get(String key); @Deprecated @Override AVACL getACL(); @Deprecated @Override boolean getBoolean(String key); @Deprecated @Override byte[] getBytes(String key); @Deprecated @Override Date getDate(String key); @Deprecated @Override double getDouble(String key); @Deprecated @Override int getInt(String key); @Deprecated @Override JSONArray getJSONArray(String key); @Deprecated @Override JSONObject getJSONObject(String key); @Deprecated @Override List getList(String key); @Deprecated @Override long getLong(String key); @Deprecated @Override Map<String, V> getMap(String key); @Deprecated @Override Number getNumber(String key); @Deprecated @Override T getAVFile(String key); @Deprecated @Override AVGeoPoint getAVGeoPoint(String key); @Override T getAVObject(String key); @Deprecated @Override T getAVUser(String key); @Deprecated @Override AVRelation<T> getRelation(String key); @Deprecated @Override String getString(String key); @Deprecated @Override Date getUpdatedAt(); @Deprecated @Override boolean has(String key); @Deprecated @Override boolean hasSameId(AVObject other); @Deprecated @Override void increment(String key); @Deprecated @Override void increment(String key, Number amount); @Deprecated @Override Set<String> keySet(); @Deprecated @Override void refresh(); @Deprecated @Override void refresh(String includeKeys); @Deprecated @Override void refreshInBackground(RefreshCallback<AVObject> callback); @Deprecated @Override void refreshInBackground(String includeKeys, RefreshCallback<AVObject> callback); @Deprecated @Override void removeAll(String key, Collection<?> values); @Deprecated @Override void save(); @Deprecated @Override void saveEventually(); @Deprecated @Override void saveEventually(SaveCallback callback); @Deprecated @Override void saveInBackground(); @Deprecated @Override void saveInBackground(SaveCallback callback); @Deprecated @Override void setACL(AVACL acl); @Override int describeContents(); @Override void writeToParcel(Parcel out, int i); static void resetUnreadStatusesCount(String inboxType, final AVCallback callback); } | AVStatus extends AVObject { public static void resetUnreadStatusesCount(String inboxType, final AVCallback callback) { if (!checkCurrentUser(null)) { if (callback != null) { callback.internalDone(AVErrorUtils.sessionMissingException()); } return; } final String userId = AVUser.getCurrentUser().getObjectId(); final String endPoint = "subscribe/statuses/resetUnreadCount"; Map<String, String> params = getStatusQueryMap(userId, 0, 0, 0, inboxType, null, false, false); String jsonString = AVUtils.jsonStringFromMapWithNull(params); PaasClient.storageInstance().postObject(endPoint, jsonString, false, new GenericObjectCallback() { @Override public void onSuccess(String content, AVException e) { if (callback != null) { callback.internalDone(null); } } @Override public void onFailure(Throwable error, String content) { if (callback != null) { callback.internalDone(AVErrorUtils.createException(error, content)); } } }); } AVStatus(); AVStatus(Parcel in); static AVStatus createStatus(String imageUrl, String message); static AVStatus createStatusWithData(Map<String, Object> data); @Override String getObjectId(); @Override Date getCreatedAt(); void setImageUrl(final String url); String getImageUrl(); AVUser getSource(); void setSource(AVObject source); void setInboxType(final String type); void setQuery(AVQuery query); void setMessage(final String message); String getMessage(); void setData(Map<String, Object> data); Map<String, Object> getData(); @Override void put(String key, Object value); @Override void remove(String key); long getMessageId(); String getInboxType(); void deleteStatusInBackground(final DeleteCallback callback); static void deleteStatusWithIDInBackgroud(String statusId, final DeleteCallback callback); static void deleteInboxStatus(long messageId, String inboxType, AVUser owner); static void deleteInboxStatusInBackground(long messageId, String inboxType, AVUser owner,
DeleteCallback callback); @Deprecated static void getStatuses(long skip, long limit, final StatusListCallback callback); @Deprecated static void getStatusesFromCurrentUserWithType(final String type, long skip, long limit,
final StatusListCallback callback); @Deprecated static void getStatusesFromUser(final String userObejctId, long skip, long limit,
final StatusListCallback callback); @Deprecated static void getInboxStatusesInBackground(long skip, long limit,
final StatusListCallback callback); @Deprecated static void getInboxStatusesWithInboxType(long skip, long limit, final String inboxType,
final StatusListCallback callback); static void getUnreadStatusesCountInBackground(String inboxType,
final CountCallback callback); @Deprecated static void getInboxUnreadStatusesCountInBackgroud(final CountCallback callback); @Deprecated static void getInboxUnreadStatusesCountWithInboxTypeInBackgroud(long sid, long count,
final String inboxType, final CountCallback callback); @Deprecated static void getInboxPrivteStatuses(long sid, long count, final StatusListCallback callback); static void getStatusWithIdInBackgroud(String statusId, final StatusCallback callback); @Deprecated void sendInBackgroundWithBlock(final SaveCallback callback); void sendInBackground(final SaveCallback callback); static void sendStatusToFollowersInBackgroud(AVStatus status, final SaveCallback callback); static void sendPrivateStatusInBackgroud(AVStatus status, final String receiverObjectId,
SaveCallback callback); static AVStatusQuery statusQuery(AVUser owner); static AVStatusQuery inboxQuery(AVUser owner, String inBoxType); @Deprecated @Override void add(String key, Object value); @Deprecated @Override void addAll(String key, Collection<?> values); @Deprecated @Override void addAllUnique(String key, Collection<?> values); @Deprecated @Override void addUnique(String key, Object value); @Deprecated @Override boolean containsKey(String k); @Override void delete(); @Deprecated @Override void deleteEventually(DeleteCallback callback); @Deprecated @Override void deleteEventually(); @Override void deleteInBackground(); AVObject toObject(); @Override boolean equals(Object obj); @Deprecated @Override AVObject fetch(); @Deprecated @Override AVObject fetch(String includedKeys); @Deprecated @Override AVObject fetchIfNeeded(); @Deprecated @Override AVObject fetchIfNeeded(String includedKeys); @Deprecated @Override void fetchIfNeededInBackground(GetCallback<AVObject> callback); @Deprecated @Override void fetchIfNeededInBackground(String includedkeys, GetCallback<AVObject> callback); @Override String toString(); @Deprecated @Override boolean isFetchWhenSave(); @Deprecated @Override void setFetchWhenSave(boolean fetchWhenSave); @Deprecated @Override String getUuid(); @Deprecated @Override void deleteInBackground(DeleteCallback callback); @Deprecated @Override void fetchInBackground(GetCallback<AVObject> callback); @Deprecated @Override void fetchInBackground(String includeKeys, GetCallback<AVObject> callback); @Override Object get(String key); @Deprecated @Override AVACL getACL(); @Deprecated @Override boolean getBoolean(String key); @Deprecated @Override byte[] getBytes(String key); @Deprecated @Override Date getDate(String key); @Deprecated @Override double getDouble(String key); @Deprecated @Override int getInt(String key); @Deprecated @Override JSONArray getJSONArray(String key); @Deprecated @Override JSONObject getJSONObject(String key); @Deprecated @Override List getList(String key); @Deprecated @Override long getLong(String key); @Deprecated @Override Map<String, V> getMap(String key); @Deprecated @Override Number getNumber(String key); @Deprecated @Override T getAVFile(String key); @Deprecated @Override AVGeoPoint getAVGeoPoint(String key); @Override T getAVObject(String key); @Deprecated @Override T getAVUser(String key); @Deprecated @Override AVRelation<T> getRelation(String key); @Deprecated @Override String getString(String key); @Deprecated @Override Date getUpdatedAt(); @Deprecated @Override boolean has(String key); @Deprecated @Override boolean hasSameId(AVObject other); @Deprecated @Override void increment(String key); @Deprecated @Override void increment(String key, Number amount); @Deprecated @Override Set<String> keySet(); @Deprecated @Override void refresh(); @Deprecated @Override void refresh(String includeKeys); @Deprecated @Override void refreshInBackground(RefreshCallback<AVObject> callback); @Deprecated @Override void refreshInBackground(String includeKeys, RefreshCallback<AVObject> callback); @Deprecated @Override void removeAll(String key, Collection<?> values); @Deprecated @Override void save(); @Deprecated @Override void saveEventually(); @Deprecated @Override void saveEventually(SaveCallback callback); @Deprecated @Override void saveInBackground(); @Deprecated @Override void saveInBackground(SaveCallback callback); @Deprecated @Override void setACL(AVACL acl); @Override int describeContents(); @Override void writeToParcel(Parcel out, int i); static void resetUnreadStatusesCount(String inboxType, final AVCallback callback); static final String IMAGE_TAG; static final String MESSAGE_TAG; @Deprecated
static final String INBOX_TIMELINE; @Deprecated
static final String INBOX_PRIVATE; static final String STATUS_ENDPOINT; transient static final Creator<AVStatus> CREATOR; } |
@Test public void testUpdateTag() { String updateTag = "updateTag"; AVSessionCacheHelper.getTagCacheInstance().addSession(testClientId, testClientTag); AVSessionCacheHelper.getTagCacheInstance().addSession(testClientId, updateTag); Map<String, String> clientMap = AVSessionCacheHelper.getTagCacheInstance().getAllSession(); Assert.assertTrue(clientMap.size() == 1); Assert.assertTrue(updateTag.equals(clientMap.get(testClientId))); } | static synchronized SessionTagCache getTagCacheInstance() { if (null == tagCacheInstance) { tagCacheInstance = new SessionTagCache(); } return tagCacheInstance; } | AVSessionCacheHelper { static synchronized SessionTagCache getTagCacheInstance() { if (null == tagCacheInstance) { tagCacheInstance = new SessionTagCache(); } return tagCacheInstance; } } | AVSessionCacheHelper { static synchronized SessionTagCache getTagCacheInstance() { if (null == tagCacheInstance) { tagCacheInstance = new SessionTagCache(); } return tagCacheInstance; } } | AVSessionCacheHelper { static synchronized SessionTagCache getTagCacheInstance() { if (null == tagCacheInstance) { tagCacheInstance = new SessionTagCache(); } return tagCacheInstance; } } | AVSessionCacheHelper { static synchronized SessionTagCache getTagCacheInstance() { if (null == tagCacheInstance) { tagCacheInstance = new SessionTagCache(); } return tagCacheInstance; } } |
@Test public void testGetEndpoint() { final String objectId = "objectId"; AVUser user = new AVUser(); Assert.assertEquals(AVUser.AVUSER_ENDPOINT, AVPowerfulUtils.getEndpoint(user)); user.setObjectId(objectId); Assert.assertEquals(String.format("%s/%s", AVUser.AVUSER_ENDPOINT, objectId), AVPowerfulUtils.getEndpoint(user)); AVStatus status = new AVStatus(); Assert.assertEquals(AVStatus.STATUS_ENDPOINT, AVPowerfulUtils.getEndpoint(status)); status.setObjectId(objectId); Assert.assertEquals(String.format("%s/%s", AVStatus.STATUS_ENDPOINT, objectId), AVPowerfulUtils.getEndpoint(status)); AVRole role = new AVRole(); Assert.assertEquals(AVRole.AVROLE_ENDPOINT, AVPowerfulUtils.getEndpoint(role)); role.setObjectId(objectId); Assert.assertEquals(String.format("%s/%s", AVRole.AVROLE_ENDPOINT, objectId), AVPowerfulUtils.getEndpoint(role)); AVFile file = new AVFile(); Assert.assertEquals(AVFile.AVFILE_ENDPOINT, AVPowerfulUtils.getEndpoint(file)); final String NORMAL_OBJECT_NAME = "normalObject"; AVObject normalObject = new AVObject("normalObject"); Assert.assertEquals("classes/" + NORMAL_OBJECT_NAME, AVPowerfulUtils.getEndpoint(normalObject)); normalObject.setObjectId(objectId); Assert.assertEquals(String.format("classes/%s/%s", NORMAL_OBJECT_NAME, objectId), AVPowerfulUtils.getEndpoint(normalObject)); } | public static String getEndpoint(String className) { String endpoint = get(className, ENDPOINT); if (AVUtils.isBlankString(endpoint)) { if (!AVUtils.isBlankString(className)) { endpoint = String.format("classes/%s", className); } else { throw new AVRuntimeException("Blank class name"); } } return endpoint; } | AVPowerfulUtils { public static String getEndpoint(String className) { String endpoint = get(className, ENDPOINT); if (AVUtils.isBlankString(endpoint)) { if (!AVUtils.isBlankString(className)) { endpoint = String.format("classes/%s", className); } else { throw new AVRuntimeException("Blank class name"); } } return endpoint; } } | AVPowerfulUtils { public static String getEndpoint(String className) { String endpoint = get(className, ENDPOINT); if (AVUtils.isBlankString(endpoint)) { if (!AVUtils.isBlankString(className)) { endpoint = String.format("classes/%s", className); } else { throw new AVRuntimeException("Blank class name"); } } return endpoint; } } | AVPowerfulUtils { public static String getEndpoint(String className) { String endpoint = get(className, ENDPOINT); if (AVUtils.isBlankString(endpoint)) { if (!AVUtils.isBlankString(className)) { endpoint = String.format("classes/%s", className); } else { throw new AVRuntimeException("Blank class name"); } } return endpoint; } static String getEndpoint(String className); static String getEndpoint(Object object); static String getEndpoint(Object object, boolean isPost); static String getBatchEndpoint(String version, AVObject object, boolean isPost); static String getEndpointByAVClassName(String className, String objectId); static String getAVClassName(String className); static String getFollowEndPoint(String followee, String follower); static String getFollowersEndPoint(String userId); static String getFolloweesEndPoint(String userId); static String getFollowersAndFollowees(String userId); static String getInternalIdFromRequestBody(Map request); } | AVPowerfulUtils { public static String getEndpoint(String className) { String endpoint = get(className, ENDPOINT); if (AVUtils.isBlankString(endpoint)) { if (!AVUtils.isBlankString(className)) { endpoint = String.format("classes/%s", className); } else { throw new AVRuntimeException("Blank class name"); } } return endpoint; } static String getEndpoint(String className); static String getEndpoint(Object object); static String getEndpoint(Object object, boolean isPost); static String getBatchEndpoint(String version, AVObject object, boolean isPost); static String getEndpointByAVClassName(String className, String objectId); static String getAVClassName(String className); static String getFollowEndPoint(String followee, String follower); static String getFollowersEndPoint(String userId); static String getFolloweesEndPoint(String userId); static String getFollowersAndFollowees(String userId); static String getInternalIdFromRequestBody(Map request); } |
@Test public void testConvertCloudResponse() { String content = "{\"result\":{\"content\":\"2222我若是写代码。\",\"ACL\":{\"*\":{\"read\":true},\"59229e282f301e006b1b637e\":{\"read\":true}},\"number\":123,\"userName\":{\"__type\":\"Pointer\",\"className\":\"_User\",\"objectId\":\"59631dab128fe1507271d9b7\"},\"asdfds\":{\"__type\":\"Pointer\",\"className\":\"_File\",\"objectId\":\"5875e04a61ff4b005c5c28ba\"},\"objectId\":\"56de3e5aefa631005ec03f67\",\"createdAt\":\"2016-03-08T02:52:10.733Z\",\"updatedAt\":\"2017-08-02T10:58:05.630Z\",\"__type\":\"Object\",\"className\":\"Comment\"}}"; AVObject object = (AVObject) AVCloud.convertCloudResponse(content); Assert.assertEquals(object.getClassName(), "Comment"); Assert.assertEquals(object.get("content"), "2222我若是写代码。"); Assert.assertEquals(object.getInt("number"), 123); Assert.assertEquals(object.getObjectId(), "56de3e5aefa631005ec03f67"); Assert.assertNotNull(object.getCreatedAt()); Assert.assertNotNull(object.getUpdatedAt()); Assert.assertNotNull(object.getACL()); Assert.assertNotNull(object.get("asdfds")); } | public static Object convertCloudResponse(String response) { Object newResultValue = null; try { Map<String, ?> resultMap = AVUtils.getFromJSON(response, Map.class); Object resultValue = resultMap.get("result"); if (resultValue instanceof Collection) { newResultValue = AVUtils.getObjectFrom((Collection) resultValue); } else if (resultValue instanceof Map) { newResultValue = AVUtils.getObjectFrom((Map<String, Object>) resultValue); } else { newResultValue = resultValue; } } catch (Exception e) { LogUtil.log.e("Error during response parse", e); } return newResultValue; } | AVCloud { public static Object convertCloudResponse(String response) { Object newResultValue = null; try { Map<String, ?> resultMap = AVUtils.getFromJSON(response, Map.class); Object resultValue = resultMap.get("result"); if (resultValue instanceof Collection) { newResultValue = AVUtils.getObjectFrom((Collection) resultValue); } else if (resultValue instanceof Map) { newResultValue = AVUtils.getObjectFrom((Map<String, Object>) resultValue); } else { newResultValue = resultValue; } } catch (Exception e) { LogUtil.log.e("Error during response parse", e); } return newResultValue; } } | AVCloud { public static Object convertCloudResponse(String response) { Object newResultValue = null; try { Map<String, ?> resultMap = AVUtils.getFromJSON(response, Map.class); Object resultValue = resultMap.get("result"); if (resultValue instanceof Collection) { newResultValue = AVUtils.getObjectFrom((Collection) resultValue); } else if (resultValue instanceof Map) { newResultValue = AVUtils.getObjectFrom((Map<String, Object>) resultValue); } else { newResultValue = resultValue; } } catch (Exception e) { LogUtil.log.e("Error during response parse", e); } return newResultValue; } } | AVCloud { public static Object convertCloudResponse(String response) { Object newResultValue = null; try { Map<String, ?> resultMap = AVUtils.getFromJSON(response, Map.class); Object resultValue = resultMap.get("result"); if (resultValue instanceof Collection) { newResultValue = AVUtils.getObjectFrom((Collection) resultValue); } else if (resultValue instanceof Map) { newResultValue = AVUtils.getObjectFrom((Map<String, Object>) resultValue); } else { newResultValue = resultValue; } } catch (Exception e) { LogUtil.log.e("Error during response parse", e); } return newResultValue; } static void setProductionMode(boolean productionMode); static boolean isProductionMode(); static T callFunction(String name, Map<String, ?> params); static void callFunctionInBackground(String name, Map<String, ?> params,
final FunctionCallback<T> callback); static Object convertCloudResponse(String response); static void rpcFunctionInBackground(String name, Object params,
final FunctionCallback<T> callback); static T rpcFunction(String name, Object params); } | AVCloud { public static Object convertCloudResponse(String response) { Object newResultValue = null; try { Map<String, ?> resultMap = AVUtils.getFromJSON(response, Map.class); Object resultValue = resultMap.get("result"); if (resultValue instanceof Collection) { newResultValue = AVUtils.getObjectFrom((Collection) resultValue); } else if (resultValue instanceof Map) { newResultValue = AVUtils.getObjectFrom((Map<String, Object>) resultValue); } else { newResultValue = resultValue; } } catch (Exception e) { LogUtil.log.e("Error during response parse", e); } return newResultValue; } static void setProductionMode(boolean productionMode); static boolean isProductionMode(); static T callFunction(String name, Map<String, ?> params); static void callFunctionInBackground(String name, Map<String, ?> params,
final FunctionCallback<T> callback); static Object convertCloudResponse(String response); static void rpcFunctionInBackground(String name, Object params,
final FunctionCallback<T> callback); static T rpcFunction(String name, Object params); } |
@Test public void testGetFacebookToken() { String faceBookToken = "facebooktoken"; AVUser user = new AVUser(); user.setFacebookToken(faceBookToken); Assert.assertEquals(user.getFacebookToken(), faceBookToken); } | public String getFacebookToken() { return facebookToken; } | AVUser extends AVObject { public String getFacebookToken() { return facebookToken; } } | AVUser extends AVObject { public String getFacebookToken() { return facebookToken; } AVUser(); AVUser(Parcel in); } | AVUser extends AVObject { public String getFacebookToken() { return facebookToken; } AVUser(); AVUser(Parcel in); String getFacebookToken(); String getTwitterToken(); String getQqWeiboToken(); static void enableAutomaticUser(); static boolean isEnableAutomatic(); static void disableAutomaticUser(); static synchronized void changeCurrentUser(AVUser newUser, boolean save); static AVUser getCurrentUser(); @SuppressWarnings("unchecked") static T getCurrentUser(Class<T> userClass); String getEmail(); static AVQuery<T> getUserQuery(Class<T> clazz); static AVQuery<AVUser> getQuery(); String getSessionToken(); String getUsername(); boolean isAuthenticated(); void isAuthenticated(final AVCallback<Boolean> callback); boolean isAnonymous(); boolean isNew(); static AVUser logIn(String username, String password); static T logIn(String username, String password, Class<T> clazz); static void logInAnonymously(final LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<T> callback, Class<T> clazz); static void loginByEmailInBackground(String email, String password, final LogInCallback<AVUser> callback); static void loginByEmailInBackground(String email, String password, final LogInCallback<T> callback, Class<T> clazz); static AVUser loginByMobilePhoneNumber(String phone, String password); static T loginByMobilePhoneNumber(String phone, String password,
Class<T> clazz); static void loginByMobilePhoneNumberInBackground(String phone, String password,
LogInCallback<AVUser> callback); static void loginByMobilePhoneNumberInBackground(String phone,
String password, LogInCallback<T> callback, Class<T> clazz); static AVUser loginBySMSCode(String phone, String smsCode); static T loginBySMSCode(String phone, String smsCode, Class<T> clazz); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<AVUser> callback); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<T> callback, Class<T> clazz); T refreshSessionToken(); void refreshSessionTokenInBackground(LogInCallback<T> callback); static AVUser becomeWithSessionToken(String sessionToken); static AVUser becomeWithSessionToken(String sessionToken, Class<T> clazz); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<AVUser> callback); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<T> callback, Class<T> clazz); static AVUser signUpOrLoginByMobilePhone(String mobilePhoneNumber, String smsCode); static T signUpOrLoginByMobilePhone(String mobilePhoneNumber,
String smsCode, Class<T> clazz); static void signUpOrLoginByMobilePhoneInBackground(String mobilePhoneNumber,
String smsCode, LogInCallback<AVUser> callback); static void signUpOrLoginByMobilePhoneInBackground(
String mobilePhoneNumber, String smsCode, Class<T> clazz, LogInCallback<T> callback); static T newAVUser(Class<T> clazz, LogInCallback<T> cb); static void logOut(); @Override void put(String key, Object value); @Override void remove(String key); static void requestPasswordReset(String email); static void requestPasswordResetInBackground(String email,
RequestPasswordResetCallback callback); void updatePassword(String oldPassword, String newPassword); void updatePasswordInBackground(String oldPassword, String newPassword,
UpdatePasswordCallback callback); static void requestPasswordResetBySmsCode(String phoneNumber); static void requestPasswordResetBySmsCode(String phoneNumber, String validateToken); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void resetPasswordBySmsCode(String smsCode, String newPassword); static void resetPasswordBySmsCodeInBackground(String smsCode, String newPassword,
UpdatePasswordCallback callback); static void requestEmailVerify(String email); static void requestEmailVerifyInBackground(String email,
RequestEmailVerifyCallback callback); static void requestMobilePhoneVerify(String phoneNumber); static void requestMobilePhoneVerify(String phoneNumber, String validateToken); static void requestMobilePhoneVerifyInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestMobilePhoneVerifyInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void requestLoginSmsCode(String phoneNumber); static void requestLoginSmsCode(String phoneNumber, String validateToken); static void requestLoginSmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestLoginSmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void verifyMobilePhone(String verifyCode); static void verifyMobilePhoneInBackground(String verifyCode,
AVMobilePhoneVerifyCallback callback); void setEmail(String email); void setPassword(String password); void setUsername(String username); String getMobilePhoneNumber(); void setMobilePhoneNumber(String mobilePhoneNumber); boolean isMobilePhoneVerified(); @JSONField(serialize = false) List<AVRole> getRoles(); void getRolesInBackground(final AVCallback<List<AVRole>> callback); void signUp(); void signUpInBackground(SignUpCallback callback); String getSinaWeiboToken(); String getQQWeiboToken(); void followInBackground(String userObjectId, final FollowCallback callback); void followInBackground(String userObjectId, Map<String, Object> attributes,
final FollowCallback callback); void unfollowInBackground(String userObjectId, final FollowCallback callback); static AVQuery<T> followerQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followerQuery(Class<T> clazz); static AVQuery<T> followeeQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followeeQuery(Class<T> clazz); AVFriendshipQuery friendshipQuery(); AVFriendshipQuery friendshipQuery(Class<T> clazz); static AVFriendshipQuery friendshipQuery(String userId); static AVFriendshipQuery friendshipQuery(String userId,
Class<T> clazz); @Deprecated void getFollowersInBackground(final FindCallback callback); @Deprecated void getMyFolloweesInBackground(final FindCallback callback); void getFollowersAndFolloweesInBackground(final FollowersAndFolloweesCallback callback); static T cast(AVUser user, Class<T> clazz); static void alwaysUseSubUserClass(Class<? extends AVUser> clazz); @Deprecated static void loginWithAuthData(AVThirdPartyUserAuth userInfo,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform, final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<T> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData,
final String platform, final LogInCallback<T> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform,
final boolean asMainAccount, final boolean failOnNotExist,
final LogInCallback<AVUser> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final boolean failOnNotExist, final LogInCallback<AVUser> callback); @Deprecated static void loginWithAuthData(final Class<T> clazz,
final AVThirdPartyUserAuth userInfo, final LogInCallback<T> callback); @Deprecated static void associateWithAuthData(AVUser user, AVThirdPartyUserAuth userInfo,
final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, String unionId, String unionIdPlatform,
boolean asMainAccount, final SaveCallback callback); void dissociateAuthData(final String platform, final SaveCallback callback); @Deprecated static void dissociateAuthData(final AVUser user, final String platform,
final SaveCallback callback); } | AVUser extends AVObject { public String getFacebookToken() { return facebookToken; } AVUser(); AVUser(Parcel in); String getFacebookToken(); String getTwitterToken(); String getQqWeiboToken(); static void enableAutomaticUser(); static boolean isEnableAutomatic(); static void disableAutomaticUser(); static synchronized void changeCurrentUser(AVUser newUser, boolean save); static AVUser getCurrentUser(); @SuppressWarnings("unchecked") static T getCurrentUser(Class<T> userClass); String getEmail(); static AVQuery<T> getUserQuery(Class<T> clazz); static AVQuery<AVUser> getQuery(); String getSessionToken(); String getUsername(); boolean isAuthenticated(); void isAuthenticated(final AVCallback<Boolean> callback); boolean isAnonymous(); boolean isNew(); static AVUser logIn(String username, String password); static T logIn(String username, String password, Class<T> clazz); static void logInAnonymously(final LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<T> callback, Class<T> clazz); static void loginByEmailInBackground(String email, String password, final LogInCallback<AVUser> callback); static void loginByEmailInBackground(String email, String password, final LogInCallback<T> callback, Class<T> clazz); static AVUser loginByMobilePhoneNumber(String phone, String password); static T loginByMobilePhoneNumber(String phone, String password,
Class<T> clazz); static void loginByMobilePhoneNumberInBackground(String phone, String password,
LogInCallback<AVUser> callback); static void loginByMobilePhoneNumberInBackground(String phone,
String password, LogInCallback<T> callback, Class<T> clazz); static AVUser loginBySMSCode(String phone, String smsCode); static T loginBySMSCode(String phone, String smsCode, Class<T> clazz); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<AVUser> callback); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<T> callback, Class<T> clazz); T refreshSessionToken(); void refreshSessionTokenInBackground(LogInCallback<T> callback); static AVUser becomeWithSessionToken(String sessionToken); static AVUser becomeWithSessionToken(String sessionToken, Class<T> clazz); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<AVUser> callback); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<T> callback, Class<T> clazz); static AVUser signUpOrLoginByMobilePhone(String mobilePhoneNumber, String smsCode); static T signUpOrLoginByMobilePhone(String mobilePhoneNumber,
String smsCode, Class<T> clazz); static void signUpOrLoginByMobilePhoneInBackground(String mobilePhoneNumber,
String smsCode, LogInCallback<AVUser> callback); static void signUpOrLoginByMobilePhoneInBackground(
String mobilePhoneNumber, String smsCode, Class<T> clazz, LogInCallback<T> callback); static T newAVUser(Class<T> clazz, LogInCallback<T> cb); static void logOut(); @Override void put(String key, Object value); @Override void remove(String key); static void requestPasswordReset(String email); static void requestPasswordResetInBackground(String email,
RequestPasswordResetCallback callback); void updatePassword(String oldPassword, String newPassword); void updatePasswordInBackground(String oldPassword, String newPassword,
UpdatePasswordCallback callback); static void requestPasswordResetBySmsCode(String phoneNumber); static void requestPasswordResetBySmsCode(String phoneNumber, String validateToken); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void resetPasswordBySmsCode(String smsCode, String newPassword); static void resetPasswordBySmsCodeInBackground(String smsCode, String newPassword,
UpdatePasswordCallback callback); static void requestEmailVerify(String email); static void requestEmailVerifyInBackground(String email,
RequestEmailVerifyCallback callback); static void requestMobilePhoneVerify(String phoneNumber); static void requestMobilePhoneVerify(String phoneNumber, String validateToken); static void requestMobilePhoneVerifyInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestMobilePhoneVerifyInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void requestLoginSmsCode(String phoneNumber); static void requestLoginSmsCode(String phoneNumber, String validateToken); static void requestLoginSmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestLoginSmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void verifyMobilePhone(String verifyCode); static void verifyMobilePhoneInBackground(String verifyCode,
AVMobilePhoneVerifyCallback callback); void setEmail(String email); void setPassword(String password); void setUsername(String username); String getMobilePhoneNumber(); void setMobilePhoneNumber(String mobilePhoneNumber); boolean isMobilePhoneVerified(); @JSONField(serialize = false) List<AVRole> getRoles(); void getRolesInBackground(final AVCallback<List<AVRole>> callback); void signUp(); void signUpInBackground(SignUpCallback callback); String getSinaWeiboToken(); String getQQWeiboToken(); void followInBackground(String userObjectId, final FollowCallback callback); void followInBackground(String userObjectId, Map<String, Object> attributes,
final FollowCallback callback); void unfollowInBackground(String userObjectId, final FollowCallback callback); static AVQuery<T> followerQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followerQuery(Class<T> clazz); static AVQuery<T> followeeQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followeeQuery(Class<T> clazz); AVFriendshipQuery friendshipQuery(); AVFriendshipQuery friendshipQuery(Class<T> clazz); static AVFriendshipQuery friendshipQuery(String userId); static AVFriendshipQuery friendshipQuery(String userId,
Class<T> clazz); @Deprecated void getFollowersInBackground(final FindCallback callback); @Deprecated void getMyFolloweesInBackground(final FindCallback callback); void getFollowersAndFolloweesInBackground(final FollowersAndFolloweesCallback callback); static T cast(AVUser user, Class<T> clazz); static void alwaysUseSubUserClass(Class<? extends AVUser> clazz); @Deprecated static void loginWithAuthData(AVThirdPartyUserAuth userInfo,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform, final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<T> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData,
final String platform, final LogInCallback<T> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform,
final boolean asMainAccount, final boolean failOnNotExist,
final LogInCallback<AVUser> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final boolean failOnNotExist, final LogInCallback<AVUser> callback); @Deprecated static void loginWithAuthData(final Class<T> clazz,
final AVThirdPartyUserAuth userInfo, final LogInCallback<T> callback); @Deprecated static void associateWithAuthData(AVUser user, AVThirdPartyUserAuth userInfo,
final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, String unionId, String unionIdPlatform,
boolean asMainAccount, final SaveCallback callback); void dissociateAuthData(final String platform, final SaveCallback callback); @Deprecated static void dissociateAuthData(final AVUser user, final String platform,
final SaveCallback callback); static final String LOG_TAG; static final String FOLLOWER_TAG; static final String FOLLOWEE_TAG; static final String SESSION_TOKEN_KEY; static final String SMS_VALIDATE_TOKEN; static final String SMS_PHONE_NUMBER; static final String AVUSER_ENDPOINT; static final String AVUSER_ENDPOINT_FAILON; static final String SNS_TENCENT_WEIBO; static final String SNS_SINA_WEIBO; static final String SNS_TENCENT_WEIXIN; static transient final Creator CREATOR; } |
@Test public void testGetTwitterToken() { String twitterToken = "twitterToken"; AVUser user = new AVUser(); user.setTwitterToken(twitterToken); Assert.assertEquals(user.getTwitterToken(), twitterToken); } | public String getTwitterToken() { return twitterToken; } | AVUser extends AVObject { public String getTwitterToken() { return twitterToken; } } | AVUser extends AVObject { public String getTwitterToken() { return twitterToken; } AVUser(); AVUser(Parcel in); } | AVUser extends AVObject { public String getTwitterToken() { return twitterToken; } AVUser(); AVUser(Parcel in); String getFacebookToken(); String getTwitterToken(); String getQqWeiboToken(); static void enableAutomaticUser(); static boolean isEnableAutomatic(); static void disableAutomaticUser(); static synchronized void changeCurrentUser(AVUser newUser, boolean save); static AVUser getCurrentUser(); @SuppressWarnings("unchecked") static T getCurrentUser(Class<T> userClass); String getEmail(); static AVQuery<T> getUserQuery(Class<T> clazz); static AVQuery<AVUser> getQuery(); String getSessionToken(); String getUsername(); boolean isAuthenticated(); void isAuthenticated(final AVCallback<Boolean> callback); boolean isAnonymous(); boolean isNew(); static AVUser logIn(String username, String password); static T logIn(String username, String password, Class<T> clazz); static void logInAnonymously(final LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<T> callback, Class<T> clazz); static void loginByEmailInBackground(String email, String password, final LogInCallback<AVUser> callback); static void loginByEmailInBackground(String email, String password, final LogInCallback<T> callback, Class<T> clazz); static AVUser loginByMobilePhoneNumber(String phone, String password); static T loginByMobilePhoneNumber(String phone, String password,
Class<T> clazz); static void loginByMobilePhoneNumberInBackground(String phone, String password,
LogInCallback<AVUser> callback); static void loginByMobilePhoneNumberInBackground(String phone,
String password, LogInCallback<T> callback, Class<T> clazz); static AVUser loginBySMSCode(String phone, String smsCode); static T loginBySMSCode(String phone, String smsCode, Class<T> clazz); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<AVUser> callback); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<T> callback, Class<T> clazz); T refreshSessionToken(); void refreshSessionTokenInBackground(LogInCallback<T> callback); static AVUser becomeWithSessionToken(String sessionToken); static AVUser becomeWithSessionToken(String sessionToken, Class<T> clazz); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<AVUser> callback); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<T> callback, Class<T> clazz); static AVUser signUpOrLoginByMobilePhone(String mobilePhoneNumber, String smsCode); static T signUpOrLoginByMobilePhone(String mobilePhoneNumber,
String smsCode, Class<T> clazz); static void signUpOrLoginByMobilePhoneInBackground(String mobilePhoneNumber,
String smsCode, LogInCallback<AVUser> callback); static void signUpOrLoginByMobilePhoneInBackground(
String mobilePhoneNumber, String smsCode, Class<T> clazz, LogInCallback<T> callback); static T newAVUser(Class<T> clazz, LogInCallback<T> cb); static void logOut(); @Override void put(String key, Object value); @Override void remove(String key); static void requestPasswordReset(String email); static void requestPasswordResetInBackground(String email,
RequestPasswordResetCallback callback); void updatePassword(String oldPassword, String newPassword); void updatePasswordInBackground(String oldPassword, String newPassword,
UpdatePasswordCallback callback); static void requestPasswordResetBySmsCode(String phoneNumber); static void requestPasswordResetBySmsCode(String phoneNumber, String validateToken); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void resetPasswordBySmsCode(String smsCode, String newPassword); static void resetPasswordBySmsCodeInBackground(String smsCode, String newPassword,
UpdatePasswordCallback callback); static void requestEmailVerify(String email); static void requestEmailVerifyInBackground(String email,
RequestEmailVerifyCallback callback); static void requestMobilePhoneVerify(String phoneNumber); static void requestMobilePhoneVerify(String phoneNumber, String validateToken); static void requestMobilePhoneVerifyInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestMobilePhoneVerifyInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void requestLoginSmsCode(String phoneNumber); static void requestLoginSmsCode(String phoneNumber, String validateToken); static void requestLoginSmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestLoginSmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void verifyMobilePhone(String verifyCode); static void verifyMobilePhoneInBackground(String verifyCode,
AVMobilePhoneVerifyCallback callback); void setEmail(String email); void setPassword(String password); void setUsername(String username); String getMobilePhoneNumber(); void setMobilePhoneNumber(String mobilePhoneNumber); boolean isMobilePhoneVerified(); @JSONField(serialize = false) List<AVRole> getRoles(); void getRolesInBackground(final AVCallback<List<AVRole>> callback); void signUp(); void signUpInBackground(SignUpCallback callback); String getSinaWeiboToken(); String getQQWeiboToken(); void followInBackground(String userObjectId, final FollowCallback callback); void followInBackground(String userObjectId, Map<String, Object> attributes,
final FollowCallback callback); void unfollowInBackground(String userObjectId, final FollowCallback callback); static AVQuery<T> followerQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followerQuery(Class<T> clazz); static AVQuery<T> followeeQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followeeQuery(Class<T> clazz); AVFriendshipQuery friendshipQuery(); AVFriendshipQuery friendshipQuery(Class<T> clazz); static AVFriendshipQuery friendshipQuery(String userId); static AVFriendshipQuery friendshipQuery(String userId,
Class<T> clazz); @Deprecated void getFollowersInBackground(final FindCallback callback); @Deprecated void getMyFolloweesInBackground(final FindCallback callback); void getFollowersAndFolloweesInBackground(final FollowersAndFolloweesCallback callback); static T cast(AVUser user, Class<T> clazz); static void alwaysUseSubUserClass(Class<? extends AVUser> clazz); @Deprecated static void loginWithAuthData(AVThirdPartyUserAuth userInfo,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform, final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<T> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData,
final String platform, final LogInCallback<T> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform,
final boolean asMainAccount, final boolean failOnNotExist,
final LogInCallback<AVUser> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final boolean failOnNotExist, final LogInCallback<AVUser> callback); @Deprecated static void loginWithAuthData(final Class<T> clazz,
final AVThirdPartyUserAuth userInfo, final LogInCallback<T> callback); @Deprecated static void associateWithAuthData(AVUser user, AVThirdPartyUserAuth userInfo,
final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, String unionId, String unionIdPlatform,
boolean asMainAccount, final SaveCallback callback); void dissociateAuthData(final String platform, final SaveCallback callback); @Deprecated static void dissociateAuthData(final AVUser user, final String platform,
final SaveCallback callback); } | AVUser extends AVObject { public String getTwitterToken() { return twitterToken; } AVUser(); AVUser(Parcel in); String getFacebookToken(); String getTwitterToken(); String getQqWeiboToken(); static void enableAutomaticUser(); static boolean isEnableAutomatic(); static void disableAutomaticUser(); static synchronized void changeCurrentUser(AVUser newUser, boolean save); static AVUser getCurrentUser(); @SuppressWarnings("unchecked") static T getCurrentUser(Class<T> userClass); String getEmail(); static AVQuery<T> getUserQuery(Class<T> clazz); static AVQuery<AVUser> getQuery(); String getSessionToken(); String getUsername(); boolean isAuthenticated(); void isAuthenticated(final AVCallback<Boolean> callback); boolean isAnonymous(); boolean isNew(); static AVUser logIn(String username, String password); static T logIn(String username, String password, Class<T> clazz); static void logInAnonymously(final LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<T> callback, Class<T> clazz); static void loginByEmailInBackground(String email, String password, final LogInCallback<AVUser> callback); static void loginByEmailInBackground(String email, String password, final LogInCallback<T> callback, Class<T> clazz); static AVUser loginByMobilePhoneNumber(String phone, String password); static T loginByMobilePhoneNumber(String phone, String password,
Class<T> clazz); static void loginByMobilePhoneNumberInBackground(String phone, String password,
LogInCallback<AVUser> callback); static void loginByMobilePhoneNumberInBackground(String phone,
String password, LogInCallback<T> callback, Class<T> clazz); static AVUser loginBySMSCode(String phone, String smsCode); static T loginBySMSCode(String phone, String smsCode, Class<T> clazz); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<AVUser> callback); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<T> callback, Class<T> clazz); T refreshSessionToken(); void refreshSessionTokenInBackground(LogInCallback<T> callback); static AVUser becomeWithSessionToken(String sessionToken); static AVUser becomeWithSessionToken(String sessionToken, Class<T> clazz); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<AVUser> callback); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<T> callback, Class<T> clazz); static AVUser signUpOrLoginByMobilePhone(String mobilePhoneNumber, String smsCode); static T signUpOrLoginByMobilePhone(String mobilePhoneNumber,
String smsCode, Class<T> clazz); static void signUpOrLoginByMobilePhoneInBackground(String mobilePhoneNumber,
String smsCode, LogInCallback<AVUser> callback); static void signUpOrLoginByMobilePhoneInBackground(
String mobilePhoneNumber, String smsCode, Class<T> clazz, LogInCallback<T> callback); static T newAVUser(Class<T> clazz, LogInCallback<T> cb); static void logOut(); @Override void put(String key, Object value); @Override void remove(String key); static void requestPasswordReset(String email); static void requestPasswordResetInBackground(String email,
RequestPasswordResetCallback callback); void updatePassword(String oldPassword, String newPassword); void updatePasswordInBackground(String oldPassword, String newPassword,
UpdatePasswordCallback callback); static void requestPasswordResetBySmsCode(String phoneNumber); static void requestPasswordResetBySmsCode(String phoneNumber, String validateToken); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void resetPasswordBySmsCode(String smsCode, String newPassword); static void resetPasswordBySmsCodeInBackground(String smsCode, String newPassword,
UpdatePasswordCallback callback); static void requestEmailVerify(String email); static void requestEmailVerifyInBackground(String email,
RequestEmailVerifyCallback callback); static void requestMobilePhoneVerify(String phoneNumber); static void requestMobilePhoneVerify(String phoneNumber, String validateToken); static void requestMobilePhoneVerifyInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestMobilePhoneVerifyInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void requestLoginSmsCode(String phoneNumber); static void requestLoginSmsCode(String phoneNumber, String validateToken); static void requestLoginSmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestLoginSmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void verifyMobilePhone(String verifyCode); static void verifyMobilePhoneInBackground(String verifyCode,
AVMobilePhoneVerifyCallback callback); void setEmail(String email); void setPassword(String password); void setUsername(String username); String getMobilePhoneNumber(); void setMobilePhoneNumber(String mobilePhoneNumber); boolean isMobilePhoneVerified(); @JSONField(serialize = false) List<AVRole> getRoles(); void getRolesInBackground(final AVCallback<List<AVRole>> callback); void signUp(); void signUpInBackground(SignUpCallback callback); String getSinaWeiboToken(); String getQQWeiboToken(); void followInBackground(String userObjectId, final FollowCallback callback); void followInBackground(String userObjectId, Map<String, Object> attributes,
final FollowCallback callback); void unfollowInBackground(String userObjectId, final FollowCallback callback); static AVQuery<T> followerQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followerQuery(Class<T> clazz); static AVQuery<T> followeeQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followeeQuery(Class<T> clazz); AVFriendshipQuery friendshipQuery(); AVFriendshipQuery friendshipQuery(Class<T> clazz); static AVFriendshipQuery friendshipQuery(String userId); static AVFriendshipQuery friendshipQuery(String userId,
Class<T> clazz); @Deprecated void getFollowersInBackground(final FindCallback callback); @Deprecated void getMyFolloweesInBackground(final FindCallback callback); void getFollowersAndFolloweesInBackground(final FollowersAndFolloweesCallback callback); static T cast(AVUser user, Class<T> clazz); static void alwaysUseSubUserClass(Class<? extends AVUser> clazz); @Deprecated static void loginWithAuthData(AVThirdPartyUserAuth userInfo,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform, final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<T> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData,
final String platform, final LogInCallback<T> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform,
final boolean asMainAccount, final boolean failOnNotExist,
final LogInCallback<AVUser> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final boolean failOnNotExist, final LogInCallback<AVUser> callback); @Deprecated static void loginWithAuthData(final Class<T> clazz,
final AVThirdPartyUserAuth userInfo, final LogInCallback<T> callback); @Deprecated static void associateWithAuthData(AVUser user, AVThirdPartyUserAuth userInfo,
final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, String unionId, String unionIdPlatform,
boolean asMainAccount, final SaveCallback callback); void dissociateAuthData(final String platform, final SaveCallback callback); @Deprecated static void dissociateAuthData(final AVUser user, final String platform,
final SaveCallback callback); static final String LOG_TAG; static final String FOLLOWER_TAG; static final String FOLLOWEE_TAG; static final String SESSION_TOKEN_KEY; static final String SMS_VALIDATE_TOKEN; static final String SMS_PHONE_NUMBER; static final String AVUSER_ENDPOINT; static final String AVUSER_ENDPOINT_FAILON; static final String SNS_TENCENT_WEIBO; static final String SNS_SINA_WEIBO; static final String SNS_TENCENT_WEIXIN; static transient final Creator CREATOR; } |
@Test public void testGetQqWeiboToken() { String qqWeiboToken = "qqWeiboToken"; AVUser user = new AVUser(); user.setQqWeiboToken(qqWeiboToken); Assert.assertEquals(user.getQqWeiboToken(), qqWeiboToken); } | public String getQqWeiboToken() { return qqWeiboToken; } | AVUser extends AVObject { public String getQqWeiboToken() { return qqWeiboToken; } } | AVUser extends AVObject { public String getQqWeiboToken() { return qqWeiboToken; } AVUser(); AVUser(Parcel in); } | AVUser extends AVObject { public String getQqWeiboToken() { return qqWeiboToken; } AVUser(); AVUser(Parcel in); String getFacebookToken(); String getTwitterToken(); String getQqWeiboToken(); static void enableAutomaticUser(); static boolean isEnableAutomatic(); static void disableAutomaticUser(); static synchronized void changeCurrentUser(AVUser newUser, boolean save); static AVUser getCurrentUser(); @SuppressWarnings("unchecked") static T getCurrentUser(Class<T> userClass); String getEmail(); static AVQuery<T> getUserQuery(Class<T> clazz); static AVQuery<AVUser> getQuery(); String getSessionToken(); String getUsername(); boolean isAuthenticated(); void isAuthenticated(final AVCallback<Boolean> callback); boolean isAnonymous(); boolean isNew(); static AVUser logIn(String username, String password); static T logIn(String username, String password, Class<T> clazz); static void logInAnonymously(final LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<T> callback, Class<T> clazz); static void loginByEmailInBackground(String email, String password, final LogInCallback<AVUser> callback); static void loginByEmailInBackground(String email, String password, final LogInCallback<T> callback, Class<T> clazz); static AVUser loginByMobilePhoneNumber(String phone, String password); static T loginByMobilePhoneNumber(String phone, String password,
Class<T> clazz); static void loginByMobilePhoneNumberInBackground(String phone, String password,
LogInCallback<AVUser> callback); static void loginByMobilePhoneNumberInBackground(String phone,
String password, LogInCallback<T> callback, Class<T> clazz); static AVUser loginBySMSCode(String phone, String smsCode); static T loginBySMSCode(String phone, String smsCode, Class<T> clazz); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<AVUser> callback); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<T> callback, Class<T> clazz); T refreshSessionToken(); void refreshSessionTokenInBackground(LogInCallback<T> callback); static AVUser becomeWithSessionToken(String sessionToken); static AVUser becomeWithSessionToken(String sessionToken, Class<T> clazz); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<AVUser> callback); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<T> callback, Class<T> clazz); static AVUser signUpOrLoginByMobilePhone(String mobilePhoneNumber, String smsCode); static T signUpOrLoginByMobilePhone(String mobilePhoneNumber,
String smsCode, Class<T> clazz); static void signUpOrLoginByMobilePhoneInBackground(String mobilePhoneNumber,
String smsCode, LogInCallback<AVUser> callback); static void signUpOrLoginByMobilePhoneInBackground(
String mobilePhoneNumber, String smsCode, Class<T> clazz, LogInCallback<T> callback); static T newAVUser(Class<T> clazz, LogInCallback<T> cb); static void logOut(); @Override void put(String key, Object value); @Override void remove(String key); static void requestPasswordReset(String email); static void requestPasswordResetInBackground(String email,
RequestPasswordResetCallback callback); void updatePassword(String oldPassword, String newPassword); void updatePasswordInBackground(String oldPassword, String newPassword,
UpdatePasswordCallback callback); static void requestPasswordResetBySmsCode(String phoneNumber); static void requestPasswordResetBySmsCode(String phoneNumber, String validateToken); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void resetPasswordBySmsCode(String smsCode, String newPassword); static void resetPasswordBySmsCodeInBackground(String smsCode, String newPassword,
UpdatePasswordCallback callback); static void requestEmailVerify(String email); static void requestEmailVerifyInBackground(String email,
RequestEmailVerifyCallback callback); static void requestMobilePhoneVerify(String phoneNumber); static void requestMobilePhoneVerify(String phoneNumber, String validateToken); static void requestMobilePhoneVerifyInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestMobilePhoneVerifyInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void requestLoginSmsCode(String phoneNumber); static void requestLoginSmsCode(String phoneNumber, String validateToken); static void requestLoginSmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestLoginSmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void verifyMobilePhone(String verifyCode); static void verifyMobilePhoneInBackground(String verifyCode,
AVMobilePhoneVerifyCallback callback); void setEmail(String email); void setPassword(String password); void setUsername(String username); String getMobilePhoneNumber(); void setMobilePhoneNumber(String mobilePhoneNumber); boolean isMobilePhoneVerified(); @JSONField(serialize = false) List<AVRole> getRoles(); void getRolesInBackground(final AVCallback<List<AVRole>> callback); void signUp(); void signUpInBackground(SignUpCallback callback); String getSinaWeiboToken(); String getQQWeiboToken(); void followInBackground(String userObjectId, final FollowCallback callback); void followInBackground(String userObjectId, Map<String, Object> attributes,
final FollowCallback callback); void unfollowInBackground(String userObjectId, final FollowCallback callback); static AVQuery<T> followerQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followerQuery(Class<T> clazz); static AVQuery<T> followeeQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followeeQuery(Class<T> clazz); AVFriendshipQuery friendshipQuery(); AVFriendshipQuery friendshipQuery(Class<T> clazz); static AVFriendshipQuery friendshipQuery(String userId); static AVFriendshipQuery friendshipQuery(String userId,
Class<T> clazz); @Deprecated void getFollowersInBackground(final FindCallback callback); @Deprecated void getMyFolloweesInBackground(final FindCallback callback); void getFollowersAndFolloweesInBackground(final FollowersAndFolloweesCallback callback); static T cast(AVUser user, Class<T> clazz); static void alwaysUseSubUserClass(Class<? extends AVUser> clazz); @Deprecated static void loginWithAuthData(AVThirdPartyUserAuth userInfo,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform, final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<T> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData,
final String platform, final LogInCallback<T> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform,
final boolean asMainAccount, final boolean failOnNotExist,
final LogInCallback<AVUser> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final boolean failOnNotExist, final LogInCallback<AVUser> callback); @Deprecated static void loginWithAuthData(final Class<T> clazz,
final AVThirdPartyUserAuth userInfo, final LogInCallback<T> callback); @Deprecated static void associateWithAuthData(AVUser user, AVThirdPartyUserAuth userInfo,
final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, String unionId, String unionIdPlatform,
boolean asMainAccount, final SaveCallback callback); void dissociateAuthData(final String platform, final SaveCallback callback); @Deprecated static void dissociateAuthData(final AVUser user, final String platform,
final SaveCallback callback); } | AVUser extends AVObject { public String getQqWeiboToken() { return qqWeiboToken; } AVUser(); AVUser(Parcel in); String getFacebookToken(); String getTwitterToken(); String getQqWeiboToken(); static void enableAutomaticUser(); static boolean isEnableAutomatic(); static void disableAutomaticUser(); static synchronized void changeCurrentUser(AVUser newUser, boolean save); static AVUser getCurrentUser(); @SuppressWarnings("unchecked") static T getCurrentUser(Class<T> userClass); String getEmail(); static AVQuery<T> getUserQuery(Class<T> clazz); static AVQuery<AVUser> getQuery(); String getSessionToken(); String getUsername(); boolean isAuthenticated(); void isAuthenticated(final AVCallback<Boolean> callback); boolean isAnonymous(); boolean isNew(); static AVUser logIn(String username, String password); static T logIn(String username, String password, Class<T> clazz); static void logInAnonymously(final LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<T> callback, Class<T> clazz); static void loginByEmailInBackground(String email, String password, final LogInCallback<AVUser> callback); static void loginByEmailInBackground(String email, String password, final LogInCallback<T> callback, Class<T> clazz); static AVUser loginByMobilePhoneNumber(String phone, String password); static T loginByMobilePhoneNumber(String phone, String password,
Class<T> clazz); static void loginByMobilePhoneNumberInBackground(String phone, String password,
LogInCallback<AVUser> callback); static void loginByMobilePhoneNumberInBackground(String phone,
String password, LogInCallback<T> callback, Class<T> clazz); static AVUser loginBySMSCode(String phone, String smsCode); static T loginBySMSCode(String phone, String smsCode, Class<T> clazz); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<AVUser> callback); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<T> callback, Class<T> clazz); T refreshSessionToken(); void refreshSessionTokenInBackground(LogInCallback<T> callback); static AVUser becomeWithSessionToken(String sessionToken); static AVUser becomeWithSessionToken(String sessionToken, Class<T> clazz); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<AVUser> callback); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<T> callback, Class<T> clazz); static AVUser signUpOrLoginByMobilePhone(String mobilePhoneNumber, String smsCode); static T signUpOrLoginByMobilePhone(String mobilePhoneNumber,
String smsCode, Class<T> clazz); static void signUpOrLoginByMobilePhoneInBackground(String mobilePhoneNumber,
String smsCode, LogInCallback<AVUser> callback); static void signUpOrLoginByMobilePhoneInBackground(
String mobilePhoneNumber, String smsCode, Class<T> clazz, LogInCallback<T> callback); static T newAVUser(Class<T> clazz, LogInCallback<T> cb); static void logOut(); @Override void put(String key, Object value); @Override void remove(String key); static void requestPasswordReset(String email); static void requestPasswordResetInBackground(String email,
RequestPasswordResetCallback callback); void updatePassword(String oldPassword, String newPassword); void updatePasswordInBackground(String oldPassword, String newPassword,
UpdatePasswordCallback callback); static void requestPasswordResetBySmsCode(String phoneNumber); static void requestPasswordResetBySmsCode(String phoneNumber, String validateToken); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void resetPasswordBySmsCode(String smsCode, String newPassword); static void resetPasswordBySmsCodeInBackground(String smsCode, String newPassword,
UpdatePasswordCallback callback); static void requestEmailVerify(String email); static void requestEmailVerifyInBackground(String email,
RequestEmailVerifyCallback callback); static void requestMobilePhoneVerify(String phoneNumber); static void requestMobilePhoneVerify(String phoneNumber, String validateToken); static void requestMobilePhoneVerifyInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestMobilePhoneVerifyInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void requestLoginSmsCode(String phoneNumber); static void requestLoginSmsCode(String phoneNumber, String validateToken); static void requestLoginSmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestLoginSmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void verifyMobilePhone(String verifyCode); static void verifyMobilePhoneInBackground(String verifyCode,
AVMobilePhoneVerifyCallback callback); void setEmail(String email); void setPassword(String password); void setUsername(String username); String getMobilePhoneNumber(); void setMobilePhoneNumber(String mobilePhoneNumber); boolean isMobilePhoneVerified(); @JSONField(serialize = false) List<AVRole> getRoles(); void getRolesInBackground(final AVCallback<List<AVRole>> callback); void signUp(); void signUpInBackground(SignUpCallback callback); String getSinaWeiboToken(); String getQQWeiboToken(); void followInBackground(String userObjectId, final FollowCallback callback); void followInBackground(String userObjectId, Map<String, Object> attributes,
final FollowCallback callback); void unfollowInBackground(String userObjectId, final FollowCallback callback); static AVQuery<T> followerQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followerQuery(Class<T> clazz); static AVQuery<T> followeeQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followeeQuery(Class<T> clazz); AVFriendshipQuery friendshipQuery(); AVFriendshipQuery friendshipQuery(Class<T> clazz); static AVFriendshipQuery friendshipQuery(String userId); static AVFriendshipQuery friendshipQuery(String userId,
Class<T> clazz); @Deprecated void getFollowersInBackground(final FindCallback callback); @Deprecated void getMyFolloweesInBackground(final FindCallback callback); void getFollowersAndFolloweesInBackground(final FollowersAndFolloweesCallback callback); static T cast(AVUser user, Class<T> clazz); static void alwaysUseSubUserClass(Class<? extends AVUser> clazz); @Deprecated static void loginWithAuthData(AVThirdPartyUserAuth userInfo,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform, final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<T> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData,
final String platform, final LogInCallback<T> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform,
final boolean asMainAccount, final boolean failOnNotExist,
final LogInCallback<AVUser> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final boolean failOnNotExist, final LogInCallback<AVUser> callback); @Deprecated static void loginWithAuthData(final Class<T> clazz,
final AVThirdPartyUserAuth userInfo, final LogInCallback<T> callback); @Deprecated static void associateWithAuthData(AVUser user, AVThirdPartyUserAuth userInfo,
final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, String unionId, String unionIdPlatform,
boolean asMainAccount, final SaveCallback callback); void dissociateAuthData(final String platform, final SaveCallback callback); @Deprecated static void dissociateAuthData(final AVUser user, final String platform,
final SaveCallback callback); static final String LOG_TAG; static final String FOLLOWER_TAG; static final String FOLLOWEE_TAG; static final String SESSION_TOKEN_KEY; static final String SMS_VALIDATE_TOKEN; static final String SMS_PHONE_NUMBER; static final String AVUSER_ENDPOINT; static final String AVUSER_ENDPOINT_FAILON; static final String SNS_TENCENT_WEIBO; static final String SNS_SINA_WEIBO; static final String SNS_TENCENT_WEIXIN; static transient final Creator CREATOR; } |
@Test public void testGetUserQuery() { Assert.assertNotNull(AVUser.getQuery()); } | public static <T extends AVUser> AVQuery<T> getUserQuery(Class<T> clazz) { AVQuery<T> query = new AVQuery<T>(userClassName(), clazz); return query; } | AVUser extends AVObject { public static <T extends AVUser> AVQuery<T> getUserQuery(Class<T> clazz) { AVQuery<T> query = new AVQuery<T>(userClassName(), clazz); return query; } } | AVUser extends AVObject { public static <T extends AVUser> AVQuery<T> getUserQuery(Class<T> clazz) { AVQuery<T> query = new AVQuery<T>(userClassName(), clazz); return query; } AVUser(); AVUser(Parcel in); } | AVUser extends AVObject { public static <T extends AVUser> AVQuery<T> getUserQuery(Class<T> clazz) { AVQuery<T> query = new AVQuery<T>(userClassName(), clazz); return query; } AVUser(); AVUser(Parcel in); String getFacebookToken(); String getTwitterToken(); String getQqWeiboToken(); static void enableAutomaticUser(); static boolean isEnableAutomatic(); static void disableAutomaticUser(); static synchronized void changeCurrentUser(AVUser newUser, boolean save); static AVUser getCurrentUser(); @SuppressWarnings("unchecked") static T getCurrentUser(Class<T> userClass); String getEmail(); static AVQuery<T> getUserQuery(Class<T> clazz); static AVQuery<AVUser> getQuery(); String getSessionToken(); String getUsername(); boolean isAuthenticated(); void isAuthenticated(final AVCallback<Boolean> callback); boolean isAnonymous(); boolean isNew(); static AVUser logIn(String username, String password); static T logIn(String username, String password, Class<T> clazz); static void logInAnonymously(final LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<T> callback, Class<T> clazz); static void loginByEmailInBackground(String email, String password, final LogInCallback<AVUser> callback); static void loginByEmailInBackground(String email, String password, final LogInCallback<T> callback, Class<T> clazz); static AVUser loginByMobilePhoneNumber(String phone, String password); static T loginByMobilePhoneNumber(String phone, String password,
Class<T> clazz); static void loginByMobilePhoneNumberInBackground(String phone, String password,
LogInCallback<AVUser> callback); static void loginByMobilePhoneNumberInBackground(String phone,
String password, LogInCallback<T> callback, Class<T> clazz); static AVUser loginBySMSCode(String phone, String smsCode); static T loginBySMSCode(String phone, String smsCode, Class<T> clazz); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<AVUser> callback); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<T> callback, Class<T> clazz); T refreshSessionToken(); void refreshSessionTokenInBackground(LogInCallback<T> callback); static AVUser becomeWithSessionToken(String sessionToken); static AVUser becomeWithSessionToken(String sessionToken, Class<T> clazz); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<AVUser> callback); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<T> callback, Class<T> clazz); static AVUser signUpOrLoginByMobilePhone(String mobilePhoneNumber, String smsCode); static T signUpOrLoginByMobilePhone(String mobilePhoneNumber,
String smsCode, Class<T> clazz); static void signUpOrLoginByMobilePhoneInBackground(String mobilePhoneNumber,
String smsCode, LogInCallback<AVUser> callback); static void signUpOrLoginByMobilePhoneInBackground(
String mobilePhoneNumber, String smsCode, Class<T> clazz, LogInCallback<T> callback); static T newAVUser(Class<T> clazz, LogInCallback<T> cb); static void logOut(); @Override void put(String key, Object value); @Override void remove(String key); static void requestPasswordReset(String email); static void requestPasswordResetInBackground(String email,
RequestPasswordResetCallback callback); void updatePassword(String oldPassword, String newPassword); void updatePasswordInBackground(String oldPassword, String newPassword,
UpdatePasswordCallback callback); static void requestPasswordResetBySmsCode(String phoneNumber); static void requestPasswordResetBySmsCode(String phoneNumber, String validateToken); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void resetPasswordBySmsCode(String smsCode, String newPassword); static void resetPasswordBySmsCodeInBackground(String smsCode, String newPassword,
UpdatePasswordCallback callback); static void requestEmailVerify(String email); static void requestEmailVerifyInBackground(String email,
RequestEmailVerifyCallback callback); static void requestMobilePhoneVerify(String phoneNumber); static void requestMobilePhoneVerify(String phoneNumber, String validateToken); static void requestMobilePhoneVerifyInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestMobilePhoneVerifyInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void requestLoginSmsCode(String phoneNumber); static void requestLoginSmsCode(String phoneNumber, String validateToken); static void requestLoginSmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestLoginSmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void verifyMobilePhone(String verifyCode); static void verifyMobilePhoneInBackground(String verifyCode,
AVMobilePhoneVerifyCallback callback); void setEmail(String email); void setPassword(String password); void setUsername(String username); String getMobilePhoneNumber(); void setMobilePhoneNumber(String mobilePhoneNumber); boolean isMobilePhoneVerified(); @JSONField(serialize = false) List<AVRole> getRoles(); void getRolesInBackground(final AVCallback<List<AVRole>> callback); void signUp(); void signUpInBackground(SignUpCallback callback); String getSinaWeiboToken(); String getQQWeiboToken(); void followInBackground(String userObjectId, final FollowCallback callback); void followInBackground(String userObjectId, Map<String, Object> attributes,
final FollowCallback callback); void unfollowInBackground(String userObjectId, final FollowCallback callback); static AVQuery<T> followerQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followerQuery(Class<T> clazz); static AVQuery<T> followeeQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followeeQuery(Class<T> clazz); AVFriendshipQuery friendshipQuery(); AVFriendshipQuery friendshipQuery(Class<T> clazz); static AVFriendshipQuery friendshipQuery(String userId); static AVFriendshipQuery friendshipQuery(String userId,
Class<T> clazz); @Deprecated void getFollowersInBackground(final FindCallback callback); @Deprecated void getMyFolloweesInBackground(final FindCallback callback); void getFollowersAndFolloweesInBackground(final FollowersAndFolloweesCallback callback); static T cast(AVUser user, Class<T> clazz); static void alwaysUseSubUserClass(Class<? extends AVUser> clazz); @Deprecated static void loginWithAuthData(AVThirdPartyUserAuth userInfo,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform, final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<T> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData,
final String platform, final LogInCallback<T> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform,
final boolean asMainAccount, final boolean failOnNotExist,
final LogInCallback<AVUser> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final boolean failOnNotExist, final LogInCallback<AVUser> callback); @Deprecated static void loginWithAuthData(final Class<T> clazz,
final AVThirdPartyUserAuth userInfo, final LogInCallback<T> callback); @Deprecated static void associateWithAuthData(AVUser user, AVThirdPartyUserAuth userInfo,
final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, String unionId, String unionIdPlatform,
boolean asMainAccount, final SaveCallback callback); void dissociateAuthData(final String platform, final SaveCallback callback); @Deprecated static void dissociateAuthData(final AVUser user, final String platform,
final SaveCallback callback); } | AVUser extends AVObject { public static <T extends AVUser> AVQuery<T> getUserQuery(Class<T> clazz) { AVQuery<T> query = new AVQuery<T>(userClassName(), clazz); return query; } AVUser(); AVUser(Parcel in); String getFacebookToken(); String getTwitterToken(); String getQqWeiboToken(); static void enableAutomaticUser(); static boolean isEnableAutomatic(); static void disableAutomaticUser(); static synchronized void changeCurrentUser(AVUser newUser, boolean save); static AVUser getCurrentUser(); @SuppressWarnings("unchecked") static T getCurrentUser(Class<T> userClass); String getEmail(); static AVQuery<T> getUserQuery(Class<T> clazz); static AVQuery<AVUser> getQuery(); String getSessionToken(); String getUsername(); boolean isAuthenticated(); void isAuthenticated(final AVCallback<Boolean> callback); boolean isAnonymous(); boolean isNew(); static AVUser logIn(String username, String password); static T logIn(String username, String password, Class<T> clazz); static void logInAnonymously(final LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<T> callback, Class<T> clazz); static void loginByEmailInBackground(String email, String password, final LogInCallback<AVUser> callback); static void loginByEmailInBackground(String email, String password, final LogInCallback<T> callback, Class<T> clazz); static AVUser loginByMobilePhoneNumber(String phone, String password); static T loginByMobilePhoneNumber(String phone, String password,
Class<T> clazz); static void loginByMobilePhoneNumberInBackground(String phone, String password,
LogInCallback<AVUser> callback); static void loginByMobilePhoneNumberInBackground(String phone,
String password, LogInCallback<T> callback, Class<T> clazz); static AVUser loginBySMSCode(String phone, String smsCode); static T loginBySMSCode(String phone, String smsCode, Class<T> clazz); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<AVUser> callback); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<T> callback, Class<T> clazz); T refreshSessionToken(); void refreshSessionTokenInBackground(LogInCallback<T> callback); static AVUser becomeWithSessionToken(String sessionToken); static AVUser becomeWithSessionToken(String sessionToken, Class<T> clazz); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<AVUser> callback); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<T> callback, Class<T> clazz); static AVUser signUpOrLoginByMobilePhone(String mobilePhoneNumber, String smsCode); static T signUpOrLoginByMobilePhone(String mobilePhoneNumber,
String smsCode, Class<T> clazz); static void signUpOrLoginByMobilePhoneInBackground(String mobilePhoneNumber,
String smsCode, LogInCallback<AVUser> callback); static void signUpOrLoginByMobilePhoneInBackground(
String mobilePhoneNumber, String smsCode, Class<T> clazz, LogInCallback<T> callback); static T newAVUser(Class<T> clazz, LogInCallback<T> cb); static void logOut(); @Override void put(String key, Object value); @Override void remove(String key); static void requestPasswordReset(String email); static void requestPasswordResetInBackground(String email,
RequestPasswordResetCallback callback); void updatePassword(String oldPassword, String newPassword); void updatePasswordInBackground(String oldPassword, String newPassword,
UpdatePasswordCallback callback); static void requestPasswordResetBySmsCode(String phoneNumber); static void requestPasswordResetBySmsCode(String phoneNumber, String validateToken); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void resetPasswordBySmsCode(String smsCode, String newPassword); static void resetPasswordBySmsCodeInBackground(String smsCode, String newPassword,
UpdatePasswordCallback callback); static void requestEmailVerify(String email); static void requestEmailVerifyInBackground(String email,
RequestEmailVerifyCallback callback); static void requestMobilePhoneVerify(String phoneNumber); static void requestMobilePhoneVerify(String phoneNumber, String validateToken); static void requestMobilePhoneVerifyInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestMobilePhoneVerifyInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void requestLoginSmsCode(String phoneNumber); static void requestLoginSmsCode(String phoneNumber, String validateToken); static void requestLoginSmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestLoginSmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void verifyMobilePhone(String verifyCode); static void verifyMobilePhoneInBackground(String verifyCode,
AVMobilePhoneVerifyCallback callback); void setEmail(String email); void setPassword(String password); void setUsername(String username); String getMobilePhoneNumber(); void setMobilePhoneNumber(String mobilePhoneNumber); boolean isMobilePhoneVerified(); @JSONField(serialize = false) List<AVRole> getRoles(); void getRolesInBackground(final AVCallback<List<AVRole>> callback); void signUp(); void signUpInBackground(SignUpCallback callback); String getSinaWeiboToken(); String getQQWeiboToken(); void followInBackground(String userObjectId, final FollowCallback callback); void followInBackground(String userObjectId, Map<String, Object> attributes,
final FollowCallback callback); void unfollowInBackground(String userObjectId, final FollowCallback callback); static AVQuery<T> followerQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followerQuery(Class<T> clazz); static AVQuery<T> followeeQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followeeQuery(Class<T> clazz); AVFriendshipQuery friendshipQuery(); AVFriendshipQuery friendshipQuery(Class<T> clazz); static AVFriendshipQuery friendshipQuery(String userId); static AVFriendshipQuery friendshipQuery(String userId,
Class<T> clazz); @Deprecated void getFollowersInBackground(final FindCallback callback); @Deprecated void getMyFolloweesInBackground(final FindCallback callback); void getFollowersAndFolloweesInBackground(final FollowersAndFolloweesCallback callback); static T cast(AVUser user, Class<T> clazz); static void alwaysUseSubUserClass(Class<? extends AVUser> clazz); @Deprecated static void loginWithAuthData(AVThirdPartyUserAuth userInfo,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform, final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<T> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData,
final String platform, final LogInCallback<T> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform,
final boolean asMainAccount, final boolean failOnNotExist,
final LogInCallback<AVUser> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final boolean failOnNotExist, final LogInCallback<AVUser> callback); @Deprecated static void loginWithAuthData(final Class<T> clazz,
final AVThirdPartyUserAuth userInfo, final LogInCallback<T> callback); @Deprecated static void associateWithAuthData(AVUser user, AVThirdPartyUserAuth userInfo,
final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, String unionId, String unionIdPlatform,
boolean asMainAccount, final SaveCallback callback); void dissociateAuthData(final String platform, final SaveCallback callback); @Deprecated static void dissociateAuthData(final AVUser user, final String platform,
final SaveCallback callback); static final String LOG_TAG; static final String FOLLOWER_TAG; static final String FOLLOWEE_TAG; static final String SESSION_TOKEN_KEY; static final String SMS_VALIDATE_TOKEN; static final String SMS_PHONE_NUMBER; static final String AVUSER_ENDPOINT; static final String AVUSER_ENDPOINT_FAILON; static final String SNS_TENCENT_WEIBO; static final String SNS_SINA_WEIBO; static final String SNS_TENCENT_WEIXIN; static transient final Creator CREATOR; } |
@Test public void testFriendshipQuery() { AVUser user = new AVUser(); Assert.assertNotNull(user.friendshipQuery()); } | public AVFriendshipQuery friendshipQuery() { return this.friendshipQuery(subClazz == null ? AVUser.class : subClazz); } | AVUser extends AVObject { public AVFriendshipQuery friendshipQuery() { return this.friendshipQuery(subClazz == null ? AVUser.class : subClazz); } } | AVUser extends AVObject { public AVFriendshipQuery friendshipQuery() { return this.friendshipQuery(subClazz == null ? AVUser.class : subClazz); } AVUser(); AVUser(Parcel in); } | AVUser extends AVObject { public AVFriendshipQuery friendshipQuery() { return this.friendshipQuery(subClazz == null ? AVUser.class : subClazz); } AVUser(); AVUser(Parcel in); String getFacebookToken(); String getTwitterToken(); String getQqWeiboToken(); static void enableAutomaticUser(); static boolean isEnableAutomatic(); static void disableAutomaticUser(); static synchronized void changeCurrentUser(AVUser newUser, boolean save); static AVUser getCurrentUser(); @SuppressWarnings("unchecked") static T getCurrentUser(Class<T> userClass); String getEmail(); static AVQuery<T> getUserQuery(Class<T> clazz); static AVQuery<AVUser> getQuery(); String getSessionToken(); String getUsername(); boolean isAuthenticated(); void isAuthenticated(final AVCallback<Boolean> callback); boolean isAnonymous(); boolean isNew(); static AVUser logIn(String username, String password); static T logIn(String username, String password, Class<T> clazz); static void logInAnonymously(final LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<T> callback, Class<T> clazz); static void loginByEmailInBackground(String email, String password, final LogInCallback<AVUser> callback); static void loginByEmailInBackground(String email, String password, final LogInCallback<T> callback, Class<T> clazz); static AVUser loginByMobilePhoneNumber(String phone, String password); static T loginByMobilePhoneNumber(String phone, String password,
Class<T> clazz); static void loginByMobilePhoneNumberInBackground(String phone, String password,
LogInCallback<AVUser> callback); static void loginByMobilePhoneNumberInBackground(String phone,
String password, LogInCallback<T> callback, Class<T> clazz); static AVUser loginBySMSCode(String phone, String smsCode); static T loginBySMSCode(String phone, String smsCode, Class<T> clazz); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<AVUser> callback); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<T> callback, Class<T> clazz); T refreshSessionToken(); void refreshSessionTokenInBackground(LogInCallback<T> callback); static AVUser becomeWithSessionToken(String sessionToken); static AVUser becomeWithSessionToken(String sessionToken, Class<T> clazz); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<AVUser> callback); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<T> callback, Class<T> clazz); static AVUser signUpOrLoginByMobilePhone(String mobilePhoneNumber, String smsCode); static T signUpOrLoginByMobilePhone(String mobilePhoneNumber,
String smsCode, Class<T> clazz); static void signUpOrLoginByMobilePhoneInBackground(String mobilePhoneNumber,
String smsCode, LogInCallback<AVUser> callback); static void signUpOrLoginByMobilePhoneInBackground(
String mobilePhoneNumber, String smsCode, Class<T> clazz, LogInCallback<T> callback); static T newAVUser(Class<T> clazz, LogInCallback<T> cb); static void logOut(); @Override void put(String key, Object value); @Override void remove(String key); static void requestPasswordReset(String email); static void requestPasswordResetInBackground(String email,
RequestPasswordResetCallback callback); void updatePassword(String oldPassword, String newPassword); void updatePasswordInBackground(String oldPassword, String newPassword,
UpdatePasswordCallback callback); static void requestPasswordResetBySmsCode(String phoneNumber); static void requestPasswordResetBySmsCode(String phoneNumber, String validateToken); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void resetPasswordBySmsCode(String smsCode, String newPassword); static void resetPasswordBySmsCodeInBackground(String smsCode, String newPassword,
UpdatePasswordCallback callback); static void requestEmailVerify(String email); static void requestEmailVerifyInBackground(String email,
RequestEmailVerifyCallback callback); static void requestMobilePhoneVerify(String phoneNumber); static void requestMobilePhoneVerify(String phoneNumber, String validateToken); static void requestMobilePhoneVerifyInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestMobilePhoneVerifyInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void requestLoginSmsCode(String phoneNumber); static void requestLoginSmsCode(String phoneNumber, String validateToken); static void requestLoginSmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestLoginSmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void verifyMobilePhone(String verifyCode); static void verifyMobilePhoneInBackground(String verifyCode,
AVMobilePhoneVerifyCallback callback); void setEmail(String email); void setPassword(String password); void setUsername(String username); String getMobilePhoneNumber(); void setMobilePhoneNumber(String mobilePhoneNumber); boolean isMobilePhoneVerified(); @JSONField(serialize = false) List<AVRole> getRoles(); void getRolesInBackground(final AVCallback<List<AVRole>> callback); void signUp(); void signUpInBackground(SignUpCallback callback); String getSinaWeiboToken(); String getQQWeiboToken(); void followInBackground(String userObjectId, final FollowCallback callback); void followInBackground(String userObjectId, Map<String, Object> attributes,
final FollowCallback callback); void unfollowInBackground(String userObjectId, final FollowCallback callback); static AVQuery<T> followerQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followerQuery(Class<T> clazz); static AVQuery<T> followeeQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followeeQuery(Class<T> clazz); AVFriendshipQuery friendshipQuery(); AVFriendshipQuery friendshipQuery(Class<T> clazz); static AVFriendshipQuery friendshipQuery(String userId); static AVFriendshipQuery friendshipQuery(String userId,
Class<T> clazz); @Deprecated void getFollowersInBackground(final FindCallback callback); @Deprecated void getMyFolloweesInBackground(final FindCallback callback); void getFollowersAndFolloweesInBackground(final FollowersAndFolloweesCallback callback); static T cast(AVUser user, Class<T> clazz); static void alwaysUseSubUserClass(Class<? extends AVUser> clazz); @Deprecated static void loginWithAuthData(AVThirdPartyUserAuth userInfo,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform, final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<T> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData,
final String platform, final LogInCallback<T> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform,
final boolean asMainAccount, final boolean failOnNotExist,
final LogInCallback<AVUser> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final boolean failOnNotExist, final LogInCallback<AVUser> callback); @Deprecated static void loginWithAuthData(final Class<T> clazz,
final AVThirdPartyUserAuth userInfo, final LogInCallback<T> callback); @Deprecated static void associateWithAuthData(AVUser user, AVThirdPartyUserAuth userInfo,
final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, String unionId, String unionIdPlatform,
boolean asMainAccount, final SaveCallback callback); void dissociateAuthData(final String platform, final SaveCallback callback); @Deprecated static void dissociateAuthData(final AVUser user, final String platform,
final SaveCallback callback); } | AVUser extends AVObject { public AVFriendshipQuery friendshipQuery() { return this.friendshipQuery(subClazz == null ? AVUser.class : subClazz); } AVUser(); AVUser(Parcel in); String getFacebookToken(); String getTwitterToken(); String getQqWeiboToken(); static void enableAutomaticUser(); static boolean isEnableAutomatic(); static void disableAutomaticUser(); static synchronized void changeCurrentUser(AVUser newUser, boolean save); static AVUser getCurrentUser(); @SuppressWarnings("unchecked") static T getCurrentUser(Class<T> userClass); String getEmail(); static AVQuery<T> getUserQuery(Class<T> clazz); static AVQuery<AVUser> getQuery(); String getSessionToken(); String getUsername(); boolean isAuthenticated(); void isAuthenticated(final AVCallback<Boolean> callback); boolean isAnonymous(); boolean isNew(); static AVUser logIn(String username, String password); static T logIn(String username, String password, Class<T> clazz); static void logInAnonymously(final LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<T> callback, Class<T> clazz); static void loginByEmailInBackground(String email, String password, final LogInCallback<AVUser> callback); static void loginByEmailInBackground(String email, String password, final LogInCallback<T> callback, Class<T> clazz); static AVUser loginByMobilePhoneNumber(String phone, String password); static T loginByMobilePhoneNumber(String phone, String password,
Class<T> clazz); static void loginByMobilePhoneNumberInBackground(String phone, String password,
LogInCallback<AVUser> callback); static void loginByMobilePhoneNumberInBackground(String phone,
String password, LogInCallback<T> callback, Class<T> clazz); static AVUser loginBySMSCode(String phone, String smsCode); static T loginBySMSCode(String phone, String smsCode, Class<T> clazz); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<AVUser> callback); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<T> callback, Class<T> clazz); T refreshSessionToken(); void refreshSessionTokenInBackground(LogInCallback<T> callback); static AVUser becomeWithSessionToken(String sessionToken); static AVUser becomeWithSessionToken(String sessionToken, Class<T> clazz); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<AVUser> callback); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<T> callback, Class<T> clazz); static AVUser signUpOrLoginByMobilePhone(String mobilePhoneNumber, String smsCode); static T signUpOrLoginByMobilePhone(String mobilePhoneNumber,
String smsCode, Class<T> clazz); static void signUpOrLoginByMobilePhoneInBackground(String mobilePhoneNumber,
String smsCode, LogInCallback<AVUser> callback); static void signUpOrLoginByMobilePhoneInBackground(
String mobilePhoneNumber, String smsCode, Class<T> clazz, LogInCallback<T> callback); static T newAVUser(Class<T> clazz, LogInCallback<T> cb); static void logOut(); @Override void put(String key, Object value); @Override void remove(String key); static void requestPasswordReset(String email); static void requestPasswordResetInBackground(String email,
RequestPasswordResetCallback callback); void updatePassword(String oldPassword, String newPassword); void updatePasswordInBackground(String oldPassword, String newPassword,
UpdatePasswordCallback callback); static void requestPasswordResetBySmsCode(String phoneNumber); static void requestPasswordResetBySmsCode(String phoneNumber, String validateToken); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void resetPasswordBySmsCode(String smsCode, String newPassword); static void resetPasswordBySmsCodeInBackground(String smsCode, String newPassword,
UpdatePasswordCallback callback); static void requestEmailVerify(String email); static void requestEmailVerifyInBackground(String email,
RequestEmailVerifyCallback callback); static void requestMobilePhoneVerify(String phoneNumber); static void requestMobilePhoneVerify(String phoneNumber, String validateToken); static void requestMobilePhoneVerifyInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestMobilePhoneVerifyInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void requestLoginSmsCode(String phoneNumber); static void requestLoginSmsCode(String phoneNumber, String validateToken); static void requestLoginSmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestLoginSmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void verifyMobilePhone(String verifyCode); static void verifyMobilePhoneInBackground(String verifyCode,
AVMobilePhoneVerifyCallback callback); void setEmail(String email); void setPassword(String password); void setUsername(String username); String getMobilePhoneNumber(); void setMobilePhoneNumber(String mobilePhoneNumber); boolean isMobilePhoneVerified(); @JSONField(serialize = false) List<AVRole> getRoles(); void getRolesInBackground(final AVCallback<List<AVRole>> callback); void signUp(); void signUpInBackground(SignUpCallback callback); String getSinaWeiboToken(); String getQQWeiboToken(); void followInBackground(String userObjectId, final FollowCallback callback); void followInBackground(String userObjectId, Map<String, Object> attributes,
final FollowCallback callback); void unfollowInBackground(String userObjectId, final FollowCallback callback); static AVQuery<T> followerQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followerQuery(Class<T> clazz); static AVQuery<T> followeeQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followeeQuery(Class<T> clazz); AVFriendshipQuery friendshipQuery(); AVFriendshipQuery friendshipQuery(Class<T> clazz); static AVFriendshipQuery friendshipQuery(String userId); static AVFriendshipQuery friendshipQuery(String userId,
Class<T> clazz); @Deprecated void getFollowersInBackground(final FindCallback callback); @Deprecated void getMyFolloweesInBackground(final FindCallback callback); void getFollowersAndFolloweesInBackground(final FollowersAndFolloweesCallback callback); static T cast(AVUser user, Class<T> clazz); static void alwaysUseSubUserClass(Class<? extends AVUser> clazz); @Deprecated static void loginWithAuthData(AVThirdPartyUserAuth userInfo,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform, final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<T> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData,
final String platform, final LogInCallback<T> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform,
final boolean asMainAccount, final boolean failOnNotExist,
final LogInCallback<AVUser> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final boolean failOnNotExist, final LogInCallback<AVUser> callback); @Deprecated static void loginWithAuthData(final Class<T> clazz,
final AVThirdPartyUserAuth userInfo, final LogInCallback<T> callback); @Deprecated static void associateWithAuthData(AVUser user, AVThirdPartyUserAuth userInfo,
final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, String unionId, String unionIdPlatform,
boolean asMainAccount, final SaveCallback callback); void dissociateAuthData(final String platform, final SaveCallback callback); @Deprecated static void dissociateAuthData(final AVUser user, final String platform,
final SaveCallback callback); static final String LOG_TAG; static final String FOLLOWER_TAG; static final String FOLLOWEE_TAG; static final String SESSION_TOKEN_KEY; static final String SMS_VALIDATE_TOKEN; static final String SMS_PHONE_NUMBER; static final String AVUSER_ENDPOINT; static final String AVUSER_ENDPOINT_FAILON; static final String SNS_TENCENT_WEIBO; static final String SNS_SINA_WEIBO; static final String SNS_TENCENT_WEIXIN; static transient final Creator CREATOR; } |
@Test(expected = IllegalArgumentException.class) public void testLogIn_nullName() throws Exception { AVUser.logIn("", ""); } | public static AVUser logIn(String username, String password) throws AVException { return logIn(username, password, AVUser.class); } | AVUser extends AVObject { public static AVUser logIn(String username, String password) throws AVException { return logIn(username, password, AVUser.class); } } | AVUser extends AVObject { public static AVUser logIn(String username, String password) throws AVException { return logIn(username, password, AVUser.class); } AVUser(); AVUser(Parcel in); } | AVUser extends AVObject { public static AVUser logIn(String username, String password) throws AVException { return logIn(username, password, AVUser.class); } AVUser(); AVUser(Parcel in); String getFacebookToken(); String getTwitterToken(); String getQqWeiboToken(); static void enableAutomaticUser(); static boolean isEnableAutomatic(); static void disableAutomaticUser(); static synchronized void changeCurrentUser(AVUser newUser, boolean save); static AVUser getCurrentUser(); @SuppressWarnings("unchecked") static T getCurrentUser(Class<T> userClass); String getEmail(); static AVQuery<T> getUserQuery(Class<T> clazz); static AVQuery<AVUser> getQuery(); String getSessionToken(); String getUsername(); boolean isAuthenticated(); void isAuthenticated(final AVCallback<Boolean> callback); boolean isAnonymous(); boolean isNew(); static AVUser logIn(String username, String password); static T logIn(String username, String password, Class<T> clazz); static void logInAnonymously(final LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<T> callback, Class<T> clazz); static void loginByEmailInBackground(String email, String password, final LogInCallback<AVUser> callback); static void loginByEmailInBackground(String email, String password, final LogInCallback<T> callback, Class<T> clazz); static AVUser loginByMobilePhoneNumber(String phone, String password); static T loginByMobilePhoneNumber(String phone, String password,
Class<T> clazz); static void loginByMobilePhoneNumberInBackground(String phone, String password,
LogInCallback<AVUser> callback); static void loginByMobilePhoneNumberInBackground(String phone,
String password, LogInCallback<T> callback, Class<T> clazz); static AVUser loginBySMSCode(String phone, String smsCode); static T loginBySMSCode(String phone, String smsCode, Class<T> clazz); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<AVUser> callback); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<T> callback, Class<T> clazz); T refreshSessionToken(); void refreshSessionTokenInBackground(LogInCallback<T> callback); static AVUser becomeWithSessionToken(String sessionToken); static AVUser becomeWithSessionToken(String sessionToken, Class<T> clazz); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<AVUser> callback); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<T> callback, Class<T> clazz); static AVUser signUpOrLoginByMobilePhone(String mobilePhoneNumber, String smsCode); static T signUpOrLoginByMobilePhone(String mobilePhoneNumber,
String smsCode, Class<T> clazz); static void signUpOrLoginByMobilePhoneInBackground(String mobilePhoneNumber,
String smsCode, LogInCallback<AVUser> callback); static void signUpOrLoginByMobilePhoneInBackground(
String mobilePhoneNumber, String smsCode, Class<T> clazz, LogInCallback<T> callback); static T newAVUser(Class<T> clazz, LogInCallback<T> cb); static void logOut(); @Override void put(String key, Object value); @Override void remove(String key); static void requestPasswordReset(String email); static void requestPasswordResetInBackground(String email,
RequestPasswordResetCallback callback); void updatePassword(String oldPassword, String newPassword); void updatePasswordInBackground(String oldPassword, String newPassword,
UpdatePasswordCallback callback); static void requestPasswordResetBySmsCode(String phoneNumber); static void requestPasswordResetBySmsCode(String phoneNumber, String validateToken); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void resetPasswordBySmsCode(String smsCode, String newPassword); static void resetPasswordBySmsCodeInBackground(String smsCode, String newPassword,
UpdatePasswordCallback callback); static void requestEmailVerify(String email); static void requestEmailVerifyInBackground(String email,
RequestEmailVerifyCallback callback); static void requestMobilePhoneVerify(String phoneNumber); static void requestMobilePhoneVerify(String phoneNumber, String validateToken); static void requestMobilePhoneVerifyInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestMobilePhoneVerifyInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void requestLoginSmsCode(String phoneNumber); static void requestLoginSmsCode(String phoneNumber, String validateToken); static void requestLoginSmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestLoginSmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void verifyMobilePhone(String verifyCode); static void verifyMobilePhoneInBackground(String verifyCode,
AVMobilePhoneVerifyCallback callback); void setEmail(String email); void setPassword(String password); void setUsername(String username); String getMobilePhoneNumber(); void setMobilePhoneNumber(String mobilePhoneNumber); boolean isMobilePhoneVerified(); @JSONField(serialize = false) List<AVRole> getRoles(); void getRolesInBackground(final AVCallback<List<AVRole>> callback); void signUp(); void signUpInBackground(SignUpCallback callback); String getSinaWeiboToken(); String getQQWeiboToken(); void followInBackground(String userObjectId, final FollowCallback callback); void followInBackground(String userObjectId, Map<String, Object> attributes,
final FollowCallback callback); void unfollowInBackground(String userObjectId, final FollowCallback callback); static AVQuery<T> followerQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followerQuery(Class<T> clazz); static AVQuery<T> followeeQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followeeQuery(Class<T> clazz); AVFriendshipQuery friendshipQuery(); AVFriendshipQuery friendshipQuery(Class<T> clazz); static AVFriendshipQuery friendshipQuery(String userId); static AVFriendshipQuery friendshipQuery(String userId,
Class<T> clazz); @Deprecated void getFollowersInBackground(final FindCallback callback); @Deprecated void getMyFolloweesInBackground(final FindCallback callback); void getFollowersAndFolloweesInBackground(final FollowersAndFolloweesCallback callback); static T cast(AVUser user, Class<T> clazz); static void alwaysUseSubUserClass(Class<? extends AVUser> clazz); @Deprecated static void loginWithAuthData(AVThirdPartyUserAuth userInfo,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform, final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<T> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData,
final String platform, final LogInCallback<T> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform,
final boolean asMainAccount, final boolean failOnNotExist,
final LogInCallback<AVUser> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final boolean failOnNotExist, final LogInCallback<AVUser> callback); @Deprecated static void loginWithAuthData(final Class<T> clazz,
final AVThirdPartyUserAuth userInfo, final LogInCallback<T> callback); @Deprecated static void associateWithAuthData(AVUser user, AVThirdPartyUserAuth userInfo,
final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, String unionId, String unionIdPlatform,
boolean asMainAccount, final SaveCallback callback); void dissociateAuthData(final String platform, final SaveCallback callback); @Deprecated static void dissociateAuthData(final AVUser user, final String platform,
final SaveCallback callback); } | AVUser extends AVObject { public static AVUser logIn(String username, String password) throws AVException { return logIn(username, password, AVUser.class); } AVUser(); AVUser(Parcel in); String getFacebookToken(); String getTwitterToken(); String getQqWeiboToken(); static void enableAutomaticUser(); static boolean isEnableAutomatic(); static void disableAutomaticUser(); static synchronized void changeCurrentUser(AVUser newUser, boolean save); static AVUser getCurrentUser(); @SuppressWarnings("unchecked") static T getCurrentUser(Class<T> userClass); String getEmail(); static AVQuery<T> getUserQuery(Class<T> clazz); static AVQuery<AVUser> getQuery(); String getSessionToken(); String getUsername(); boolean isAuthenticated(); void isAuthenticated(final AVCallback<Boolean> callback); boolean isAnonymous(); boolean isNew(); static AVUser logIn(String username, String password); static T logIn(String username, String password, Class<T> clazz); static void logInAnonymously(final LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<T> callback, Class<T> clazz); static void loginByEmailInBackground(String email, String password, final LogInCallback<AVUser> callback); static void loginByEmailInBackground(String email, String password, final LogInCallback<T> callback, Class<T> clazz); static AVUser loginByMobilePhoneNumber(String phone, String password); static T loginByMobilePhoneNumber(String phone, String password,
Class<T> clazz); static void loginByMobilePhoneNumberInBackground(String phone, String password,
LogInCallback<AVUser> callback); static void loginByMobilePhoneNumberInBackground(String phone,
String password, LogInCallback<T> callback, Class<T> clazz); static AVUser loginBySMSCode(String phone, String smsCode); static T loginBySMSCode(String phone, String smsCode, Class<T> clazz); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<AVUser> callback); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<T> callback, Class<T> clazz); T refreshSessionToken(); void refreshSessionTokenInBackground(LogInCallback<T> callback); static AVUser becomeWithSessionToken(String sessionToken); static AVUser becomeWithSessionToken(String sessionToken, Class<T> clazz); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<AVUser> callback); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<T> callback, Class<T> clazz); static AVUser signUpOrLoginByMobilePhone(String mobilePhoneNumber, String smsCode); static T signUpOrLoginByMobilePhone(String mobilePhoneNumber,
String smsCode, Class<T> clazz); static void signUpOrLoginByMobilePhoneInBackground(String mobilePhoneNumber,
String smsCode, LogInCallback<AVUser> callback); static void signUpOrLoginByMobilePhoneInBackground(
String mobilePhoneNumber, String smsCode, Class<T> clazz, LogInCallback<T> callback); static T newAVUser(Class<T> clazz, LogInCallback<T> cb); static void logOut(); @Override void put(String key, Object value); @Override void remove(String key); static void requestPasswordReset(String email); static void requestPasswordResetInBackground(String email,
RequestPasswordResetCallback callback); void updatePassword(String oldPassword, String newPassword); void updatePasswordInBackground(String oldPassword, String newPassword,
UpdatePasswordCallback callback); static void requestPasswordResetBySmsCode(String phoneNumber); static void requestPasswordResetBySmsCode(String phoneNumber, String validateToken); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void resetPasswordBySmsCode(String smsCode, String newPassword); static void resetPasswordBySmsCodeInBackground(String smsCode, String newPassword,
UpdatePasswordCallback callback); static void requestEmailVerify(String email); static void requestEmailVerifyInBackground(String email,
RequestEmailVerifyCallback callback); static void requestMobilePhoneVerify(String phoneNumber); static void requestMobilePhoneVerify(String phoneNumber, String validateToken); static void requestMobilePhoneVerifyInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestMobilePhoneVerifyInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void requestLoginSmsCode(String phoneNumber); static void requestLoginSmsCode(String phoneNumber, String validateToken); static void requestLoginSmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestLoginSmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void verifyMobilePhone(String verifyCode); static void verifyMobilePhoneInBackground(String verifyCode,
AVMobilePhoneVerifyCallback callback); void setEmail(String email); void setPassword(String password); void setUsername(String username); String getMobilePhoneNumber(); void setMobilePhoneNumber(String mobilePhoneNumber); boolean isMobilePhoneVerified(); @JSONField(serialize = false) List<AVRole> getRoles(); void getRolesInBackground(final AVCallback<List<AVRole>> callback); void signUp(); void signUpInBackground(SignUpCallback callback); String getSinaWeiboToken(); String getQQWeiboToken(); void followInBackground(String userObjectId, final FollowCallback callback); void followInBackground(String userObjectId, Map<String, Object> attributes,
final FollowCallback callback); void unfollowInBackground(String userObjectId, final FollowCallback callback); static AVQuery<T> followerQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followerQuery(Class<T> clazz); static AVQuery<T> followeeQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followeeQuery(Class<T> clazz); AVFriendshipQuery friendshipQuery(); AVFriendshipQuery friendshipQuery(Class<T> clazz); static AVFriendshipQuery friendshipQuery(String userId); static AVFriendshipQuery friendshipQuery(String userId,
Class<T> clazz); @Deprecated void getFollowersInBackground(final FindCallback callback); @Deprecated void getMyFolloweesInBackground(final FindCallback callback); void getFollowersAndFolloweesInBackground(final FollowersAndFolloweesCallback callback); static T cast(AVUser user, Class<T> clazz); static void alwaysUseSubUserClass(Class<? extends AVUser> clazz); @Deprecated static void loginWithAuthData(AVThirdPartyUserAuth userInfo,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform, final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<T> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData,
final String platform, final LogInCallback<T> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform,
final boolean asMainAccount, final boolean failOnNotExist,
final LogInCallback<AVUser> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final boolean failOnNotExist, final LogInCallback<AVUser> callback); @Deprecated static void loginWithAuthData(final Class<T> clazz,
final AVThirdPartyUserAuth userInfo, final LogInCallback<T> callback); @Deprecated static void associateWithAuthData(AVUser user, AVThirdPartyUserAuth userInfo,
final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, String unionId, String unionIdPlatform,
boolean asMainAccount, final SaveCallback callback); void dissociateAuthData(final String platform, final SaveCallback callback); @Deprecated static void dissociateAuthData(final AVUser user, final String platform,
final SaveCallback callback); static final String LOG_TAG; static final String FOLLOWER_TAG; static final String FOLLOWEE_TAG; static final String SESSION_TOKEN_KEY; static final String SMS_VALIDATE_TOKEN; static final String SMS_PHONE_NUMBER; static final String AVUSER_ENDPOINT; static final String AVUSER_ENDPOINT_FAILON; static final String SNS_TENCENT_WEIBO; static final String SNS_SINA_WEIBO; static final String SNS_TENCENT_WEIXIN; static transient final Creator CREATOR; } |
@Test public void testLogin_wrongPwd() { AVException exception = null; try { AVUser.logIn("fsdfsdffsdffsdfsdf", ""); } catch (AVException e) { exception = e; } Assert.assertNotNull(exception); Assert.assertEquals(exception.getCode(), 211); } | public static AVUser logIn(String username, String password) throws AVException { return logIn(username, password, AVUser.class); } | AVUser extends AVObject { public static AVUser logIn(String username, String password) throws AVException { return logIn(username, password, AVUser.class); } } | AVUser extends AVObject { public static AVUser logIn(String username, String password) throws AVException { return logIn(username, password, AVUser.class); } AVUser(); AVUser(Parcel in); } | AVUser extends AVObject { public static AVUser logIn(String username, String password) throws AVException { return logIn(username, password, AVUser.class); } AVUser(); AVUser(Parcel in); String getFacebookToken(); String getTwitterToken(); String getQqWeiboToken(); static void enableAutomaticUser(); static boolean isEnableAutomatic(); static void disableAutomaticUser(); static synchronized void changeCurrentUser(AVUser newUser, boolean save); static AVUser getCurrentUser(); @SuppressWarnings("unchecked") static T getCurrentUser(Class<T> userClass); String getEmail(); static AVQuery<T> getUserQuery(Class<T> clazz); static AVQuery<AVUser> getQuery(); String getSessionToken(); String getUsername(); boolean isAuthenticated(); void isAuthenticated(final AVCallback<Boolean> callback); boolean isAnonymous(); boolean isNew(); static AVUser logIn(String username, String password); static T logIn(String username, String password, Class<T> clazz); static void logInAnonymously(final LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<T> callback, Class<T> clazz); static void loginByEmailInBackground(String email, String password, final LogInCallback<AVUser> callback); static void loginByEmailInBackground(String email, String password, final LogInCallback<T> callback, Class<T> clazz); static AVUser loginByMobilePhoneNumber(String phone, String password); static T loginByMobilePhoneNumber(String phone, String password,
Class<T> clazz); static void loginByMobilePhoneNumberInBackground(String phone, String password,
LogInCallback<AVUser> callback); static void loginByMobilePhoneNumberInBackground(String phone,
String password, LogInCallback<T> callback, Class<T> clazz); static AVUser loginBySMSCode(String phone, String smsCode); static T loginBySMSCode(String phone, String smsCode, Class<T> clazz); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<AVUser> callback); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<T> callback, Class<T> clazz); T refreshSessionToken(); void refreshSessionTokenInBackground(LogInCallback<T> callback); static AVUser becomeWithSessionToken(String sessionToken); static AVUser becomeWithSessionToken(String sessionToken, Class<T> clazz); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<AVUser> callback); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<T> callback, Class<T> clazz); static AVUser signUpOrLoginByMobilePhone(String mobilePhoneNumber, String smsCode); static T signUpOrLoginByMobilePhone(String mobilePhoneNumber,
String smsCode, Class<T> clazz); static void signUpOrLoginByMobilePhoneInBackground(String mobilePhoneNumber,
String smsCode, LogInCallback<AVUser> callback); static void signUpOrLoginByMobilePhoneInBackground(
String mobilePhoneNumber, String smsCode, Class<T> clazz, LogInCallback<T> callback); static T newAVUser(Class<T> clazz, LogInCallback<T> cb); static void logOut(); @Override void put(String key, Object value); @Override void remove(String key); static void requestPasswordReset(String email); static void requestPasswordResetInBackground(String email,
RequestPasswordResetCallback callback); void updatePassword(String oldPassword, String newPassword); void updatePasswordInBackground(String oldPassword, String newPassword,
UpdatePasswordCallback callback); static void requestPasswordResetBySmsCode(String phoneNumber); static void requestPasswordResetBySmsCode(String phoneNumber, String validateToken); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void resetPasswordBySmsCode(String smsCode, String newPassword); static void resetPasswordBySmsCodeInBackground(String smsCode, String newPassword,
UpdatePasswordCallback callback); static void requestEmailVerify(String email); static void requestEmailVerifyInBackground(String email,
RequestEmailVerifyCallback callback); static void requestMobilePhoneVerify(String phoneNumber); static void requestMobilePhoneVerify(String phoneNumber, String validateToken); static void requestMobilePhoneVerifyInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestMobilePhoneVerifyInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void requestLoginSmsCode(String phoneNumber); static void requestLoginSmsCode(String phoneNumber, String validateToken); static void requestLoginSmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestLoginSmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void verifyMobilePhone(String verifyCode); static void verifyMobilePhoneInBackground(String verifyCode,
AVMobilePhoneVerifyCallback callback); void setEmail(String email); void setPassword(String password); void setUsername(String username); String getMobilePhoneNumber(); void setMobilePhoneNumber(String mobilePhoneNumber); boolean isMobilePhoneVerified(); @JSONField(serialize = false) List<AVRole> getRoles(); void getRolesInBackground(final AVCallback<List<AVRole>> callback); void signUp(); void signUpInBackground(SignUpCallback callback); String getSinaWeiboToken(); String getQQWeiboToken(); void followInBackground(String userObjectId, final FollowCallback callback); void followInBackground(String userObjectId, Map<String, Object> attributes,
final FollowCallback callback); void unfollowInBackground(String userObjectId, final FollowCallback callback); static AVQuery<T> followerQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followerQuery(Class<T> clazz); static AVQuery<T> followeeQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followeeQuery(Class<T> clazz); AVFriendshipQuery friendshipQuery(); AVFriendshipQuery friendshipQuery(Class<T> clazz); static AVFriendshipQuery friendshipQuery(String userId); static AVFriendshipQuery friendshipQuery(String userId,
Class<T> clazz); @Deprecated void getFollowersInBackground(final FindCallback callback); @Deprecated void getMyFolloweesInBackground(final FindCallback callback); void getFollowersAndFolloweesInBackground(final FollowersAndFolloweesCallback callback); static T cast(AVUser user, Class<T> clazz); static void alwaysUseSubUserClass(Class<? extends AVUser> clazz); @Deprecated static void loginWithAuthData(AVThirdPartyUserAuth userInfo,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform, final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<T> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData,
final String platform, final LogInCallback<T> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform,
final boolean asMainAccount, final boolean failOnNotExist,
final LogInCallback<AVUser> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final boolean failOnNotExist, final LogInCallback<AVUser> callback); @Deprecated static void loginWithAuthData(final Class<T> clazz,
final AVThirdPartyUserAuth userInfo, final LogInCallback<T> callback); @Deprecated static void associateWithAuthData(AVUser user, AVThirdPartyUserAuth userInfo,
final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, String unionId, String unionIdPlatform,
boolean asMainAccount, final SaveCallback callback); void dissociateAuthData(final String platform, final SaveCallback callback); @Deprecated static void dissociateAuthData(final AVUser user, final String platform,
final SaveCallback callback); } | AVUser extends AVObject { public static AVUser logIn(String username, String password) throws AVException { return logIn(username, password, AVUser.class); } AVUser(); AVUser(Parcel in); String getFacebookToken(); String getTwitterToken(); String getQqWeiboToken(); static void enableAutomaticUser(); static boolean isEnableAutomatic(); static void disableAutomaticUser(); static synchronized void changeCurrentUser(AVUser newUser, boolean save); static AVUser getCurrentUser(); @SuppressWarnings("unchecked") static T getCurrentUser(Class<T> userClass); String getEmail(); static AVQuery<T> getUserQuery(Class<T> clazz); static AVQuery<AVUser> getQuery(); String getSessionToken(); String getUsername(); boolean isAuthenticated(); void isAuthenticated(final AVCallback<Boolean> callback); boolean isAnonymous(); boolean isNew(); static AVUser logIn(String username, String password); static T logIn(String username, String password, Class<T> clazz); static void logInAnonymously(final LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<T> callback, Class<T> clazz); static void loginByEmailInBackground(String email, String password, final LogInCallback<AVUser> callback); static void loginByEmailInBackground(String email, String password, final LogInCallback<T> callback, Class<T> clazz); static AVUser loginByMobilePhoneNumber(String phone, String password); static T loginByMobilePhoneNumber(String phone, String password,
Class<T> clazz); static void loginByMobilePhoneNumberInBackground(String phone, String password,
LogInCallback<AVUser> callback); static void loginByMobilePhoneNumberInBackground(String phone,
String password, LogInCallback<T> callback, Class<T> clazz); static AVUser loginBySMSCode(String phone, String smsCode); static T loginBySMSCode(String phone, String smsCode, Class<T> clazz); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<AVUser> callback); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<T> callback, Class<T> clazz); T refreshSessionToken(); void refreshSessionTokenInBackground(LogInCallback<T> callback); static AVUser becomeWithSessionToken(String sessionToken); static AVUser becomeWithSessionToken(String sessionToken, Class<T> clazz); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<AVUser> callback); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<T> callback, Class<T> clazz); static AVUser signUpOrLoginByMobilePhone(String mobilePhoneNumber, String smsCode); static T signUpOrLoginByMobilePhone(String mobilePhoneNumber,
String smsCode, Class<T> clazz); static void signUpOrLoginByMobilePhoneInBackground(String mobilePhoneNumber,
String smsCode, LogInCallback<AVUser> callback); static void signUpOrLoginByMobilePhoneInBackground(
String mobilePhoneNumber, String smsCode, Class<T> clazz, LogInCallback<T> callback); static T newAVUser(Class<T> clazz, LogInCallback<T> cb); static void logOut(); @Override void put(String key, Object value); @Override void remove(String key); static void requestPasswordReset(String email); static void requestPasswordResetInBackground(String email,
RequestPasswordResetCallback callback); void updatePassword(String oldPassword, String newPassword); void updatePasswordInBackground(String oldPassword, String newPassword,
UpdatePasswordCallback callback); static void requestPasswordResetBySmsCode(String phoneNumber); static void requestPasswordResetBySmsCode(String phoneNumber, String validateToken); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void resetPasswordBySmsCode(String smsCode, String newPassword); static void resetPasswordBySmsCodeInBackground(String smsCode, String newPassword,
UpdatePasswordCallback callback); static void requestEmailVerify(String email); static void requestEmailVerifyInBackground(String email,
RequestEmailVerifyCallback callback); static void requestMobilePhoneVerify(String phoneNumber); static void requestMobilePhoneVerify(String phoneNumber, String validateToken); static void requestMobilePhoneVerifyInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestMobilePhoneVerifyInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void requestLoginSmsCode(String phoneNumber); static void requestLoginSmsCode(String phoneNumber, String validateToken); static void requestLoginSmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestLoginSmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void verifyMobilePhone(String verifyCode); static void verifyMobilePhoneInBackground(String verifyCode,
AVMobilePhoneVerifyCallback callback); void setEmail(String email); void setPassword(String password); void setUsername(String username); String getMobilePhoneNumber(); void setMobilePhoneNumber(String mobilePhoneNumber); boolean isMobilePhoneVerified(); @JSONField(serialize = false) List<AVRole> getRoles(); void getRolesInBackground(final AVCallback<List<AVRole>> callback); void signUp(); void signUpInBackground(SignUpCallback callback); String getSinaWeiboToken(); String getQQWeiboToken(); void followInBackground(String userObjectId, final FollowCallback callback); void followInBackground(String userObjectId, Map<String, Object> attributes,
final FollowCallback callback); void unfollowInBackground(String userObjectId, final FollowCallback callback); static AVQuery<T> followerQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followerQuery(Class<T> clazz); static AVQuery<T> followeeQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followeeQuery(Class<T> clazz); AVFriendshipQuery friendshipQuery(); AVFriendshipQuery friendshipQuery(Class<T> clazz); static AVFriendshipQuery friendshipQuery(String userId); static AVFriendshipQuery friendshipQuery(String userId,
Class<T> clazz); @Deprecated void getFollowersInBackground(final FindCallback callback); @Deprecated void getMyFolloweesInBackground(final FindCallback callback); void getFollowersAndFolloweesInBackground(final FollowersAndFolloweesCallback callback); static T cast(AVUser user, Class<T> clazz); static void alwaysUseSubUserClass(Class<? extends AVUser> clazz); @Deprecated static void loginWithAuthData(AVThirdPartyUserAuth userInfo,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform, final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<T> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData,
final String platform, final LogInCallback<T> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform,
final boolean asMainAccount, final boolean failOnNotExist,
final LogInCallback<AVUser> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final boolean failOnNotExist, final LogInCallback<AVUser> callback); @Deprecated static void loginWithAuthData(final Class<T> clazz,
final AVThirdPartyUserAuth userInfo, final LogInCallback<T> callback); @Deprecated static void associateWithAuthData(AVUser user, AVThirdPartyUserAuth userInfo,
final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, String unionId, String unionIdPlatform,
boolean asMainAccount, final SaveCallback callback); void dissociateAuthData(final String platform, final SaveCallback callback); @Deprecated static void dissociateAuthData(final AVUser user, final String platform,
final SaveCallback callback); static final String LOG_TAG; static final String FOLLOWER_TAG; static final String FOLLOWEE_TAG; static final String SESSION_TOKEN_KEY; static final String SMS_VALIDATE_TOKEN; static final String SMS_PHONE_NUMBER; static final String AVUSER_ENDPOINT; static final String AVUSER_ENDPOINT_FAILON; static final String SNS_TENCENT_WEIBO; static final String SNS_SINA_WEIBO; static final String SNS_TENCENT_WEIXIN; static transient final Creator CREATOR; } |
@Test public void testSignUp() throws AVException { AVUser user = new AVUser(); user.setUsername(UUID.randomUUID().toString()); user.setPassword("test"); user.signUp(); } | private void signUp(boolean sync, final SignUpCallback callback) { if (sync) { try { this.save(); if (callback != null) callback.internalDone(null); } catch (AVException e) { if (callback != null) callback.internalDone(e); } } else { this.saveInBackground(new SaveCallback() { @Override public void done(AVException e) { if (callback != null) callback.internalDone(e); } }); } } | AVUser extends AVObject { private void signUp(boolean sync, final SignUpCallback callback) { if (sync) { try { this.save(); if (callback != null) callback.internalDone(null); } catch (AVException e) { if (callback != null) callback.internalDone(e); } } else { this.saveInBackground(new SaveCallback() { @Override public void done(AVException e) { if (callback != null) callback.internalDone(e); } }); } } } | AVUser extends AVObject { private void signUp(boolean sync, final SignUpCallback callback) { if (sync) { try { this.save(); if (callback != null) callback.internalDone(null); } catch (AVException e) { if (callback != null) callback.internalDone(e); } } else { this.saveInBackground(new SaveCallback() { @Override public void done(AVException e) { if (callback != null) callback.internalDone(e); } }); } } AVUser(); AVUser(Parcel in); } | AVUser extends AVObject { private void signUp(boolean sync, final SignUpCallback callback) { if (sync) { try { this.save(); if (callback != null) callback.internalDone(null); } catch (AVException e) { if (callback != null) callback.internalDone(e); } } else { this.saveInBackground(new SaveCallback() { @Override public void done(AVException e) { if (callback != null) callback.internalDone(e); } }); } } AVUser(); AVUser(Parcel in); String getFacebookToken(); String getTwitterToken(); String getQqWeiboToken(); static void enableAutomaticUser(); static boolean isEnableAutomatic(); static void disableAutomaticUser(); static synchronized void changeCurrentUser(AVUser newUser, boolean save); static AVUser getCurrentUser(); @SuppressWarnings("unchecked") static T getCurrentUser(Class<T> userClass); String getEmail(); static AVQuery<T> getUserQuery(Class<T> clazz); static AVQuery<AVUser> getQuery(); String getSessionToken(); String getUsername(); boolean isAuthenticated(); void isAuthenticated(final AVCallback<Boolean> callback); boolean isAnonymous(); boolean isNew(); static AVUser logIn(String username, String password); static T logIn(String username, String password, Class<T> clazz); static void logInAnonymously(final LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<T> callback, Class<T> clazz); static void loginByEmailInBackground(String email, String password, final LogInCallback<AVUser> callback); static void loginByEmailInBackground(String email, String password, final LogInCallback<T> callback, Class<T> clazz); static AVUser loginByMobilePhoneNumber(String phone, String password); static T loginByMobilePhoneNumber(String phone, String password,
Class<T> clazz); static void loginByMobilePhoneNumberInBackground(String phone, String password,
LogInCallback<AVUser> callback); static void loginByMobilePhoneNumberInBackground(String phone,
String password, LogInCallback<T> callback, Class<T> clazz); static AVUser loginBySMSCode(String phone, String smsCode); static T loginBySMSCode(String phone, String smsCode, Class<T> clazz); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<AVUser> callback); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<T> callback, Class<T> clazz); T refreshSessionToken(); void refreshSessionTokenInBackground(LogInCallback<T> callback); static AVUser becomeWithSessionToken(String sessionToken); static AVUser becomeWithSessionToken(String sessionToken, Class<T> clazz); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<AVUser> callback); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<T> callback, Class<T> clazz); static AVUser signUpOrLoginByMobilePhone(String mobilePhoneNumber, String smsCode); static T signUpOrLoginByMobilePhone(String mobilePhoneNumber,
String smsCode, Class<T> clazz); static void signUpOrLoginByMobilePhoneInBackground(String mobilePhoneNumber,
String smsCode, LogInCallback<AVUser> callback); static void signUpOrLoginByMobilePhoneInBackground(
String mobilePhoneNumber, String smsCode, Class<T> clazz, LogInCallback<T> callback); static T newAVUser(Class<T> clazz, LogInCallback<T> cb); static void logOut(); @Override void put(String key, Object value); @Override void remove(String key); static void requestPasswordReset(String email); static void requestPasswordResetInBackground(String email,
RequestPasswordResetCallback callback); void updatePassword(String oldPassword, String newPassword); void updatePasswordInBackground(String oldPassword, String newPassword,
UpdatePasswordCallback callback); static void requestPasswordResetBySmsCode(String phoneNumber); static void requestPasswordResetBySmsCode(String phoneNumber, String validateToken); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void resetPasswordBySmsCode(String smsCode, String newPassword); static void resetPasswordBySmsCodeInBackground(String smsCode, String newPassword,
UpdatePasswordCallback callback); static void requestEmailVerify(String email); static void requestEmailVerifyInBackground(String email,
RequestEmailVerifyCallback callback); static void requestMobilePhoneVerify(String phoneNumber); static void requestMobilePhoneVerify(String phoneNumber, String validateToken); static void requestMobilePhoneVerifyInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestMobilePhoneVerifyInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void requestLoginSmsCode(String phoneNumber); static void requestLoginSmsCode(String phoneNumber, String validateToken); static void requestLoginSmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestLoginSmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void verifyMobilePhone(String verifyCode); static void verifyMobilePhoneInBackground(String verifyCode,
AVMobilePhoneVerifyCallback callback); void setEmail(String email); void setPassword(String password); void setUsername(String username); String getMobilePhoneNumber(); void setMobilePhoneNumber(String mobilePhoneNumber); boolean isMobilePhoneVerified(); @JSONField(serialize = false) List<AVRole> getRoles(); void getRolesInBackground(final AVCallback<List<AVRole>> callback); void signUp(); void signUpInBackground(SignUpCallback callback); String getSinaWeiboToken(); String getQQWeiboToken(); void followInBackground(String userObjectId, final FollowCallback callback); void followInBackground(String userObjectId, Map<String, Object> attributes,
final FollowCallback callback); void unfollowInBackground(String userObjectId, final FollowCallback callback); static AVQuery<T> followerQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followerQuery(Class<T> clazz); static AVQuery<T> followeeQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followeeQuery(Class<T> clazz); AVFriendshipQuery friendshipQuery(); AVFriendshipQuery friendshipQuery(Class<T> clazz); static AVFriendshipQuery friendshipQuery(String userId); static AVFriendshipQuery friendshipQuery(String userId,
Class<T> clazz); @Deprecated void getFollowersInBackground(final FindCallback callback); @Deprecated void getMyFolloweesInBackground(final FindCallback callback); void getFollowersAndFolloweesInBackground(final FollowersAndFolloweesCallback callback); static T cast(AVUser user, Class<T> clazz); static void alwaysUseSubUserClass(Class<? extends AVUser> clazz); @Deprecated static void loginWithAuthData(AVThirdPartyUserAuth userInfo,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform, final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<T> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData,
final String platform, final LogInCallback<T> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform,
final boolean asMainAccount, final boolean failOnNotExist,
final LogInCallback<AVUser> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final boolean failOnNotExist, final LogInCallback<AVUser> callback); @Deprecated static void loginWithAuthData(final Class<T> clazz,
final AVThirdPartyUserAuth userInfo, final LogInCallback<T> callback); @Deprecated static void associateWithAuthData(AVUser user, AVThirdPartyUserAuth userInfo,
final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, String unionId, String unionIdPlatform,
boolean asMainAccount, final SaveCallback callback); void dissociateAuthData(final String platform, final SaveCallback callback); @Deprecated static void dissociateAuthData(final AVUser user, final String platform,
final SaveCallback callback); } | AVUser extends AVObject { private void signUp(boolean sync, final SignUpCallback callback) { if (sync) { try { this.save(); if (callback != null) callback.internalDone(null); } catch (AVException e) { if (callback != null) callback.internalDone(e); } } else { this.saveInBackground(new SaveCallback() { @Override public void done(AVException e) { if (callback != null) callback.internalDone(e); } }); } } AVUser(); AVUser(Parcel in); String getFacebookToken(); String getTwitterToken(); String getQqWeiboToken(); static void enableAutomaticUser(); static boolean isEnableAutomatic(); static void disableAutomaticUser(); static synchronized void changeCurrentUser(AVUser newUser, boolean save); static AVUser getCurrentUser(); @SuppressWarnings("unchecked") static T getCurrentUser(Class<T> userClass); String getEmail(); static AVQuery<T> getUserQuery(Class<T> clazz); static AVQuery<AVUser> getQuery(); String getSessionToken(); String getUsername(); boolean isAuthenticated(); void isAuthenticated(final AVCallback<Boolean> callback); boolean isAnonymous(); boolean isNew(); static AVUser logIn(String username, String password); static T logIn(String username, String password, Class<T> clazz); static void logInAnonymously(final LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<AVUser> callback); static void logInInBackground(String username, String password,
LogInCallback<T> callback, Class<T> clazz); static void loginByEmailInBackground(String email, String password, final LogInCallback<AVUser> callback); static void loginByEmailInBackground(String email, String password, final LogInCallback<T> callback, Class<T> clazz); static AVUser loginByMobilePhoneNumber(String phone, String password); static T loginByMobilePhoneNumber(String phone, String password,
Class<T> clazz); static void loginByMobilePhoneNumberInBackground(String phone, String password,
LogInCallback<AVUser> callback); static void loginByMobilePhoneNumberInBackground(String phone,
String password, LogInCallback<T> callback, Class<T> clazz); static AVUser loginBySMSCode(String phone, String smsCode); static T loginBySMSCode(String phone, String smsCode, Class<T> clazz); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<AVUser> callback); static void loginBySMSCodeInBackground(String phone, String smsCode,
LogInCallback<T> callback, Class<T> clazz); T refreshSessionToken(); void refreshSessionTokenInBackground(LogInCallback<T> callback); static AVUser becomeWithSessionToken(String sessionToken); static AVUser becomeWithSessionToken(String sessionToken, Class<T> clazz); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<AVUser> callback); static void becomeWithSessionTokenInBackground(String sessionToken,
LogInCallback<T> callback, Class<T> clazz); static AVUser signUpOrLoginByMobilePhone(String mobilePhoneNumber, String smsCode); static T signUpOrLoginByMobilePhone(String mobilePhoneNumber,
String smsCode, Class<T> clazz); static void signUpOrLoginByMobilePhoneInBackground(String mobilePhoneNumber,
String smsCode, LogInCallback<AVUser> callback); static void signUpOrLoginByMobilePhoneInBackground(
String mobilePhoneNumber, String smsCode, Class<T> clazz, LogInCallback<T> callback); static T newAVUser(Class<T> clazz, LogInCallback<T> cb); static void logOut(); @Override void put(String key, Object value); @Override void remove(String key); static void requestPasswordReset(String email); static void requestPasswordResetInBackground(String email,
RequestPasswordResetCallback callback); void updatePassword(String oldPassword, String newPassword); void updatePasswordInBackground(String oldPassword, String newPassword,
UpdatePasswordCallback callback); static void requestPasswordResetBySmsCode(String phoneNumber); static void requestPasswordResetBySmsCode(String phoneNumber, String validateToken); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestPasswordResetBySmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void resetPasswordBySmsCode(String smsCode, String newPassword); static void resetPasswordBySmsCodeInBackground(String smsCode, String newPassword,
UpdatePasswordCallback callback); static void requestEmailVerify(String email); static void requestEmailVerifyInBackground(String email,
RequestEmailVerifyCallback callback); static void requestMobilePhoneVerify(String phoneNumber); static void requestMobilePhoneVerify(String phoneNumber, String validateToken); static void requestMobilePhoneVerifyInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestMobilePhoneVerifyInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void requestLoginSmsCode(String phoneNumber); static void requestLoginSmsCode(String phoneNumber, String validateToken); static void requestLoginSmsCodeInBackground(String phoneNumber,
RequestMobileCodeCallback callback); static void requestLoginSmsCodeInBackground(String phoneNumber, String validateToken,
RequestMobileCodeCallback callback); static void verifyMobilePhone(String verifyCode); static void verifyMobilePhoneInBackground(String verifyCode,
AVMobilePhoneVerifyCallback callback); void setEmail(String email); void setPassword(String password); void setUsername(String username); String getMobilePhoneNumber(); void setMobilePhoneNumber(String mobilePhoneNumber); boolean isMobilePhoneVerified(); @JSONField(serialize = false) List<AVRole> getRoles(); void getRolesInBackground(final AVCallback<List<AVRole>> callback); void signUp(); void signUpInBackground(SignUpCallback callback); String getSinaWeiboToken(); String getQQWeiboToken(); void followInBackground(String userObjectId, final FollowCallback callback); void followInBackground(String userObjectId, Map<String, Object> attributes,
final FollowCallback callback); void unfollowInBackground(String userObjectId, final FollowCallback callback); static AVQuery<T> followerQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followerQuery(Class<T> clazz); static AVQuery<T> followeeQuery(final String userObjectId,
Class<T> clazz); AVQuery<T> followeeQuery(Class<T> clazz); AVFriendshipQuery friendshipQuery(); AVFriendshipQuery friendshipQuery(Class<T> clazz); static AVFriendshipQuery friendshipQuery(String userId); static AVFriendshipQuery friendshipQuery(String userId,
Class<T> clazz); @Deprecated void getFollowersInBackground(final FindCallback callback); @Deprecated void getMyFolloweesInBackground(final FindCallback callback); void getFollowersAndFolloweesInBackground(final FollowersAndFolloweesCallback callback); static T cast(AVUser user, Class<T> clazz); static void alwaysUseSubUserClass(Class<? extends AVUser> clazz); @Deprecated static void loginWithAuthData(AVThirdPartyUserAuth userInfo,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform, final LogInCallback<AVUser> callback); static void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<AVUser> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform, final boolean asMainAccount,
final LogInCallback<T> callback); static void loginWithAuthData(final Class<T> clazz, final Map<String, Object> authData,
final String platform, final LogInCallback<T> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final String unionId, final String unionIdPlatform,
final boolean asMainAccount, final boolean failOnNotExist,
final LogInCallback<AVUser> callback); void loginWithAuthData(final Map<String, Object> authData, final String platform,
final boolean failOnNotExist, final LogInCallback<AVUser> callback); @Deprecated static void loginWithAuthData(final Class<T> clazz,
final AVThirdPartyUserAuth userInfo, final LogInCallback<T> callback); @Deprecated static void associateWithAuthData(AVUser user, AVThirdPartyUserAuth userInfo,
final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, final SaveCallback callback); void associateWithAuthData(Map<String, Object> authData, String platform, String unionId, String unionIdPlatform,
boolean asMainAccount, final SaveCallback callback); void dissociateAuthData(final String platform, final SaveCallback callback); @Deprecated static void dissociateAuthData(final AVUser user, final String platform,
final SaveCallback callback); static final String LOG_TAG; static final String FOLLOWER_TAG; static final String FOLLOWEE_TAG; static final String SESSION_TOKEN_KEY; static final String SMS_VALIDATE_TOKEN; static final String SMS_PHONE_NUMBER; static final String AVUSER_ENDPOINT; static final String AVUSER_ENDPOINT_FAILON; static final String SNS_TENCENT_WEIBO; static final String SNS_SINA_WEIBO; static final String SNS_TENCENT_WEIXIN; static transient final Creator CREATOR; } |
@Test public void testToJSONObject() throws Exception { String fileName = "FileUnitTestFiles"; AVFile avFile = new AVFile(fileName, TEST_FILE_CONTENT.getBytes()); JSONObject jsonObject = avFile.toJSONObject(); Assert.assertNotNull(jsonObject); Assert.assertEquals(jsonObject.getString("__type"), AVFile.className()); Assert.assertFalse(jsonObject.has("url")); Assert.assertEquals(jsonObject.getString("id"), fileName); } | protected org.json.JSONObject toJSONObject() { Map<String, Object> data = AVUtils.mapFromFile(this); if (!AVUtils.isBlankString(url)) { data.put("url", url); } return new JSONObject(data); } | AVFile { protected org.json.JSONObject toJSONObject() { Map<String, Object> data = AVUtils.mapFromFile(this); if (!AVUtils.isBlankString(url)) { data.put("url", url); } return new JSONObject(data); } } | AVFile { protected org.json.JSONObject toJSONObject() { Map<String, Object> data = AVUtils.mapFromFile(this); if (!AVUtils.isBlankString(url)) { data.put("url", url); } return new JSONObject(data); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); } | AVFile { protected org.json.JSONObject toJSONObject() { Map<String, Object> data = AVUtils.mapFromFile(this); if (!AVUtils.isBlankString(url)) { data.put("url", url); } return new JSONObject(data); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); } | AVFile { protected org.json.JSONObject toJSONObject() { Map<String, Object> data = AVUtils.mapFromFile(this); if (!AVUtils.isBlankString(url)) { data.put("url", url); } return new JSONObject(data); } AVFile(); @Deprecated AVFile(byte[] data); AVFile(String name, String url, Map<String, Object> metaData); protected AVFile(String name, String url, Map<String, Object> metaData, boolean external); AVFile(String name, byte[] data); protected AVFile(String name, String url); static void setUploadHeader(String key, String value); String getObjectId(); void setObjectId(String objectId); @Deprecated static void parseFileWithObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); static void withObjectIdInBackground(final String objectId,
final GetFileCallback<AVFile> cb); @Deprecated static AVFile parseFileWithObjectId(String objectId); static AVFile withObjectId(String objectId); @Deprecated static AVFile parseFileWithAVObject(AVObject obj); static AVFile withAVObject(AVObject obj); @Deprecated static AVFile parseFileWithAbsoluteLocalPath(String name, String absoluteLocalFilePath); static AVFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath); @Deprecated static AVFile parseFileWithFile(String name, File file); static AVFile withFile(String name, File file); HashMap<String, Object> getMetaData(); Object addMetaData(String key, Object val); Object getMetaData(String key); int getSize(); String getOwnerObjectId(); Object removeMetaData(String key); void clearMetaData(); String getName(); String getOriginalName(); void setName(String name); static String getMimeType(String url); boolean isDirty(); @Deprecated boolean isDataAvailable(); String getUrl(); String getThumbnailUrl(boolean scaleToFit, int width, int height); String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt); void setUrl(String url); void save(); synchronized void saveInBackground(final SaveCallback saveCallback,
final ProgressCallback progressCallback); void saveInBackground(SaveCallback callback); void saveInBackground(); @Deprecated @JSONField(serialize = false) byte[] getData(); @JSONField(serialize = false) InputStream getDataStream(); void getDataInBackground(final GetDataCallback dataCallback,
final ProgressCallback progressCallback); void getDataInBackground(GetDataCallback dataCallback); void getDataStreamInBackground(GetDataStreamCallback callback); void getDataStreamInBackground(final GetDataStreamCallback callback, final ProgressCallback progressCallback); void cancel(); void delete(); void deleteEventually(); void deleteEventually(DeleteCallback callback); void deleteInBackground(); void deleteInBackground(DeleteCallback callback); static String className(); Uploader getUploader(SaveCallback saveCallback, ProgressCallback progressCallback); String getBucket(); void setBucket(String bucket); AVACL getACL(); void setACL(AVACL acl); void clearCachedFile(); static void clearAllCachedFiles(); static void clearCacheMoreThanDays(int days); static String DEFAULTMIMETYPE; static final String AVFILE_ENDPOINT; } |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.