test_class.file: webapp/tempdir/src/test/java/cloud/piranha/webapp/tempdir/TempDirInitializerTest.java
test_class.identifier: TempDirInitializerTest
test_case.body: @Test
      void testOnStartup() throws Exception {
          DefaultWebApplication webApplication = new DefaultWebApplication();
          webApplication.setContextPath("my_servlet_context_name");
          TempDirInitializer initializer = new TempDirInitializer();
          initializer.onStartup(null, webApplication);
          File tempDir = new File("tmp/my_servlet_context_name");
          assertTrue(tempDir.exists());
          tempDir.delete();
          tempDir.getParentFile().delete();
      }
test_case.class_method_signature: TempDirInitializerTest.testOnStartup()
test_case.full_signature: @Test void testOnStartup()
test_case.identifier: testOnStartup
test_case.invocations: setContextPath onStartup assertTrue exists delete delete getParentFile
test_case.modifiers: @Test
test_case.parameters: ()
test_case.return: void
test_case.signature: void testOnStartup()
focal_class.declarator: LOGGER = Logger.getLogger(TempDirInitializer.class.getName())
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = Logger.getLogger(TempDirInitializer.class.getName());
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.file: webapp/tempdir/src/main/java/cloud/piranha/webapp/tempdir/TempDirInitializer.java
focal_class.identifier: TempDirInitializer
focal_class.interfaces: implements ServletContainerInitializer
focal_class.class_method_signature: TempDirInitializer.onStartup(Set<Class<?>> classes, ServletContext servletContext)
focal_class.full_signature: @Override public void onStartup(Set<Class<?>> classes, ServletContext servletContext)
focal_class.identifier: onStartup
focal_class.modifiers: @Override public
focal_class.parameters: (Set<Class<?>> classes, ServletContext servletContext)
focal_class.return: void
focal_class.signature: void onStartup(Set<Class<?>> classes, ServletContext servletContext)
focal_method.body: @Override
      public void onStartup(Set<Class<?>> classes, ServletContext servletContext) throws ServletException {
          File baseDir = new File("tmp");
          String name = servletContext.getContextPath();
          name = name.replaceAll("/", "_");
          if (name.trim().equals("")) {
              name = "ROOT";
          }
          File tempDir = new File(baseDir, name);
          if (!tempDir.exists()) {
              tempDir.mkdirs();
          }
          LOGGER.log(FINE, "Setting TEMPDIR for context ''{0}'' to ''{1}''",
                  new Object[]{servletContext.getContextPath(), tempDir});
          servletContext.setAttribute(TEMPDIR, tempDir);
      }
focal_method.class_method_signature: TempDirInitializer.onStartup(Set<Class<?>> classes, ServletContext servletContext)
focal_method.full_signature: @Override public void onStartup(Set<Class<?>> classes, ServletContext servletContext)
focal_method.identifier: onStartup
focal_method.invocations: getContextPath replaceAll equals trim exists mkdirs log getContextPath setAttribute
focal_method.modifiers: @Override public
focal_method.parameters: (Set<Class<?>> classes, ServletContext servletContext)
focal_method.return: void
focal_method.signature: void onStartup(Set<Class<?>> classes, ServletContext servletContext)