View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.juneau.examples.rest;
18  
19  import static org.apache.juneau.common.utils.Utils.*;
20  
21  import java.util.*;
22  
23  import org.apache.juneau.*;
24  import org.junit.runner.*;
25  import org.junit.runners.*;
26  
27  @RunWith(Parameterized.class)
28  public class RootContentTest extends ContentComboTestBase {
29  
30  	@Parameterized.Parameters
31  	public static Collection<Object[]> getParameters() {
32  		return alist(new Object[][] {
33  			{ 	/* 0 */
34  				new ComboInput("HTML-stylesheet", "/", MediaType.HTML,
35  					"@import '/htdocs/themes/dark.css';",
36  					".menu-item {"
37  				)
38  			},
39  			{ 	/* 1 */
40  				new ComboInput("HTML-stylesheet-contnt", "/htdocs/themes/devops.css", MediaType.PLAIN,
41  					"/** DevOps look-and-feel */"
42  				)
43  			},
44  			{ 	/* 2 */
45  				new ComboInput("HTML-header", "/", MediaType.HTML,
46  					"<head>",
47  					"<h1>Root resources</h1>",
48  					"<h2>Navigation page</h2>",
49  					"<img src='/htdocs/images/juneau.png' style='position:absolute;top:5;right:5;background-color:transparent;height:30px'/>"
50  				)
51  			},
52  			{ 	/* 3 */
53  				new ComboInput("HTML-nav", "/", MediaType.HTML,
54  					"<nav>",
55  					"<a href='/api'>api</a>",
56  					"<a onclick='menuClick(this);'>content-type</a>",
57  					"<a href='https://github.com/apache/juneau/blob/master/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/RootResources.java'>source</a>"
58  				)
59  			},
60  			{ 	/* 4 */
61  				new ComboInput("HTML-nav-popup-contentType", "/", MediaType.HTML,
62  					"<div class='popup-content'>",
63  					"/?plainText=true&Accept=application%2Fjson"
64  				)
65  			},
66  			{ 	/* 5 */
67  				new ComboInput("HTML-aside", "/", MediaType.HTML,
68  					"<aside>",
69  					"<p>This is an example of a 'router' page that serves as a jumping-off point to child resources.</p>",
70  					"<p>Other features (such as this aside) are added through annotations.</p>"
71  				)
72  			},
73  			{ 	/* 6 */
74  				new ComboInput("HTML-footer", "/", MediaType.HTML,
75  					"<footer>",
76  					"<img style='float:right;padding-right:20px;height:32px' src='/htdocs/images/asf.png'>"
77  				)
78  			},
79  			{ 	/* 7 */
80  				new ComboInput("HTML-content-text/html", "/", MediaType.HTML,
81  					"<a href='/helloWorld'>helloWorld</a>",
82  					"<td>Hello World</td>"
83  				)
84  			},
85  			{ 	/* 8 */
86  				new ComboInput("HTML-content-application/json", "/", MediaType.JSON,
87  					"'name':'helloWorld',",
88  					"'description':'Hello World'"
89  				)
90  			},
91  			{ 	/* 9 */
92  				new ComboInput("HTML-content-octal/msgpack", "/", MediaType.MSGPACK,
93  					"82 A4 6E"
94  				)
95  			},
96  			{ 	/* 10 */
97  				new ComboInput("HTML-content-text/plain", "/", MediaType.PLAIN,
98  					"Hello World"
99  				)
100 			},
101 			{ 	/* 11 */
102 				new ComboInput("HTML-content-text/uon", "/", MediaType.UON,
103 					"(name=helloWorld,description='Hello World')"
104 				)
105 			},
106 			{ 	/* 12 */
107 				new ComboInput("HTML-content-application/x-www-form-urlencoded", "/", MediaType.URLENCODING,
108 					"0=(name=helloWorld,description='Hello+World')"
109 				)
110 			},
111 			{ 	/* 13 */
112 				new ComboInput("HTML-content-text/xml", "/", MediaType.XML,
113 					"<name>helloWorld</name><description>Hello World</description>"
114 				)
115 			}
116 		});
117 	}
118 
119 
120 	public RootContentTest(ComboInput comboInput) {
121 		super(comboInput);
122 	}
123 }