33
44import com .example .personalize .*;
55import com .google .gson .Gson ;
6+ import org .slf4j .Logger ;
7+ import org .slf4j .LoggerFactory ;
68import software .amazon .awssdk .auth .credentials .EnvironmentVariableCredentialsProvider ;
79import software .amazon .awssdk .services .personalize .PersonalizeClient ;
810import org .junit .jupiter .api .*;
2123@ TestInstance (TestInstance .Lifecycle .PER_METHOD )
2224@ TestMethodOrder (MethodOrderer .OrderAnnotation .class )
2325public class PersonalizeTest {
24-
26+ private static final Logger logger = LoggerFactory . getLogger ( PersonalizeTest . class );
2527 private static PersonalizeRuntimeClient personalizeRuntimeClient ;
2628 private static PersonalizeClient personalizeClient ;
2729 private static String datasetGroupArn = "" ;
@@ -59,40 +61,6 @@ public static void setUp() {
5961 ;
6062 existingSolutionArn = values .getExistingSolutionArn ();
6163 existingCampaignName = values .getExistingCampaignName ();
62-
63- // Uncomment this code block if you prefer using a config.properties file to
64- // retrieve AWS values required for these tests.
65- /*
66- *
67- * try (InputStream input =
68- * PersonalizeTest.class.getClassLoader().getResourceAsStream(
69- * "config.properties")) {
70- *
71- * Properties prop = new Properties();
72- *
73- * if (input == null) {
74- * System.out.println("Sorry, unable to find config.properties");
75- * return;
76- * }
77- *
78- * //load a properties file from class path, inside static method
79- * prop.load(input);
80- *
81- * // Populate the data members required for all tests
82- * datasetGroupArn = prop.getProperty("datasetGroupArn");
83- * solutionVersionArn = prop.getProperty("solutionVersionArn");
84- * recipeArn = prop.getProperty("recipeArn");
85- * solutionName = prop.getProperty("solutionName")+
86- * java.util.UUID.randomUUID();;
87- * userId = prop.getProperty("userId");
88- * campaignName= prop.getProperty("campaignName")+ java.util.UUID.randomUUID();;
89- * existingSolutionArn= prop.getProperty("existingSolutionArn");
90- * existingCampaignName = prop.getProperty("existingCampaignName");
91- *
92- * } catch (IOException ex) {
93- * ex.printStackTrace();
94- * }
95- */
9664 }
9765
9866 @ Test
@@ -102,23 +70,23 @@ public void CreateSolution() {
10270 solutionArn = CreateSolution .createPersonalizeSolution (personalizeClient , datasetGroupArn , solutionName ,
10371 recipeArn );
10472 assertFalse (solutionArn .isEmpty ());
105- System . out . println ("Test 1 passed" );
73+ logger . info ("Test 1 passed" );
10674 }
10775
10876 @ Test
10977 @ Tag ("IntegrationTest" )
11078 @ Order (2 )
11179 public void ListSolutions () {
11280 assertDoesNotThrow (() -> ListSolutions .listAllSolutions (personalizeClient , datasetGroupArn ));
113- System . out . println ("Test 2 passed" );
81+ logger . info ("Test 2 passed" );
11482 }
11583
11684 @ Test
11785 @ Tag ("IntegrationTest" )
11886 @ Order (3 )
11987 public void DescribeSolution () {
12088 assertDoesNotThrow (() -> DescribeSolution .describeSpecificSolution (personalizeClient , solutionArn ));
121- System . out . println ("Test 3 passed" );
89+ logger . info ("Test 3 passed" );
12290 }
12391
12492 @ Test
@@ -127,47 +95,47 @@ public void DescribeSolution() {
12795 public void CreateCampaign () {
12896 campaignArn = CreateCampaign .createPersonalCompaign (personalizeClient , solutionVersionArn , campaignName );
12997 assertFalse (campaignArn .isEmpty ());
130- System . out . println ("Test 4 passed" );
98+ logger . info ("Test 4 passed" );
13199 }
132100
133101 @ Test
134102 @ Tag ("IntegrationTest" )
135103 @ Order (5 )
136104 public void ListCampaigns () {
137105 assertDoesNotThrow (() -> ListCampaigns .listAllCampaigns (personalizeClient , existingSolutionArn ));
138- System . out . println ("Test 5 passed" );
106+ logger . info ("Test 5 passed" );
139107 }
140108
141109 @ Test
142110 @ Tag ("IntegrationTest" )
143111 @ Order (6 )
144112 public void DescribeRecipe () {
145113 assertDoesNotThrow (() -> DescribeRecipe .describeSpecificRecipe (personalizeClient , recipeArn ));
146- System . out . println ("Test 6 passed" );
114+ logger . info ("Test 6 passed" );
147115 }
148116
149117 @ Test
150118 @ Tag ("IntegrationTest" )
151119 @ Order (7 )
152120 public void ListRecipes () {
153121 assertDoesNotThrow (() -> ListRecipes .listAllRecipes (personalizeClient ));
154- System . out . println ("Test 7 passed" );
122+ logger . info ("Test 7 passed" );
155123 }
156124
157125 @ Test
158126 @ Tag ("IntegrationTest" )
159127 @ Order (8 )
160128 public void ListDatasetGroups () {
161129 assertDoesNotThrow (() -> ListDatasetGroups .listDSGroups (personalizeClient ));
162- System . out . println ("Test 8 passed" );
130+ logger . info ("Test 8 passed" );
163131 }
164132
165133 @ Test
166134 @ Tag ("IntegrationTest" )
167135 @ Order (9 )
168136 public void DeleteSolution () {
169137 assertDoesNotThrow (() -> DeleteSolution .deleteGivenSolution (personalizeClient , solutionArn ));
170- System . out . println ("Test 9 passed" );
138+ logger . info ("Test 9 passed" );
171139 }
172140
173141
@@ -179,7 +147,7 @@ public void DeleteCampaign() {
179147 DeleteCampaign .waitForCampaignToBeDeletable (personalizeClient , campaignArn );
180148 DeleteCampaign .deleteSpecificCampaign (personalizeClient , campaignArn );
181149 });
182- System . out . println ("Test 10 passed" );
150+ logger . info ("Test 10 passed" );
183151 }
184152
185153 private static String getSecretValues () {
0 commit comments