Spring Framework ExtendedModelMap - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework ExtendedModelMap class.

This code example shows how to use the following methods:get
    	} 
    } 
     
    @Test
    public void settingsPage() { 
    	ExtendedModelMap model = new ExtendedModelMap();
    	controller.settingsPage(testAccount(), model);
    	@SuppressWarnings("unchecked") 
		List<Map<String, Object>> apps = (List<Map<String, Object>>) model.get("apps");
    	assertNotNull(apps);   
    	assertEquals(1, apps.size());
    	assertEquals("Greenhouse for the iPhone", apps.get(0).get("name"));
    	assertEquals("authme", apps.get(0).get("accessToken"));
    } 
     
    @Test
    public void disconnectApp() { 
    	assertEquals("redirect:/settings", controller.disconnectApp("authme", testAccount()));
    	assertEquals(0, tokenStore.findTokensByUserName("kdonald").size());
    } 
7
CodeRank
This code example shows how to use the following methods:get
    private TreeController treeController = new TreeController();
 
    @Test
    @Ignore 
    public void testItems() throws Exception {
        ExtendedModelMap model = new ExtendedModelMap();
        treeController.apps(model, new UsernamePasswordAuthenticationToken("dave", "foo"));
        MapWrapper wrapper = new MapWrapper(model.get("items"));
        System.err.println(wrapper);
        assertEquals("spring", wrapper.get("[0].staging.model"));
    } 
 
} 
6
CodeRank
This code example shows how to use the following methods:containsKey, size
		when(jobService.countJobInstances("foo")).thenReturn(100);
		when(jobService.isLaunchable("foo")).thenReturn(true);
		when(jobService.isIncrementable("foo")).thenReturn(true);
		when(jobService.getLastJobParameters("foo")).thenReturn(new JobParameters());
 
		ExtendedModelMap model = new ExtendedModelMap();
		controller.launch(model, "foo", request, new BindException(request, "request"), "job");
		assertEquals("foo", request.getJobName());
		// Job, JobInstances, jobParameters, JobExecution, total, next, start, 
		// end 
		assertEquals(8, model.size());
 
		assertTrue(model.containsKey("jobExecutionInfo"));
		assertTrue(model.containsKey("jobInfo"));
	} 
 
	@Test
	public void testListSunnyDay() throws Exception {
 
		when(jobService.listJobs(10, 20)).thenReturn(Arrays.asList("job"));
6
CodeRank
This code example shows how to use the following methods:containsKey, get, size
		when(jobService.getStepExecution(123L, 1234L)).thenReturn(MetaDataInstanceFactory.createStepExecution("step:partition1", 0L));
		when(jobService.countStepExecutionsForStep("job", "step:partition*")).thenReturn(1200);
		when(jobService.listStepExecutionsForStep("job", "step:partition*", 0, 1000)).thenReturn(Arrays.asList(MetaDataInstanceFactory.createStepExecution()));
		when(jobService.listStepExecutionsForStep("job", "step:partition*", 1000, 1000)).thenReturn(Arrays.asList(MetaDataInstanceFactory.createStepExecution()));
 
		ExtendedModelMap model = new ExtendedModelMap();
		String result = controller.history(model, 123L, 1234L, null, null);
		// StepExecution, history and progress 
		assertEquals(3, model.size());
		assertEquals("jobs/executions/step/progress", result);
 
		assertTrue(model.containsKey("stepExecutionHistory"));
		StepExecutionHistory history = (StepExecutionHistory) model.get("stepExecutionHistory");
		// The wildcard is intentional: 
		assertEquals("step:partition*", history.getStepName());
	} 
 
	@Test
	public void testListForJobExecutionSunnyDay() throws Exception {
 
6
CodeRank
This code example shows how to use the following methods:putAll
 
	/** 
	 * Create a new model containing elements from the specified source. 
	 * @param source a map containing the initial model 
	 */ 
	public SpringFacesModel(Map<String, ?> source) {
		Assert.notNull(source, "Source must not be null");
		putAll(source);
	} 
} 
5
CodeRank
This code example shows how to use the following methods:
@Controller 
public class LoginController { 
 
	@RequestMapping(value = "/login", method = RequestMethod.GET)
	public Model login() {
		return new ExtendedModelMap().addAttribute(new ActivateAccountForm());
	} 
 
	@RequestMapping(value = "/login", method = RequestMethod.POST)
	public String processActivationForm(@Validated ActivateAccountForm form, BindingResult result) {
		if (result.hasErrors()) {
			return null; 
		} 
		return "redirect:http://www.springsource.org"; 
	} 
 
} 
5
CodeRank
This code example shows how to use the following methods:
	} 
 
	@Test
	public void testSaveSystemConfiguration() { 
		String oriContent = service.getOne();
		ExtendedModelMap model = new ExtendedModelMap();
		String content = "test=My test.";
		try { 
			controller.save(content, model);
			ThreadUtils.sleep(2500); //sleep a while to wait for the file monitor to update the system properties. 
			assertThat(service.getOne(), is(content));
			assertThat(config.getControllerProperties().getProperty("test", ""), is("My test."));
		} finally { 
			//reset system config 
			controller.save(oriContent, model);
		} 
	} 
} 
5
CodeRank
This code example shows how to use the following methods:get
		controller = new AccountsController(accountManager);
	} 
 
	@Test
	public void testList() throws Exception {
		ExtendedModelMap model = new ExtendedModelMap();
		String view = controller.list(testPrincipal, model);
		assertEquals("accounts/list", view);
		Customer customer = (Customer) model.get("customer");
 
		assertNotNull(customer);
		assertEquals(1, customer.getAccounts().size());
	} 
 
	@Test
	@DirtiesContext 
	public void testShow() throws Exception {
		ExtendedModelMap model = new ExtendedModelMap();
		String view = controller.show(StubAccountManager.TEST_ACCOUNT_NUMBER,
				testPrincipal, model);
5
CodeRank
This code example shows how to use the following methods:
 
	@RequestMapping("/validator/springbean") 
	public Model springBean() {
		// Any SpringBean that implements Validator is automatically available as a JSF validator with fully 
		// supported Spring dependency injection and AOP. Here SpringBeanConverter is used 
		return new ExtendedModelMap().addAttribute("holder", new ValidatorObjectHolder());
	} 
 
	@RequestMapping("/validator/genericspringbean") 
	public Model genericSpringBean() {
		// An alternative Validator interface with generics can also be used with spring beans 
		return new ExtendedModelMap().addAttribute("holder", new ValidatorObjectHolder());
	} 
 
	@RequestMapping("/validator/springbeanforclass") 
	public Model springBeanForClass() {
		// Spring Beans can use the @ForClass annotation to tie them to a specific class, 
		// In this example SpringBeanForClassValidator will be used as it is annotated with 
		// @ForClass and implements Validator<BigInteger> 
		return new ExtendedModelMap().addAttribute("holder", new ValidatorObjectHolder());
5
CodeRank
This code example shows how to use the following methods:
 
		if (contentType != null) { 
			response.setContentType(contentType); 
		} 
		 
		ExtendedModelMap model = new ExtendedModelMap(); 
		populateModel(model, request); 
		ModelAndView mv = new ModelAndView(viewName, model); 
		return mv; 
	} 
	 
	protected void populateModel(Model model, HttpServletRequest request) { 
	} 
		 
} 
5
CodeRank
See Code Examples for Spring Framework ExtendedModelMap Methods: