* org.onap.music
* ===================================================================
* Copyright (c) 2017 AT&T Intellectual Property
+ * Modifications Copyright (C) 2019 IBM.
* ===================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import java.util.UUID;
import org.apache.cassandra.exceptions.PreparedQueryNotFoundException;
import org.junit.Test;
+import org.onap.music.authentication.CachingUtil;
import org.onap.music.datastore.PreparedQueryObject;
import org.onap.music.exceptions.MusicServiceException;
import org.onap.music.main.MusicUtil;
@Test
public void testGetPropkeys() {
- assertEquals(MusicUtil.getPropkeys()[2],"music.ip");
+ assertEquals(MusicUtil.getPropkeys()[2],"debug");
}
@Test
}
@Test
- public void testConvertToCQLDataType() {
+ public void testConvertToCQLDataType() throws Exception {
Map<String,Object> myMap = new HashMap<String,Object>();
myMap.put("name","tom");
assertEquals(MusicUtil.convertToCQLDataType(DataType.varchar(),"Happy People"),"'Happy People'");
}
@Test
- public void testJsonMaptoSqlString() {
+ public void testJsonMaptoSqlString() throws Exception {
Map<String,Object> myMap = new HashMap<>();
myMap.put("name","tom");
myMap.put("value",5);
assertTrue(result.contains("name"));
assertTrue(result.contains("value"));
}
+
+ @Test
+ public void test_generateUUID() {
+ //this function shouldn't be in cachingUtil
+ System.out.println("Testing getUUID");
+ String uuid1 = MusicUtil.generateUUID();
+ String uuid2 = MusicUtil.generateUUID();
+ assertFalse(uuid1==uuid2);
+ }
+
@Test
- public void testSetErrorResponse() {
- Map<String,Object> myMap = new HashMap<>();
- myMap.put("name","tom");
- Map<String,HashMap<String,Object>> result = MusicUtil.setErrorResponse(new MusicServiceException("This is the error"));
- Map<String,Object> testMap = (Map<String,Object>) result.get("result");
- Map<String,Object> error = (Map<String,Object>) testMap.get("error");
- assertTrue(error.containsKey("error-description"));
+ public void testIsValidConsistency(){
+ assertTrue(MusicUtil.isValidConsistency("ALL"));
+ assertFalse(MusicUtil.isValidConsistency("TEST"));
}
}