/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.shardingsphere.example.transaction.xa.narayana.raw.jdbc;

import org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory;
import org.apache.shardingsphere.example.core.api.ExampleExecuteTemplate;
import org.apache.shardingsphere.example.core.api.service.ExampleService;

import javax.sql.DataSource;
import java.io.File;
import java.io.IOException;
import java.sql.SQLException;

//FIXME main class could not terminal after execute.
public final class ExampleMain {
    
    public static void main(final String[] args) throws SQLException, IOException {
        DataSource dataSource = YamlShardingSphereDataSourceFactory.createDataSource(getFile("/META-INF/sharding-databases-tables.yaml"));
        ExampleExecuteTemplate.run(getExampleService(dataSource));
        ExampleExecuteTemplate.runFailure(getExampleService(dataSource));
    }
    
    private static File getFile(final String fileName) {
        return new File(ExampleMain.class.getResource(fileName).getFile());
    }
    
    private static ExampleService getExampleService(final DataSource dataSource) {
        return new OrderServiceImpl(dataSource);
    }
}

@@ -1221,61 +1221,8 @@
 n;%0A%0A
-//FIXME main class could not terminal after execute.%0A
 publ
@@ -1615,24 +1615,48 @@
 taSource));%0A
+        System.exit(1);%0A
     %7D%0A    %0A 

exit narayana demo (#7899)