summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/pdf/PdfBeanTest.java
blob: a1db0d828ed01f400b95421830a0264d4e89cd9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*
 * ============LICENSE_START==========================================
 * ONAP Portal SDK
 * ===================================================================
 * Copyright © 2018 AT&T Intellectual Property. All rights reserved.
 * ===================================================================
 *
 * Unless otherwise specified, all software contained herein is licensed
 * under the Apache License, Version 2.0 (the "License");
 * you may not use this software except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *             http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Unless otherwise specified, all documentation contained herein is licensed
 * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
 * you may not use this documentation except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *             https://creativecommons.org/licenses/by/4.0/
 *
 * Unless required by applicable law or agreed to in writing, documentation
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * ============LICENSE_END============================================
 *
 * 
 */
package org.onap.portalsdk.analytics.model.pdf;

import static org.junit.Assert.assertEquals;

import org.junit.Before;
import org.junit.Test;

public class PdfBeanTest {
	PdfBean pdfBean;
	
	public static final int NUMBER_IN_HEADER = 0;
	public static final int NUMBER_IN_FOOTER = 1;
	public static final int NUMBER_IN_BOTH = 2;
	
	private boolean ALTERNATE_COLOR = true;
	private boolean IS_PORTRAIT = true;
	private boolean IS_COVER_PAGE_INCLUDED = true;
	private boolean IS_DISPLAY_CHART = true;
	private int CURRENT_PAGE = 1;
	private int WHERE_TO_SHOW_PAGE_NUMBER = 2;
	private String USER_ID = "userID";
	private String TIMESTAMP_PATTERN = "timestampPattern";
	private String TITLE = "title";
	private String LEFT_FOOTER = "leftFooter";
	private String PAGE_SIZE = "pageSize";
	private boolean IS_ATTACHMENT_OF_EMAIL = true;
	private String LOGO1_URL = "logo1Url";
	private Integer LOGO1_SIZE = 100;
	private String LOGO2_URL= "logo2Url";
	private Integer LOGO2_SIZE = 200;
	private String FULL_WEB_CONTEXT_PATH = "fullWebContextPath";
	
	
	@Before
	public void init() {
		pdfBean = new PdfBean();
		pdfBean.setAlternateColor(ALTERNATE_COLOR);
		pdfBean.setPortrait(IS_PORTRAIT);
		pdfBean.setCoverPageIncluded(IS_COVER_PAGE_INCLUDED);
		pdfBean.setDisplayChart(IS_DISPLAY_CHART);
		pdfBean.setCurrentPage(CURRENT_PAGE);
		pdfBean.setWhereToShowPageNumber(WHERE_TO_SHOW_PAGE_NUMBER);
		pdfBean.setUserId(USER_ID);
		pdfBean.setTimestampPattern(TIMESTAMP_PATTERN);
		pdfBean.setTitle(TITLE);
		pdfBean.setLeftFooter(LEFT_FOOTER);
		pdfBean.setPagesize(PAGE_SIZE);
		pdfBean.setAttachmentOfEmail(IS_ATTACHMENT_OF_EMAIL);
		pdfBean.setLogo1Url(LOGO1_URL);
		pdfBean.setLogo1Size(LOGO1_SIZE);
		pdfBean.setLogo2Url(LOGO2_URL);
		pdfBean.setLogo2Size(LOGO2_SIZE);
		pdfBean.setFullWebContextPath(FULL_WEB_CONTEXT_PATH);
	}
	
	@Test
	public void testPdfBeanProperties() {
		assertEquals(ALTERNATE_COLOR, pdfBean.isAlternateColor());
		assertEquals(IS_PORTRAIT, pdfBean.isPortrait());
		assertEquals(IS_COVER_PAGE_INCLUDED, pdfBean.isCoverPageIncluded());
		assertEquals(IS_DISPLAY_CHART, pdfBean.isDisplayChart());
		assertEquals(CURRENT_PAGE, pdfBean.getCurrentPage());
		assertEquals(2, pdfBean.getWhereToShowPageNumber());
		assertEquals(USER_ID, pdfBean.getUserId());
		assertEquals(TIMESTAMP_PATTERN, pdfBean.getTimestampPattern());
		assertEquals(TITLE, pdfBean.getTitle());
		assertEquals(LEFT_FOOTER, pdfBean.getLeftFooter());
		assertEquals(PAGE_SIZE, pdfBean.getPagesize());
		assertEquals(IS_ATTACHMENT_OF_EMAIL, pdfBean.isAttachmentOfEmail());
		assertEquals(LOGO1_URL, pdfBean.getLogo1Url());
		assertEquals(LOGO1_SIZE, pdfBean.getLogo1Size());
		assertEquals(LOGO2_URL, pdfBean.getLogo2Url());
		assertEquals(LOGO2_SIZE, pdfBean.getLogo2Size());
		assertEquals(FULL_WEB_CONTEXT_PATH, pdfBean.getFullWebContextPath());				
	}
}