List of usage examples for java.util.logging Logger isLoggable
public boolean isLoggable(Level level)
From source file:com.ibm.ws.lars.rest.RepositoryRESTResourceLoggingTest.java
@Test public void testPostAssets(@Mocked final Logger logger, @Mocked SecurityContext context) { final String json = "{\"name\":\"myname\"}"; new Expectations() { {//w w w . j av a2s .c om logger.isLoggable(Level.FINE); result = true; logger.fine("postAssets called with json content:\n" + json); } }; getRestResource().postAssets(json, context); }
From source file:com.ibm.ws.lars.rest.RepositoryRESTResourceLoggingTest.java
@Test public void testGetAsset(@Mocked final Logger logger, @Mocked final SecurityContext sc) throws InvalidIdException, NonExistentArtefactException { new Expectations() { {//from w w w . ja v a2s .co m logger.isLoggable(Level.FINE); result = true; logger.fine("getAsset called with id of 'ffffffffffffffffffffffff'"); sc.isUserInRole("Administrator"); result = true; } }; getRestResource().getAsset(NON_EXISTENT_ID, dummyUriInfo, sc); }
From source file:com.ibm.ws.lars.rest.RepositoryRESTResourceLoggingTest.java
@Test public void testGetAssetReviews(@Mocked final Logger logger, @Mocked final SecurityContext sc) throws InvalidIdException, NonExistentArtefactException { new Expectations() { {/* w w w. j a va2 s . c o m*/ logger.isLoggable(Level.FINE); result = true; logger.fine("getAssetReviews called with id of 'ffffffffffffffffffffffff'"); sc.isUserInRole("Administrator"); result = true; } }; getRestResource().getAssetReviews(NON_EXISTENT_ID, dummyUriInfo, sc); }
From source file:com.ibm.ws.lars.rest.RepositoryRESTResourceLoggingTest.java
@Test public void testGetAttachmentContent(@Mocked final Logger logger, @Mocked final SecurityContext sc) throws InvalidIdException, NonExistentArtefactException { new Expectations() { {/* w w w .ja v a 2 s. c o m*/ logger.isLoggable(Level.FINE); result = true; logger.fine("getAttachmentContent called for assetId: " + NON_EXISTENT_ID + " attachmentId: " + NON_EXISTENT_ID + " name: " + "no_name"); sc.isUserInRole("Administrator"); result = true; } }; getRestResource().getAttachmentContent(NON_EXISTENT_ID, NON_EXISTENT_ID, "no_name", dummyUriInfo, sc); }
From source file:com.ibm.ws.lars.rest.RepositoryRESTResourceLoggingTest.java
@Test public void testCreateAttachmentNoContent(@Mocked final Logger logger) throws InvalidJsonAssetException, InvalidIdException, AssetPersistenceException, NonExistentArtefactException { new Expectations() { {/* w w w . j av a2 s.c om*/ logger.isLoggable(Level.FINE); result = true; logger.fine("createAttachmentNoContent called, name: " + "name" + " assetId: " + NON_EXISTENT_ID + " json content:\n" + "{}"); } }; getRestResource().createAttachmentNoContent("name", NON_EXISTENT_ID, null, "{}", dummyUriInfo); }
From source file:com.ibm.ws.lars.rest.RepositoryRESTResourceLoggingTest.java
@Test public void testUpdateAssetState(@Mocked final Logger logger) throws NonExistentArtefactException, RepositoryResourceLifecycleException { final String updateJson = "{\"action\":\"publish\"}"; new Expectations() { {/*from w w w . java 2s .c om*/ logger.isLoggable(Level.FINE); result = true; logger.fine("updateAssetState called for assetId: " + NON_EXISTENT_ID + " action: " + updateJson); } }; getRestResource().updateAssetState(NON_EXISTENT_ID, updateJson); }
From source file:com.ibm.ws.lars.rest.RepositoryRESTResourceLoggingTest.java
@Test public void testCountAssets(@Mocked final Logger logger, @Mocked final UriInfo info, @Mocked SecurityContext sc) throws URISyntaxException, InvalidParameterException { new Expectations() { {//www . ja v a2 s. c o m info.getQueryParameters(false); logger.isLoggable(Level.FINE); result = true; info.getRequestUri(); result = new URI("http://localhost:9085/ma/v1/assets?foo=bar"); logger.fine("countAssets called with query parameters: foo=bar"); } }; getRestResource().countAssets(info, sc); }
From source file:com.ibm.ws.lars.rest.RepositoryRESTResourceLoggingTest.java
@Test public void testCreateAttachmentWithContent(@Mocked final Logger logger, @Mocked final BufferedInMultiPart inMultiPart) throws InvalidJsonAssetException, InvalidIdException, AssetPersistenceException, NonExistentArtefactException { new Expectations() { {/*from ww w . j a v a 2 s .com*/ logger.isLoggable(Level.FINE); result = true; logger.fine("createAttachmentWithContent called, name: " + "name" + " assetId: " + NON_EXISTENT_ID); } }; getRestResource().createAttachmentWithContent("name", NON_EXISTENT_ID, null, inMultiPart, dummyUriInfo); }
From source file:com.ibm.ws.lars.rest.RepositoryRESTResourceLoggingTest.java
@Test public void testGetAssets(@Mocked final Logger logger, @Mocked final UriInfo info, @Mocked SecurityContext context) throws URISyntaxException, JsonProcessingException, InvalidParameterException { new Expectations() { {/*w w w . ja va 2s . co m*/ info.getQueryParameters(false); logger.isLoggable(Level.FINE); result = true; info.getRequestUri(); result = new URI("http://localhost:9085/ma/v1/assets?foo=bar"); logger.fine("getAssets called with query parameters: foo=bar"); } }; getRestResource().getAssets(info, context); }
From source file:com.ibm.sbt.services.endpoints.AbstractEndpoint.java
@Override public JSReference getProxy(String endpointName, String moduleId) { String proxyModuleId = moduleId; Proxy proxy = null;//from w ww.j av a 2s . co m if (this.getProxyConfig() != null) { try { proxy = ProxyFactory.getProxyConfig(this.getProxyConfig()); if (proxy != null && proxy.getProxyModule() != null) { proxyModuleId = proxy.getProxyModule(); } } catch (ProxyConfigException ex) { Logger logger = Logger.getLogger(AbstractEndpoint.class.getName()); if (logger.isLoggable(Level.SEVERE)) { logger.severe(ex.getMessage()); } } } return new JSReference(proxyModuleId); }