44
55import gov .osti .entity .DOECodeMetadata ;
66import gov .osti .entity .Developer ;
7- import gov .osti .entity .SponsoringOrganization ;
87import java .util .ArrayList ;
98import java .util .Arrays ;
109import java .util .List ;
1817import org .junit .Test ;
1918
2019/**
21- * Test various METADATA related functionality.
22- *
20+ *
2321 * @author ensornl
2422 */
2523public class MetadataTest {
@@ -44,10 +42,10 @@ public void tearDown() {
4442 }
4543
4644 /**
47- * Test that SUBMIT VALIDATIONS work.
45+ * Test that PUBLISHED VALIDATIONS work.
4846 */
4947 @ Test
50- public void testValidateSubmit () {
48+ public void testValidatePublished () {
5149 DOECodeMetadata m = new DOECodeMetadata ();
5250
5351 // empty metadata should have numerous errors
@@ -61,8 +59,7 @@ public void testValidateSubmit() {
6159 "Description is required." ,
6260 "A License is required." ,
6361 "At least one developer is required." ,
64- "A valid Landing Page URL is required for non-open source submissions." ,
65- "Software type is required."
62+ "A valid Landing Page URL is required for non-open source submissions."
6663 };
6764
6865 for ( String message : validations ) {
@@ -78,7 +75,6 @@ public void testValidateSubmit() {
7875 assertFalse ("Still requiring title?" , reasons .contains ("Software title is required." ));
7976 assertFalse ("Still requiring accessibility" , reasons .contains ("Missing Source Accessibility." ));
8077 assertTrue ("Missing OS validation" , reasons .contains ("Repository URL is required for open source submissions." ));
81- assertTrue ("Missing software type validation" , reasons .contains ("Software type is required." ));
8278
8379 // test developer issues
8480 Developer d = new Developer ();
@@ -131,37 +127,18 @@ public void testValidateSubmit() {
131127 m .setDevelopers (developers );
132128 m .setProprietaryUrl ("http://mylicense.com/terms.html" );
133129 m .setDescription ("This is a testing description." );
134- m .setSoftwareType (DOECodeMetadata .Type .S );
135130
136131 reasons = Metadata .validateSubmit (m );
137132
138133 assertTrue ("Should be no more errors: " + StringUtils .join (reasons , ", " ), reasons .isEmpty ());
139134
140- // assert that the BUSINESS additional requirement is there
141- m .setSoftwareType (DOECodeMetadata .Type .B );
142-
143- reasons = Metadata .validateSubmit (m );
144-
145- assertFalse ("Missing business validation" , reasons .isEmpty ());
146- assertTrue ("Reason is wrong" , reasons .contains ("A sponsor is required for Business software." ));
147-
148- // fix it
149- SponsoringOrganization sponsor = new SponsoringOrganization ();
150- sponsor .setPrimaryAward ("AWARD" );
151- sponsor .setOrganizationName ("Testing Business Validation" );
152-
153- m .setSponsoringOrganizations (Arrays .asList (sponsor ));
154-
155- reasons = Metadata .validateSubmit (m );
156-
157- assertTrue ("Still have errors:" + StringUtils .join (reasons , ", " ), reasons .isEmpty ());
158135 }
159136
160137 /**
161- * Test some ANNOUNCE validations.
138+ * Test some SUBMIT validations.
162139 */
163140 @ Test
164- public void testValidateAnnounce () {
141+ public void testValidateSubmit () {
165142 // test that published ones also apply here
166143 DOECodeMetadata m = new DOECodeMetadata ();
167144
@@ -176,10 +153,9 @@ public void testValidateAnnounce() {
176153 "Description is required." ,
177154 "A License is required." ,
178155 "At least one developer is required." ,
179- "A valid Landing Page URL is required for non-open source submissions." ,
180- "Software type is required."
156+ "A valid Landing Page URL is required for non-open source submissions."
181157 };
182- String [] announce_validations = {
158+ String [] submit_validations = {
183159 "Release date is required." ,
184160 "At least one sponsoring organization is required." ,
185161 "At least one research organization is required." ,
@@ -193,8 +169,8 @@ public void testValidateAnnounce() {
193169 assertTrue ("Missing: " + message , reasons .contains (message ));
194170 }
195171
196- // also check announce only validations
197- for ( String message : announce_validations ) {
172+ // also check submit only validations
173+ for ( String message : submit_validations ) {
198174 assertTrue ("Missing: " + message , reasons .contains (message ));
199175 }
200176 }
0 commit comments